Jump to content

[REQUEST] M2 Machine Gunner in missions


MatthewK

Recommended Posts

  • 3 months later...

My scripting is bad, so I don't create new function just add this code to the mission file:

 

_staticGun = createVehicle ["M2StaticMG",[(_coords select 0) - 8.8681, (_coords select 1) + 15.3554,0],[], 0, "NONE"];
_staticGun setDir round(random 360);
[_staticGun] call DZMSProtectObj;
 
_staticGun setHit ["motor", 1];
_staticGun setVariable ["R3F_LOG_disabled",true,true];
_staticGun setVariable ["BTC_Cannot_Lift",true,true];
_staticGun removeAllEventHandlers "Killed";
_staticGun removeAllEventHandlers "HandleDamage";
_staticGun setVehicleLock "LOCKED";
_staticGun removeAllEventHandlers "GetIn";
_staticGun addEventHandler ["GetIn",{
if (isPlayer (_this select 2)) then {
(_this select 2) action ["getOut",(_this select 0)]; 
(_this select 0) setVehicleLock "LOCKED";
(_this select 0) removeAllEventHandlers "GetIn";
};
}];
 
_aiGrp = createGroup east;
 
 
_pilot = _aiGrp createUnit ["BanditW1_DZ",getPos _staticGun,[],0,"FORM"];
 
 
[_pilot] joinSilent _aiGrp;
 
_pilot moveInGunner _staticGun;
_pilot assignAsGunner _staticGun;
 
_pilot enableAI "TARGET";
_pilot enableAI "AUTOTARGET";
_pilot enableAI "MOVE";
_pilot enableAI "ANIM";
_pilot enableAI "FSM";
_pilot setCombatMode "YELLOW";
_pilot setBehaviour "COMBAT";
 
_pilot addWeapon 'NVGoggles';
_pilot addWeapon 'ItemCompass';
_pilot addWeapon 'ItemRadio';
_pilot addWeapon 'ItemMap';
_pilot addWeapon 'ItemGPS';

 

 

Just starting writing scripts to the Arma 2, so this code can be bad but it works ;)

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...