Results 1 to 6 of 6

Thread: assignAsTurret moveInTurret workaround

  1. #1
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614

    assignAsTurret moveInTurret workaround

    assignAsTurret workaround
    Updated - 18 July 2011.

    As you all may already know, there is no assignAsTurret command wich makes AI run to a vehicle and mount a turret wich is not gunner or commander.
    use this script to make any AI run to any vehicle and enter the specified turret from the correct position.

    Notes:
    Spoiler:


    save as turret.sqf
    Spoiler:


    this below is what this thread contained before. its for filling an entire group into a vehicle, not just 1 single unit.
    Spoiler:
    Last edited by Demonized; Jul 20 2011 at 22:59. Reason: added small code to find any turret array to be used with the script.
    My scripts:
    Spoiler:

    what to do when posting any kind of code dammit!!

    Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.

  2. #2
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    Author of the Thread
    nvm...........

    Edit: just realised all commander seats is counted as a turret in cfg files i used.
    then i can just check for emptypositions commander and remove 1 if there is from total guns, turrets count.


    New improved version soon to be released.
    Last edited by Demonized; Mar 21 2011 at 16:47. Reason: added edit.

  3. #3
    I think that it is the best way for filling all turrets

    Spoiler:

  4. #4
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    Author of the Thread
    yes that will work, but then you will get magic teleport and not AI boarding the turret wich is what i wanted to avoid doing.
    I wanted workaorund for the missing assignAsTurret command.

    if you simply want to fill a vehicle with magic teleport just use this:Spoiler:


    Edit: what is the purpose of all the position things in your script DAP?
    does it give a correct boarding position?
    Last edited by Demonized; Apr 4 2011 at 20:28.

  5. #5
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    Author of the Thread
    First post updated with fully working workaround for missing assignAsTurret command on any vehicle.

    Ai runs to correct position and mounts the specified turret correctly.

  6. #6
    My teleport to leader script only teleports players into the gunner seat if it is available, but it would be great if it was possible to teleport them into the other available turret positions. For instance, my mission uses Chinook HC4 that has three gunner/turret positions. Just yesterday my friend teleported to leader and wound up in the back of the Chinook and then he said, "Ahh man, this sucks, there are 2 empty gun seats and I'm stuck sitting back here". So I thought maybe you could help.

    Flag Pole Init:
    Code:
    this addAction ["Teleport to Team Leader", "teleport_to_leader.sqf", [], 51, true, true, "", "player != s1"];
    teleport_to_leader.sqf:
    Code:
    _unit = _this select 1;
    
    
    if (!alive s1) then {
    	hint "The Team Leader is currently dead.";
    } else {
    	if (vehicle s1 == s1) then {
    		_unit setDir direction s1;
    		_unit setPosATL [getPosATL s1 select 0,getPosATL s1 select 1,getPosATL s1 select 2];
    		_unit setPos (s1 modelToWorld [+0.75,-1,((position s1) select 2)+0]);
    	} else {
    		if (vehicle s1 != s1) then {
    		_freePosGunner = (vehicle s1) emptyPositions "gunner";
    		_freePosCommander = (vehicle s1) emptyPositions "commander";
    		_freePosCargo = (vehicle s1) emptyPositions "cargo";
    		_freePosDriver = (vehicle s1) emptyPositions "driver";
    		if (_freePosGunner > 0) then {
    			_unit moveInGunner (vehicle s1);
    		} else {
    			if (_freePosCommander > 0) then {
    				_unit moveInCommander (vehicle s1);
    			} else {
    				if (_freePosCargo > 0) then {
    					_unit moveInCargo (vehicle s1);
    				} else {
    					if (_freePosDriver > 0) then {
    						_unit moveInDriver (vehicle s1);
    					} else {
    						hint "The Team Leader's vehicle currently has no empty seats to teleport to.";
    					};
    				};
    			};
    		};
    	};
    };
    Would it be possible to add a turret array and check for available turret positions and use moveInTurret instead of moveInGunner?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •