Koni 1 Posted March 12, 2012 How do I set a trigger to activate if a certain unit HAS NOT entered within a certain amount of time. Basically I need it to end the mission if the player who's flying a plane does not get into a triggers area by a certain amount of time. Thanks Share this post Link to post Share on other sites
twirly 11 Posted March 13, 2012 Not sure how you would actually activate the trigger on NOT PRESENT from code.... but you can check the triggers list over time and if the unit hasn't turned up in the list run some other script. A bit long winded but is all I could come up with. init.sqf //initialize a global variable for the trigger list MyTriggerList = []; Trigger set to ANYBODY or whatever you need. In the triggers OnAct :- MyTriggerList = thislist; Execute this script to start the timer (30 seconds) and keep checking for the unit (ws1) in the triggers list script.sqf:- //init timer _timeout = [b]30[/b]; _time = time; _inlist = false; //if dude not in trigger keep looping until timeout or dude is in trigger while {(time < _time + _timeout) && (!_inlist)} do { if ([b]ws1[/b] in MyTriggerList) then { hint "Unit IS in list"; _inlist = true; } else { hint "Unit NOT in List"; }; }; //if _inlist is still false after the timeout.... then the guy wasn't in the trigger in time. This is not tested and may still need a global variable stuck in somewhere to disable the trigger totally until you run the script. Share this post Link to post Share on other sites
AZCoder 676 Posted March 13, 2012 You could also create an area trigger, group it to the player, make it "not present", and in the condition "this && (time > 50)" where 50 is the # of seconds the player has to get into the trigger area. Of course since time is the number of seconds since mission start, and I just pulled 50 out of the air, you could replace 50 with a variable based on whatever other conditions you may want. For example, maybe the player has 2 minutes from getting into the plane to take off and reach the trigger, then you could set a variable "TimeLimit = (time + 120)" once the player is in the aircraft. Anyhoo, just trying to throw more ideas out for ya. Share this post Link to post Share on other sites
galzohar 28 Posted March 13, 2012 Just place a "present" trigger that will activate when the player is in it. Not sure if you need to set it to "repeating", so do that just in case. Name the trigger trgEndLocation or something. Name the player unit pilot1 or something. Then execute this script at mission start: waitUntil {!isNil "missionEndTime"}; waitUntil {time>missionEndTime}; if (!(pilot1 in (list trgEndLocation))) then { // Do whatever you do to end the mission }; And the mission will end as soon as enough time has passed. When done this way, you can define the missionEndTime variable whenever you want, and the mission will end at the same time as long as you define it before too much time passes... If you set it during the mission to current time plus whatever, you can use missionEndTime = time + 120; for example to set the time limit to 120 seconds since this command is executed. Share this post Link to post Share on other sites
Koni 1 Posted March 13, 2012 Thanks to you all, I've got the desired effect working :) I used AZCoders method along with a speed detector trigger and got what I needed. Share this post Link to post Share on other sites