Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: au
Location:
Occupation:
Age:
In-game name: ferret249

 
#1 Posted at 2014-02-09 03:42        
     
Ok, I can attach one ammo box to a container with this script
_mark = _this select 0;

_vehicle = (nearestObjects [_mark, ["Land_Cargo20_military_green_F"], 4]);  

_veh = _vehicle select 0; 

_object = _veh;



_object lockCargo true;


	//ammo crate

		_crate = "Box_NATO_AmmoOrd_F" createVehicle (getPos _object);
		 
		    				
				clearWeaponcargoGlobal _Crate;
				clearmagazinecargoGlobal _Crate;
				  
				_crate addbackpackcargoGlobal ["B_Mortar_01_weapon_F",1];
				_crate addbackpackcargoGlobal ["B_Mortar_01_support_F",1];

while {alive _object} do {
				_crate attachTo [_object,[2.5,-.9,-.9]];
				_crate setDamage 0;
				detach _crate;
				_crate attachTo [_object,[2.5,-.9,-.9]];
                _crate setDir 90;				
				};
There a reason I need the
while {alive _object} do {
				_crate attachTo [_object,[2.5,-.9,-.9]];
				_crate setDamage 0;
				detach _crate;
				_crate attachTo [_object,[2.5,-.9,-.9]];
                _crate setDir 90;
because the create wont follow its position in the container if the container falls but if i want to add another ammo box it wont work, here is the script i used
_mark = _this select 0;

_vehicle = (nearestObjects [_mark, ["Land_Cargo20_military_green_F"], 4]);  

_veh = _vehicle select 0; 

_object = _veh;



_object lockCargo true;


	//ammo crate

		_crate = "Box_NATO_AmmoOrd_F" createVehicle (getPos _object);
		 
		    				
				clearWeaponcargoGlobal _Crate;
				clearmagazinecargoGlobal _Crate;
				  
				_crate addbackpackcargoGlobal ["B_Mortar_01_weapon_F",1];
				_crate addbackpackcargoGlobal ["B_Mortar_01_support_F",1];

while {alive _object} do {
				_crate attachTo [_object,[2.5,-.9,-.9]];
				_crate setDamage 0;
				detach _crate;
				_crate attachTo [_object,[2.5,-.9,-.9]];
                _crate setDir 90;				
				};

		_crate = "Box_NATO_AmmoOrd_F" createVehicle (getPos _object);

while {alive _object} do {
				_crate attachTo [_object,[0,0,0]];
				_crate setDamage 0;
				detach _crate;
				_crate attachTo [_object,[0,0,0]];	
                _crate setDir 90;				
				};
			

				

		};
	};	
But this script only creates the first ammo box and i have spent ages trying to figure out whats wrong but no luck.


Author Message

Crix  



Posts: 122
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2014-02-09 11:11        
     
The second crate will be created once _object is not alive. Your while Loop blocks the second crate from appearing.