OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: minimilo on 19 Jul 2004, 20:49:13

Title: ammo crates
Post by: minimilo on 19 Jul 2004, 20:49:13
i can take and give soldiers weapons by using a trigger and removeallweapons ect, but it dosent work for crates, and ive tride addweaponscargo, can some1 tell me what to do step by step, cheers :'(
Title: Re:ammo crates
Post by: DBR_ONIX on 19 Jul 2004, 21:22:23
Not sure exactly
But you use
this addweaponscargo ["M16",5]

That would add 5 m16s to the crate :)
- Ben
Title: Re:ammo crates
Post by: THobson on 19 Jul 2004, 23:29:17
Only if the line was in the init field of the crate.  

If you put the name of the ammo crate instead of 'this' then you could use the instruction in a trigger.
Title: Re:ammo crates
Post by: SilentHunter_764 on 20 Jul 2004, 08:12:33
more info plz?

i've been wondering how to get soliders to take weapons from a crate without me telling em to, but how do you make them do it without help?

plz help

also, how do you make a solider start with a certain weapon?

E.G. US solider with a M-21
silenthunter_764
Title: Re:ammo crates
Post by: j-man on 20 Jul 2004, 08:42:05
Quote
also, how do you make a solider start with a certain weapon?

put in the units init field:

this addmagazine "M21"; this addmagazine "M21"; this addmagazine "M21"; this addmagazine "M21"; this addmagazine "M21"; this addweapon "M21"

EDIT
Oh ya, check THobson's post below about removing the previous weapons/magazines.

Quote
i've been wondering how to get soliders to take weapons from a crate without me telling em to, but how do you make them do it without help?

through scripting:

Code: [Select]
soldier domove (getpos ammocrate)

#loop
~0.5
?(soldier distance ammocrate < 2) goto "takeammo"
goto "loop"

#takeammo
soldier action ["take weapon",ammocrate,0,0,ak47]
~0.1

soldier addmagazine "AK47"
soldier addmagazine "AK47"
soldier addmagazine "AK47"
soldier addmagazine "AK47"
soldier addmagazine "AK47"

exit

this will make the soldier (named "soldier") walk up to a crate (name "ammocrate") and take 5 AK47 magazines. All you need to do is find some way of checking if a unit is low on ammo and then executing the above script.
Title: Re:ammo crates
Post by: THobson on 20 Jul 2004, 08:48:23
No idea on the first.  Edit - ah see above, it was posted while I was writing.

On the second.  In the init field of the unit you need to remove the weapons/magazines he has by default.  See:
removeAllWeapons unit
unit removeMagazines weaponName
unit removeMagazine weaponName
unit removeWeapon weaponName

Then add weapons and magazines individually.  See:
unit addMagazine weaponName
unit addWeapon weaponName

Note each magazine needs its own instruction.  Take care not to give him more than he can carry of any given type, or to give him any invalid combinations.






Title: Re:ammo crates
Post by: Messiah on 20 Jul 2004, 10:31:23
and make sure its magazines before weapons so it is auto loaded at the start...