Jump to content
Sign in to follow this  
Wakey

Check primary weapon and add ammo?

Recommended Posts

So I'm trying to make my very first script. A simple random loadout for the baddies.

[private "_enemy","_rifle","_rifles","_scope","_scopes","_muzzle","_muzzles","_rnd","_rnd2","_rnd3","_i"];

_enemy = _this select 0;

//Weapon list
_rifles = ["arifle_Khaybar_C_F","arifle_Khaybar_F","arifle_Khaybar_GL_F"];

//Scope list
_scopes = ["optic_ACO_grn","optic_Arco",""];

//Muzzle list
_muzzles = ["acc_flashlight",""];


_rnd = floor random (count _rifles);
_rnd2 = floor random (count _scopes);
_rnd3 = floor random (count _muzzles);

_rifle = _rifles select _rnd;
_scope = _scopes select _rnd2;
_muzzle = _muzzles select _rnd3;


removeAllWeapons _enemy;


_enemy addWeapon _rifle;
_enemy addPrimaryWeaponItem _scope;
_enemy addPrimaryWeaponItem _muzzle;
_enemy addItem "FirstAidKit";
_enemy unassignItem "NVGoggles";
_enemy removeItem "NVGoggles";


_enemy selectweapon _rifle;

How would I go about adding the matching ammo?

Now... All the possible weapons use the same kind of ammo. So that wouldn't really be a problem to add. But I'd like to put "1Rnd_HE_Grenade_shell" in there somewhere IF it chooses to give the enemy a weapon with a grenade launcher attached.

I've tried things like (And all kinds of variants of it):

if primaryweapon = arifle_Khaybar_GL_F then {_enemy addMagazine "1Rnd_HE_Grenade_shell";} else { };

Which does nothing.

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  

×