Forum Jump :

Author Message


Posts: 76
Rank:


Level: Member

Country: au
Location:
Occupation: Student/DIY minor scripter
Age: 21
In-game name: Drew

 
#1 Posted at 2012-11-17 10:00        
     
Hi all. Right now I am making a random weapon/equipment spawn, and have run into strife. I want there to be a random chance of spawning a backpack at a game logic. The script goes as follows...
private ["_ammobox","_loc"];

_loc = _this select 0;
_ammobox = createVehicle [ "WeaponHolder",[getPos _loc select 0, getpos _loc select 1,0],[], 0, "can_collide"];


while {alive _ammobox} do {

//create a random number
_rNumber = ceil (random 100);

if ((_rNumber < 100)&&(_rNumber > 92)) then { _ammobox addWeaponCargo ["Colt1911" ,1] };
if (_rNumber < 4) then { _ammobox addWeaponCargo ["LeeEnfield" ,1] };
if ((_rNumber < 85)&&(_rNumber > 82)) then { _ammobox addWeaponCargo ["revolver_gold_EP1" ,1] };
if ((_rNumber < 82)&&(_rNumber > 55)) then { _ammobox addWeaponCargo ["Huntingrifle" ,1] }; 
if ((_rNumber < 55)&&(_rNumber > 30)) then { _ammobox addWeaponCargo ["revolver_EP1" ,1] };
if (_rNumber < 50) then { _ammobox addBackPack ["TK_ALICE_Pack_EP1" ,1] };

sleep 8800;

//clear the ammo box
clearweaponcargo _ammobox;
clearmagazinecargo _ammobox;
nul = [_loc] execVM "fillammobox.sqf";

};
This is executed from the init line of a game logic. All the weapons spawn fine, just the backpack that has problems. Maybe it is because the weapon holder and the backpack are both containers? Any help would be appreciated. :)

=Foxhound]You can add 250.004 smileys to your post but not a proper title and proper info?[/quote]

Author Message

Pirin  



Posts: 1547
Rank:


Level: Member

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 43
In-game name: kylania

 
#2 Posted at 2012-11-17 10:36        
     
http://community.bistudio.com/wiki/addBackpackCargo


Advertisement


Author Message


Posts: 76
Rank:


Level: Member

Country: au
Location:
Occupation: Student/DIY minor scripter
Age: 21
In-game name: Drew

 
#3 Posted at 2012-11-18 07:46        
     
Much obliged

=Foxhound]You can add 250.004 smileys to your post but not a proper title and proper info?[/quote]