OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: John on 17 Jul 2006, 22:22:09

Title: how can i add ammo to crates?.....
Post by: John on 17 Jul 2006, 22:22:09
I think I have to remove all the other wapons first dont I?...and how do I do that?
Title: Re: how can i add ammo to crates?.....
Post by: Wolfrug on 17 Jul 2006, 22:41:46
Hardly necessary :)

Adding ammo/weapons to crates or vehicles :

addweaponcargo

and for magazines

addmagazinecargo

Format is :

<unit> addweaponcargo  ["Weapon", #]

So, for instance

AmmoCrate addweaponCargo ["AK74", 5]; AmmoCrate addmagazinecargo ["AK74", 30]

Shadam. For full list of official weapon/magazine names, refer to the http://www.ofpec.com/COMREF/weapons.html list found there. :)

Good luck!

/Wolfrug out.
Title: Re: how can i add ammo to crates?.....
Post by: John on 17 Jul 2006, 22:47:07
not working.....i add what you say and then get near to the ammo crate....and it only says take m16 and take hand grenade....and not what I have added....dont you have to remove what it has to begin with
Title: Re: how can i add ammo to crates?.....
Post by: Cheetah on 17 Jul 2006, 22:52:08
You don't have to remove what's already in the crate, I think that something went wrong and only the default M16 is present.

If you wish to clear the crate, type in its init:
Code: [Select]
removeAllWeapons this; clearMagazineCargo this;
To add an AK74 type:
Code: [Select]
this addweaponCargo ["AK74",1]; this addmagazinecargo ["AK74",1]
Hope that this works.
Title: Re: how can i add ammo to crates?.....
Post by: SniperAndy on 19 Jul 2006, 02:00:14
but this script in oyur mission folder and adjust it do your needs.
in the init line of your crate you put:
[this] exec ammo1.sqs

Quote
; *****************************************************
; ammo2: Loadout for AssaultTeam
; Contains Magazines from :
; CORE
; *****************************************************
; EXAMPLE:
; Type this code into the INITIALIZATION box of the crate.
; [this] Exec "ammo1.sqs"
; *****************************************************

clearmagazinecargo _this;
clearweaponcargo _this;

; Get the parameters given
_crate = _this Select 0

_crate AddWeaponCargo ["Steyr", 5]
_crate AddWeaponCargo ["M4ReflexSD", 5]
_crate AddWeaponCargo ["M4A1Acog", 5]
_crate AddWeaponCargo ["MK46", 5]
_crate AddWeaponCargo ["RPGLauncher", 5]
_crate AddWeaponCargo ["AALauncher", 5]


_crate AddMagazineCargo ["SteyrMag", 10]
_crate AddMagazineCargo ["M4ReflexSDMag", 10]
_crate AddMagazineCargo ["M4A1SilencedMag", 30]
_crate AddMagazineCargo ["M4A1Mag", 20]
_crate AddMagazineCargo ["MK46Mag", 20]
_crate AddMagazineCargo ["GrenadeLauncher", 30]
_crate AddMagazineCargo ["RPGLauncher", 20]
_crate AddMagazineCargo ["AALauncher", 10]
_crate AddMagazineCargo ["PipeBomb", 20]
_crate AddMagazineCargo ["Mine", 20]
EXIT
Title: Re: how can i add ammo to crates?.....
Post by: Martin Kuka on 10 Aug 2006, 19:22:29
Think this version of your script is quicker...

; *****************************************************
; ammo2: Loadout for AssaultTeam
; Contains Magazines from :
; CORE
; *****************************************************
; EXAMPLE:
; Type this code into the INITIALIZATION box of the crate.
; this Exec "ammo1.sqs"
; *****************************************************

clearmagazinecargo _this;
clearweaponcargo _this;

; Get the parameters given


_This AddWeaponCargo ["Steyr", 5]
_This  AddWeaponCargo ["M4ReflexSD", 5]
_This  AddWeaponCargo ["M4A1Acog", 5]
_This  AddWeaponCargo ["MK46", 5]
_This  AddWeaponCargo ["RPGLauncher", 5]
_This  AddWeaponCargo ["AALauncher", 5]


_This AddMagazineCargo ["SteyrMag", 10]
_This AddMagazineCargo ["M4ReflexSDMag", 10]
_This AddMagazineCargo ["M4A1SilencedMag", 30]
_This AddMagazineCargo ["M4A1Mag", 20]
_This AddMagazineCargo ["MK46Mag", 20]
_This AddMagazineCargo ["GrenadeLauncher", 30]
_This AddMagazineCargo ["RPGLauncher", 20]
_This AddMagazineCargo ["AALauncher", 10]
_This AddMagazineCargo ["PipeBomb", 20]
_This AddMagazineCargo ["Mine", 20]
EXIT

As this version doesnt need the initial array line.
Title: Re: how can i add ammo to crates?.....
Post by: PetriHonka on 12 Aug 2006, 16:08:59
you could just put in the init. field of the crate : this addWeaponCargo "WEAPONNAME , #"; this addMagazineCargo "MAGAZINENAME, #" this will put the specified weapons in the crate alongside the default loadout. The remove weapon script can go before the addweapon part t orem,ove default weapons. If you are adding satchel charges the weapon name is pipebomb.
Title: Re: how can i add ammo to crates?.....
Post by: dmakatra on 12 Aug 2006, 17:51:41
If you wish to clear the crate, type in its init:
Code: [Select]
removeAllWeapons this; clearMagazineCargo this;
clearWeaponsCargo this, not removeAllWeapons this. :)

I'd use the init line as I reckon a script is a bit of an overkill. Just post what you wrote in the init line and we'll sort it out for you. :)