Jump to content
gruukh

Trigger condition to detect if an item is placed in an area

Recommended Posts

I'm trying to work out how to get a trigger to detect if one or more explosive charges are placed within it. The charges only need to be placed - they will be detonated later in the mission. Does anybody have any idea how I might accomplish this? I'm using the Explosive Charge.

EDIT: I've looked into using eventhandlers instead. I have this in the init line of a vehicle:

 this addEventHandler ["FiredNear", {_this execVM "charge1.sqf"}]

and this is the contents of charge1.sqf:

//this addEventHandler ["firednear",{_this execvm "satchel.sqf"}] 
_unitfirednear = _this select 0;
_ammo = _this select 4;

_valid = ["DemoCharge_Remote_Mag"];

if (!(_ammo in _valid)) then {
hint "1 charge placed";
};
}

This works insofar as it displays the hint. However, i want to limit the distance to 2m between firer and target. I tried adding:

_distance = _this select 2;

and also updating the hint condition to read:

if (!(_ammo in _valid)) AND (!(_distance == 2)) then {
hint "1 charge placed";
};

but all that did was break the script...anybody with more scripting talent than me able to help?

Edited by gruukh
  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, theopolus said:

bump...

This has to be the most impressive necro on this forum that I've ever seen...

5 years...

 

7ZTR5Yq.gif

 

Cheers

  • Like 1
  • Haha 1

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

×