Forum Jump :

Author Message


Posts: 59
Rank:


Level: Member

Country: ca
Location: Quebec
Occupation:
Age:
In-game name:

 
#182333 Posted at 2015-08-29 18:26        
     
Try this...

// CALL USING: nul = [unit_Name, _target_Name] execVM "fireRange.sqf";

private ["_Unit","_Target","_Group","_Magazine","_Primary","_CurrentWeapon","_WeaponMode","_Ammo"];

_Unit	= _this select 0;
_Target	= _this select 1;

while {true} do {

_Group = group _Unit;
_Magazine = primaryWeaponMagazine _Unit;
_PrimaryWeapon	= primaryWeapon _Unit;
_CurrentWeapon	= currentWeapon _Unit;
	
if 	(_CurrentWeapon != _PrimaryWeapon)
then 	{_Unit selectWeapon _PrimaryWeapon};

sleep 1;

_WeaponMode	= currentWeaponMode _Unit;
_Ammo 		= _Unit ammo _PrimaryWeapon;

doStop _Unit;
_Group 	reveal 	_Target;
_Unit 	doTarget _Target;
_Unit 	doWatch _Target;
_Unit 	setBehaviour "COMBAT";
_Unit 	setCombatMode "YELLOW";
_Unit 	setUnitPos "MIDDLE";

if (_Ammo == 0 ) then {reload _Unit;};

sleep 1;

_Unit 	disableAI "TARGET";
_Unit 	disableAI "AUTOTARGET";

for [{_i = _Ammo},{_i > 0},{_i =_i-1}] do
{
	_Unit forceWeaponFire [_PrimaryWeapon, _WeaponMode];
	sleep (0.01+(random 1));
};

sleep 1;

reload _Unit;

};






Tags: Ai, Range