Jump to content
Sign in to follow this  
Schwab

Attaching a Trigger to a Vehicle

Recommended Posts

I want to create a trigger which detects vehicles.

So far no problem. I do that with

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_mytrigger = createTrigger["EmptyDetector", position _vehicle];

_mytrigger setTriggerArea [2, 2, 0, false];

_mytrigger setTriggeractivation["VEHICLE","PRESENT",true];

But now i want to attach this trigger to an other vehicle, which should not be detected by this trigger itself.

Usually i would do that with

_mytrigger triggerAttachVehicle [_vehicle];

but in my case the trigger gets active then with the vehicle its attached to and does not deactivate after that, even if i resize it to zero.

Is there any way to do so ? Would prefer a way where i don't have to change the trigger in size or position.

I tried the following now:

I added to the Triggerstatement:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

mytrigger setTriggerstatements["count (nearestObjects [mytrigger , [""LandVehicle""], 5])>1",_triggerstring,""];

So this should only return true when 2 Landvehicles (including the 1 the trigger is attached to) are in the trigger.

But when i debug count thislist of the trigger still returns 1. Why ?

Ah and i had to make mytrigger global to make the nearestobjects work. I dont want to do that so i still searching for other solutions wink_o.gif

Obviously a solution with Triggers is quiet useless and i'll use

_notrigger = [_vehicle] execVM "script.sqf";

with a loop in the script instead.

Thanks for reading, i think i found the solution myself again wink_o.gif

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  

×