Jump to content
Sign in to follow this  
IndeedPete

Equipment Script Problem

Recommended Posts

Hi folks, i just wrote a little script to equip a few units but i don't get any guns nor an error.

Here's the script:

_reaper = _this select 0;
_magazineCount = round(random 5);

if (_reaper == hunter) then {
_ammo = "5x_22_LR_17_HMR";
_weapon = "huntingrifle";
} else {
_ammo = "8Rnd_9x18_Makarov";
_weapon = "makarov";
};

private ["_ammo","_weapon"];

removeAllWeapons _reaper;
for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
_reaper addWeapon _weapon;
_reaper selectWeapon _weapon;

if (_reaper == hunter) then {
while {alive _reaper} do {
	if (!someAmmo _reaper) then {
		for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
	};
	sleep 1;
};
};

"hunter" is the name of the guy who should get the huntingrifle.

Edited by IndeedPete

Share this post


Link to post
Share on other sites

_ammo and _weapon have to be initialized before the if..

_reaper = _this select 0;
_magazineCount = round(random 5);
private ["_ammo","_weapon"];
if (_reaper == hunter) then {
_ammo = "5x_22_LR_17_HMR";
_weapon = "huntingrifle";
} else {
_ammo = "8Rnd_9x18_Makarov";
_weapon = "makarov";
};



removeAllWeapons _reaper;
for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
_reaper addWeapon _weapon;
_reaper selectWeapon _weapon;

if (_reaper == hunter) then {
while {alive _reaper} do {
	if (!someAmmo _reaper) then {
		for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
		sleep 1;
	};
};
};

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  

×