avibird 1 155 Posted September 28, 2014 I have been away from the editor for a awhile lol. How can I set a trigger to allow it to repeat only when a blufor unit is out of the trigger area for a set time like 15 minutes (900 seconds) can this be done via editor trigger or did I need a script. Share this post Link to post Share on other sites
avibird 1 155 Posted September 30, 2014 (edited) OK found a few somewhat solution for my issues but not exactly what I want. I am working on a side mission mission pack. I am using scripts like SLP_spawn ...created by Nomadd that uses triggers that populate the mission AO with patrols and grassion units. I want these mission to be replayable after a set time period during the gameplay. Right now the trigger is set to repeat. At Any time if there are no blue for units left in the AO. The initial trigger will fire and spawn new units as well as the old ones still in the AO. If this happens a few times lol well the area will be very crowded unrealistic and may cause some lag for the players. One solution would be to put a countdown command in the trigger itself for example 1500 seconds ie 25 minutes. this would give the player group a good amount of time to complete the mission against the correct number of defensive forces in the AO by design. However lets say that all members of the group were killed all together twice during this side mission. The trigger will fire after the countdown is complete, regardless of whether the triggering units is present or not. So the next time you go to do this side mission the AO will start out overall populate and if you do this for a few other side missions the overall mission (MULTIPLE SIDE MISSIONS) could get very laggy. I attempted to add some code to the trigger and my SQF. in the trigger condition this && sidemission1 now at the top of my SQF sidemission1 = false and at the bottom of the SQF sleep 1500; sidemission1 = true LOL but this does the same thing as the countdown command in the trigger on the map ): What I want is a way to not allow the AO trigger to fire again for 1800 seconds ie 30 minutes only if no blue units are in the area trigger (AO of side mission 1). Is there a way to switch the countdown to a timeout if there are no blufor units in the AO. Any input or direction would be great. This side mission pack may have to be a one time use of each mission ): Edited September 30, 2014 by AVIBIRD 1 Share this post Link to post Share on other sites
iceman77 19 Posted October 1, 2014 AVIBIRD 1 said: . . . What I want is a way to not allow the AO trigger to fire again for 1800 seconds ie 30 minutes only if no blue units are in the area trigger . . . May be better ways. Anyhow... init.sqf [] spawn { if (isServer) then { missionAvail = true; while {true} do { sleep 1; waituntil {!missionAvail}; sleep 60 * 30; missionAvail = true; }; }; }; Trigger Condition (blufor present >> repeatedly): this && isServer && missionAvail Trigger Activation: your SLP_spawn... function or w/e Trigger De-Activation: missionAvail = false; Share this post Link to post Share on other sites
avibird 1 155 Posted October 1, 2014 @ICEMAN77 you are awesome!!! It works with your code. I need to test a bit more including MP mode however your code sleep 60 * 30; I am a little confused? sleep 60 makes the code sleep for 60 seconds if blufor not inside the trigger area. If I change it to 300 it will get recalled after 5 minutes and 600 for 10 minutes ect... what is the * 30 for in the codeline. LOL I should not care because the script works the way I want it to but I still want to understand why it does (: I am still a noob with scripting after all these years but I am a hard working trying to better my knowledge. I definitely have a few more questions and need some more help from you brother. Thank you for the help. Avibird Share this post Link to post Share on other sites
jshock 513 Posted October 1, 2014 It's saying 60 times 30, for a total of 1800 seconds. Just a simple math function :p. Share this post Link to post Share on other sites
avibird 1 155 Posted October 2, 2014 (: While it does not work like that in the example!!! that is why I asked lol the 60 = 60 seconds and if I put 120 it will be 2 minutes and if I put 300 it will be 5 minutes ect... The trigger works fine for now I need to test more but the I have no clue what the * 30 is doing in the code. Avibird. Share this post Link to post Share on other sites
iceman77 19 Posted October 2, 2014 It's just multiplication. sleep 60 * 30; // sleep 30 minutes (1800sec) sleep 60 * 20; // sleep 20 minutes (1200sec) sleep 60 * 10; // sleep 10 minutes (600sec) Is the same as: sleep 1800; sleep 1200; sleep 600; Share this post Link to post Share on other sites
avibird 1 155 Posted October 2, 2014 Guys I know this but when I use your code sleep 60 * 30; this gives me a recall of the script if no Blufor units are in the trigger area for only 60 seconds and if I use your code like this sleep 1500 * 30; this gives me a recall of the script if no blufor units are in the trigger area for 25 minutes. I understand it is simple math lol but it does not add up in game time lol. My script works the way I need it to thank you but I don't know why it works the math does not add up (: Share this post Link to post Share on other sites
dreadedentity 278 Posted October 2, 2014 (edited) AVIBIRD 1 said: but I don't know why it works the math does not add up (: sleep (60 * 30); Iceman77 said: It's just multiplication. sleep 60 * 30; // sleep 30 minutes (1800sec) sleep 60 * 20; // sleep 20 minutes (1200sec) sleep 60 * 10; // sleep 10 minutes (600sec) Is the same as: sleep 1800; sleep 1200; sleep 600; It's not the same thing and AVIBIRD is confirming it. There are some weird things the engine does, one of them is breaking to a new line anytime a semicolon is encountered (even enclosed in quotation marks). That's exactly the reason why you have to copy the output for the base-building-helper script I just posted and replace all the colons with semicolons then copy it back into your script before you can use it. I'm guessing another engine quirk is after encountering an acceptable parameter for a command, everything after it is ignored. In my simple patrol script (which I'm seriously going to rewrite one day), I found this out the hard way, it's one of the reasons my code has a ton of parenthesis (also, I guess I really am old-school). My philosophy for coding is the same as my philosophy for safe sex, "when in doubt, wrap your shit up" Edited October 2, 2014 by DreadedEntity Share this post Link to post Share on other sites
iceman77 19 Posted October 2, 2014 Hmm. Well using multiplication with sleep used to work fine / accurate. It worked fine with LVR anyhow. I suppose the script is broken now? @AVBird - Just use sleep 1800 then :) /shrugs Share this post Link to post Share on other sites
dreadedentity 278 Posted October 2, 2014 Iceman77 said: It worked fine with LVR anyhow. I suppose the script is broken now? Just throw some parenthesis in there to be safe, should be an easy fix. Awesome script, btw, just reading it early on helped me really understand a few things that I thought I did, but really didn't. Other than a very short excursion with UnityEngine, this is the first time I've ever worked in an environment where you can have multiple processes going on simultaneously. Share this post Link to post Share on other sites
avibird 1 155 Posted November 9, 2014 (edited) Iceman77 said: May be better ways. Anyhow...init.sqf [] spawn { if (isServer) then { missionAvail = true; while {true} do { sleep 1; waituntil {!missionAvail}; sleep 60 * 30; missionAvail = true; }; }; }; Trigger Condition (blufor present >> repeatedly): this && isServer && missionAvail Trigger Activation: your SLP_spawn... function or w/e Trigger De-Activation: missionAvail = false; This code worked fine that iceman77 gave me but after the last DLC update it does not work anymore! Very lost on why or what to replace it with to make the triggers work. Edited November 10, 2014 by AVIBIRD 1 Share this post Link to post Share on other sites
avibird 1 155 Posted November 10, 2014 It appears the Bohemia Arma ghosts have getting into my PC again and messed up my mission init.sqf or my description.ext lol (: I don't know how but there was an issue either in my init or description. I have no clue where what or why. I just made new ones and all the mission triggers work again. Sorry for my rant but it is very frustrating when everything works fine one day and then the next day your project/mission is broke and you have no clue why!!!!! Share this post Link to post Share on other sites
dreadedentity 278 Posted November 10, 2014 welcome to modding/content creation Share this post Link to post Share on other sites