Jump to content
Sign in to follow this  
1para{god-father}

Only allow West to shoot VIP

Recommended Posts

I need away to make only Bluefor be able to shoot my pilot ( it would be by mistake ), as i do not want any Playable EAST to shoot him as it is mission over if they do so need a way to stop it.


_grp = createGroup WEST;
_pilot = _grp createUnit ["US_Soldier_Pilot_EP1", _pos, [], 0, "FORM"];
_pilot setCaptive true;
_pilot setHit ["hands",1];
_pilot setHit ["head_hit",0.4];
_pilot setHit ["body",0.5];
_pilot playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
_pilot disableAI "MOVE";
_pilot disableAI "ANIM";
_pilot setVehicleInit "this addaction ['Capture', 'scripts\capture.sqf', [],1,false,true,'','((side _this) == west)']";
processInitCommands;


removeAllWeapons _pilot;

Share this post


Link to post
Share on other sites

_pilot addeventhandler ["HandleDamage",{[_this] execVM "pilotDamage.sqf";}];

"pilotDamage.sqf"

_damage = _this select 2;
_source =_this select 3;

_returnDamage = 0;

if ((side _source) == west) then 
{
  _returnDamage = _damage;
};

_returnDamage

maybe something like this? not tested

http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#HandleDamage

Edited by Lifted86

Share this post


Link to post
Share on other sites

Thanks ,

After thinking about it i thought it would be unfair as they could just shoot the building where he is and not kill him , which would not be fair so i need a distance check really.

Can I reference him like "_pilot allowDamage true" in a trigger or would i not be able to reference him as a\ variable i.e _pilot ?

_triggeram1 = createTrigger["EmptyDetector",[getPos _pilot select 0,getPos _pilot select 1,0]];
_triggeram1 setTriggerArea [200,200,0,false];
_triggeram1 setTriggerActivation ["WEST","PRESENT",false];
_triggeram1 setTriggerTimeout [1,1,1,true];
_triggeram1 setTriggerStatements ["this", "_pilot allowDamage true;",""];

Share this post


Link to post
Share on other sites

As long as _pilot is still defined where you put the code, you should be right.

You could also put a distance check in the eventHandler

_unit = _this select 0;   // your pilot
_damage = _this select 2;
_source =_this select 3;  //unit doing the damage

_returnDamage = 0;

if ((side _source) == west && (_source distance _unit) < 200 ) then 
{
  _returnDamage = _damage;
};

_returnDamage

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  

×