Jump to content
Sign in to follow this  
MatthewK

[REQUEST] M2 Machine Gunner in missions

Recommended Posts

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 ;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...