Jump to content
Sign in to follow this  
Ilias48rus

Save crew

Recommended Posts

Anyone please help, how to save all units in vehicle for have ability place them back to same seats (including situations when there is empty places) ?

Share this post


Link to post
Share on other sites

You can use getCargoIndex to save their place and moveInCargo and assignAsCargoIndex to move them back.  Use all the other driver, gunner, turret commands as needed for the rest of the crew.

unit1 assignAsCargoIndex [heli, 3];
unit1 moveInCargo heli;

You might also want to look into a caching script such as SSSC instead of manually doing it.

  • Like 2

Share this post


Link to post
Share on other sites

You can use getCargoIndex to save their place and moveInCargo and assignAsCargoIndex to move them back.  Use all the other driver, gunner, turret commands as needed for the rest of the crew.

unit1 assignAsCargoIndex [heli, 3];
unit1 moveInCargo heli;

You might also want to look into a caching script such as SSSC instead of manually doing it.

thanks, looks promising, looking in,

 

Or you could use fullCrew to receive roles, turret-, person turret paths and empty seats.

 

Cheers

strange., did i missed it?, thanks, how to unpack it after ? (just do not write "by set of commands" :) please, the set would be great)

Share this post


Link to post
Share on other sites

You can use getCargoIndex to save their place and moveInCargo and assignAsCargoIndex to move them back.  Use all the other driver, gunner, turret commands as needed for the rest of the crew.

unit1 assignAsCargoIndex [heli, 3];
unit1 moveInCargo heli;

You might also want to look into a caching script such as SSSC instead of manually doing it.

looks like it have same problem i meted with unability to save uniforms, vests in cargo space,

_a=assignedVehicleRole _u;
_u setpos getpos _o;     //(getout)
switch(_a select 0)do{
     case"cargo":{
          moveInCargo[_o,_a select 1];
     }..

(commands from SSSC),

thank you, guies its fine

 

(

You can use getCargoIndex to save their place and moveInCargo and assignAsCargoIndex to move them back.  Use all the other driver, gunner, turret commands as needed for the rest of the crew.

unit1 assignAsCargoIndex [heli, 3];
unit1 moveInCargo heli;

You might also want to look into a caching script such as SSSC instead of manually doing it.

yeah, right, just there is move.. commands supporting indexes too)

Share this post


Link to post
Share on other sites
/*
fulLCrew output for a Ghosthawk.
[
	[oldHeliD,"driver",-1,[],false],
	[B Alpha 1-2:5,"cargo",0,[],false],
	[B Alpha 1-3:1,"cargo",6,[],false],
	[B Alpha 1-2:3,"Turret",-1,[0],false],
	[oldHeliG,"gunner",-1,[1],false],
	[B Alpha 1-2:4,"Turret",-1,[2],false]
]
*/

// Grab original crew positions
_crew = fullCrew oldHeli;

{
	_x params["_unit", "_seat", "_index", "_turret"];

	// Grab new "cached" unit, just delete this if you're using original crew.  Remember to boot them first.
	// newCrew would be the group name of the replacement crew for this vehicle.
	_unit = units newCrew select _forEachIndex;
	
	switch (toLower(_seat)) do {
		case "driver": {
			_unit assignAsDriver newHeli;
			_unit moveInDriver newHeli;
		};
		case "gunner": {
			_unit assignAsGunner newHeli;
			_unit moveInGunner newHeli;
		};
		case "turret": {
			_unit assignAsTurret [newHeli, _turret];
			_unit moveInTurret [newHeli, _turret];
		};
		case "cargo": {
			_unit assignAsCargoIndex [newHeli, _index];
			_unit moveInCargo [newHeli, _index];
		};
	};
} foreach _crew;

This assumes you're moving in a fresh crew (from being cached beforehand.  If you're just moving the same crew you might run into issues moving units out of their spots.  Turret users didn't respect a setPos command and hopped out instead of teleporting out.

  • Like 1

Share this post


Link to post
Share on other sites

looks like it have same problem i meted with unability to save uniforms, vests in cargo space,

 

getItemCargo and addItemCargoGlobal should handle Uniforms and Vests in cargo.

// _items = [["FirstAidKit","ToolKit","Medikit","ItemGPS","U_I_C_Soldier_Bandit_4_F","V_PlateCarrierGL_blk"],[8,1,1,1,1,1]]
myitems = getItemCargo oldHeli; 
myitemCount = count (myitems select 0); 
for "_i" from 0 to (myitemCount - 1) do { 
  newHeli addItemCargoGlobal [(myitems select 0) select _i, (myitems select 1) select _i]; 
}; 

Share this post


Link to post
Share on other sites

 

yeah, right,

in last 3 days i already writed ~600 lines (really a lot of different things in same time) and continuing with ~ same speed so the post helps, thanks

getItemCargo and addItemCargoGlobal should handle Uniforms and Vests in cargo.

// _items = [["FirstAidKit","ToolKit","Medikit","ItemGPS","U_I_C_Soldier_Bandit_4_F","V_PlateCarrierGL_blk"],[8,1,1,1,1,1]]
myitems = getItemCargo oldHeli; 
myitemCount = count (myitems select 0); 
for "_i" from 0 to (myitemCount - 1) do { 
  newHeli addItemCargoGlobal [(myitems select 0) select _i, (myitems select 1) select _i]; 
}; 

guies i forgot and question was (is) only about the container's (uniforms, vests (in object's cargo)) inventory

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×