Forum Jump :

Author Message

Posts: 59

Level: Member

Country: ca
Location: Quebec
In-game name:

#182421 Posted at 2015-09-02 11:41        
The previous example did not seem to work apparently... this one might...requires testing in-game.

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

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

_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;
_magazineClass  = currentMagazine _Unit;

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;
_Unit addMagazine _magazineClass;
sleep 1;
reload _Unit;


Tags: Ai, Range