Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Taylor1984

Add magazine regardless of weapon

Recommended Posts

Hi

 

Is there a script you can make to add magazines to a unit's weapon regardless of which weapon it is? I would like to use the script on numerous units to give them more ammo. I've tried setVehicleAmmo 1 but I guess that's for vehicles.

 

Thanks

Share this post


Link to post
Share on other sites
15 minutes ago, Taylor1984 said:

Hi

 

Is there a script you can make to add magazines to a unit's weapon regardless of which weapon it is? I would like to use the script on numerous units to give them more ammo. I've tried setVehicleAmmo 1 but I guess that's for vehicles.

 

Thanks

 

_addWeapon = [player,currentWeapon player,1] call BIS_fnc_addWeapon;//add 1 magazine for the current weapon to the player

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, Grumpy Old Man said:

 


_addWeapon = [player,currentWeapon player,1] call BIS_fnc_addWeapon;//add 1 magazine for the current weapon to the player

Cheers

Worked like a charm.

 

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

#edit: I have to correct all I have written in this post.

I did not know that BIS_fnc_addWeapon does not replace the currentWeapon with a weapon of the same classname (and thus reverting all changes to primaryWeaponItems made before that).

  • Like 1

Share this post


Link to post
Share on other sites

You can also do something like:

_weapMagTypes = getArray (configFile >> "CfgWeapons" >> "arifle_MX_F" >> "magazines");
player addMagazine (_weapMagTypes select 0);

 

  • Like 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×