Somerville 0 Posted July 8, 2007 I'm looking for a way to determine what weapons a unit has. Then for these weapons to be taken from the unit, and placed in a crate, where they can be picked up at a later time. It's because I'm making a mission where you can go into a duel with another unit in Paraiso, only with an M9 ^.^ But I want it so you can go there with say an M16A2, and it'll take that off you when you enter the fight and store it in a crate so you can get back to it later. Share this post Link to post Share on other sites
Schwab 0 Posted July 8, 2007 Cant see any problems with http://community.bistudio.com/wiki/weapons and http://community.bistudio.com/wiki/ammo and http://community.bistudio.com/wiki/removeAllWeapons and http://community.bistudio.com/wiki/addWeapon and http://community.bistudio.com/wiki/addMagazine Share this post Link to post Share on other sites
johnnyboy 3797 Posted July 8, 2007 Here's the building blocks for what you need: 1. Find all weapons held by unit (returns array of weapons: _wpn_array = weapons unit; _mag_arry  = magazines unit; 2. Remove weapons from unit: removeAllWeapons unit; removeAllMagazines unit; 3. Add weapons/magazines to a crate or vehicle: crate1 addMagazineCargo [magazineName, count] ; crate1 addWeaponCargo [magazineName, count] ; 4. Addweapon/magazines to unit: unit addWeapon weaponName ; unit addMagazine magazineName ; You will need to get the array of weapons and ammo, then loop throught the array to load an ammo crate from the array. To give you an idea, below is a simple script that gets the weapons for a unit, then loops the array and displays each weapon name and magazine name. There are "ammo crate filler" scripts out there at www.OFPEC.com if you look around. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;show_equip.sqs _dude = _this select 0 _weapons = weapons _dude _mags = magazines _dude _cnt = count _weapons _x = 0 ~2 #loop1 TitleText[format["_x= %1, weapon=%2",_x, _weapons select _x], "plain",1] _x = _x +1 ~3 ?_x < _cnt: goto "loop1" _cnt = count _mags _x = 0 #loop2 TitleText[format["mag=%1",_mags select _x], "plain",1] _x = _x +1 ~1 ?_x < _cnt: goto "loop2" #end exit Edit: Schwab beat me to the punch. Share this post Link to post Share on other sites