Forum Jump :

Author Message

Posts: 175

Level: Member

Country: us
Location: New jersey
Occupation: Flying
Age: 23
In-game name: Starsky396

#1 Posted at 2012-11-26 04:02        
Is there any way to create a script where there is a ammobox that can be spawned in a trigger with random loot? I've been searching the fourms but all I've been able to find is how to put a ammobox in a random position. But I need to have random loot in the ammobox.

By the way I need the ammobox to be in houses and shelters. All I have been able to do is have a marker named pusta and a script in a trigger with
nearestObject [Pusta, "House"]
in the on act and
_veh = createVehicle ["GuerillaCacheBox_EP1",getMarkerPos "Pusta",0, "CAN_COLLIDE"]
but it never works.

Author Message

Posts: 11

Level: Member

Country: ca
In-game name:

#2 Posted at 2012-12-02 22:14        
As far as I know, there is no way to do this by default. You will have to create a script to do this.

After you create the ammo box, remove all the items.
clearWeaponCargo _veh;
clearMagazineCargo _veh;

Then you can randomly select items to add. For example
_wep = weaponArray select(floor(random count weaponArray));
_veh addWeaponCargo [_wep, 5];
Where weaponArray is an array that contains the classnames for the weapons from which you want to select.

This would add 5 of that weapon into the ammo box.