Jump to content
Sign in to follow this  
faire

How to add weapon to vehicle cargo

Recommended Posts

Hello, a quick noobish question: I need to add a Rook pistol into cargo of an empty vehicle. I have used this script: this addweaponcargo hgun_Rook40_F; Why doesn't it work? Is there any way to remove automaticly spawned items from the vehicle? Thanks for answers!

Share this post


Link to post
Share on other sites

Class names are strings, so need to be surrounded by quotes. Also use Global so people see it.

clearWeaponCargoGlobal this; clearMagazineCargoGlobal this; this addWeaponCargoGlobal "hgun_Rook40_F";

That'll remove all weapons and ammo from the vehicle and add the Rook.

Share this post


Link to post
Share on other sites

I'd also use this:

this addMagazineCargoGlobal ["16Rnd_9x21_mag", 5];

in addition to what kylania posted, replace 5 with the appropriate number of magazines.

Share this post


Link to post
Share on other sites

The quotation marks are needed since classnames are strings, whereas I used the brackets and comma to specify quantity. (It seems to need them even if you're only placing a single one.) If you feel like adding a pair of 9 mm pistol suppressors to the crate as well, use this:

this addItemCargoGlobal ["muzzle_snds_l", 2];

Note that if there's a "weapon+attachment combo" classname -- check classlists such as this (change version to the most recent) to see which if any exist for the intended weapon -- you can add that to a unit or an ammo box/vehicle cargo and the weapon will be equipped with said attachment(s). For example, to add a pair of suppressed P07s instead of separate pistols and sound suppressors:

this addWeaponCargoGlobal ["hgun_p07_snds_f", 2];

Note that you can use addMagazines and addWeapon when equipping a unit with weapons and ammo (magazines go first so that the weapon will be automatically loaded with one of them, so enter the total number of magazines) but for adding attachments you would use addPrimaryWeaponItem or addHandgunItem. (If you used a "weapon+attachments combo" classname, then these commands will override whatever attachment was in the corresponding slot from the combo classname.)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×