Nicolai 10 Posted February 21, 2010 ok please help me out guys... I would just like to have a trigger that activates every 60 seconds.. I have tried everything, maybe I'm just stupid but please.. help me out :( Thanks in advance... Nicolai Share this post Link to post Share on other sites
imutep 0 Posted February 21, 2010 Quick answer. Use more than 1 trigger. 1st 60sec, 2nd 120 sec, 3rd 180 sec, and so on. Or you try a script for this. Share this post Link to post Share on other sites
dmarkwick 259 Posted February 21, 2010 (edited) I seem to remember that triggers by default check their own status once per second. That sounds a little low to me, so that's probably not true, but let's say it is (it's bound to be some value). I think that instead of directly using a trigger, that maybe you should loop a script that checks the status of a trigger each 60 seconds, and controls the activity from there. So you have your trigger set up, named, and you have a script that does (something like): while {true} do { if (triggerName) then { ...code... }; sleep 60; }; Edited February 21, 2010 by DMarkwick Share this post Link to post Share on other sites
Nicolai 10 Posted February 21, 2010 (edited) I will try this DMarkwick, thanks Question: The script should be executed by something, the trigger itself? Edited February 21, 2010 by Nicolai Share this post Link to post Share on other sites
dmarkwick 259 Posted February 21, 2010 Question: The script should be executed by something, the trigger itself? It can be activated by anything, place the exeVM call into any object's init field, or place the call in the mission's init.sqf file. If the mission doesn't have one, make one :) Share this post Link to post Share on other sites
f2k sel 145 Posted February 22, 2010 (edited) If you don't want to script a trigger then an easy way is as follows. In the init box of a game logic or unit setup up a variable ie var1=true Then set your trigger conditions, anyone present not present ect and set all timers to 60 and make sure you select repeating Then put the following code in the correct boxes Cond this and var1 On Act var1=false On Dea var1=true Con can also be just var1 if you don't need all the triggers settings. Edited June 4, 2010 by F2k Sel Share this post Link to post Share on other sites
Nicolai 10 Posted February 22, 2010 that is simply brilliant, can't understand why I can't come up with something simple like that. Thanks all for your help Nicolai Share this post Link to post Share on other sites
Bon 12 Posted February 22, 2010 condition: time % 60 == 0 Share this post Link to post Share on other sites
Nicolai 10 Posted February 22, 2010 can a trigger only be activated for a couple of times? It works perfectly, for about 6 times, after then, the trigger is no longer activated. Suggestions? Thanks Nicolai Share this post Link to post Share on other sites
shuko 45 Posted February 22, 2010 Do tell us how you've set up the trigger. Share this post Link to post Share on other sites
Nicolai 10 Posted February 22, 2010 ok I have a unit "unit1" and a popup target "target1" which has allowDamage = false. In the init line of unit1 I have: unit1 dofire target1 I have a game logic with var1=true in its init line. I have a trigger with blufor present, repeatedly, timeout, 60,60,60 cond: this and var1 OnAct: removeAllWeapons unit1; unit1 addWeapon "M16A4"; unit1 addMagazine "30Rnd_556x45_Stanag"; unit1 addMagazine "30Rnd_556x45_Stanag"; unit1 addMagazine "30Rnd_556x45_Stanag"; var1=false note the var1=false in the end OnDea: var1=true unit 1 is located inside the trigger area I'm trying to make the unit shoot the target once in a minute, therefore I (think) I have made a trigger that gives the unit the apropriate ammo every 60 seconds and tells it to fire at the target. This works, but only for about 5 or 6 times thanks in advance, Nicolai Share this post Link to post Share on other sites
galzohar 28 Posted February 22, 2010 If you want something specific to happen once a minute you really should just use a looping script that has a sleep 60; line in it. The script should be executed from wherever you like it to be executed - if you want it to happen all the time execute it from init.sqf. Then you can also add whatever condition you like, for example: shoot.sqf shouldIshoot=false; while {true} do { sleep 60; if (shouldIshoot) then { // do whatever }; }; Then whenever you set the shouldIshoot variable to true the script will fire every 60 seconds, and when it is false it will not fire. If you want the script to shoot as soon as the condition is true, though, you can do: shouldIshoot=false; while {true} do { waitUntil {shouldIshoot}; // do whatever sleep 60; }; And there are a million other options to do this depending on what you actually want to do. Just make sure in the init.sqf you have a line execVM shoot.sqf; Share this post Link to post Share on other sites
f2k sel 145 Posted February 22, 2010 (edited) I've actually just tested it and it works fine here. The odd thing is that if I then make that unit a player it gets no ammo added. Edited February 22, 2010 by F2k Sel Share this post Link to post Share on other sites
Nicolai 10 Posted February 22, 2010 (edited) does a script like that auto loop? or do you have to put a loop command behind the code? btw thanks everyone for being so helpful! Nicolai edit: I found out it auto loops, it all works like a dream now, thanks a million everyone! Edited February 22, 2010 by Nicolai Share this post Link to post Share on other sites
dmarkwick 259 Posted February 22, 2010 does a script like that auto loop? or do you have to put a loop command behind the code?btw thanks everyone for being so helpful! Nicolai Yes it does, because the conditional "while {true} do" is testing the status of "true" which is a BIS reserved value meaning true. So as long as true is true, the code within the curly brackets will execute, which is why you should always put a sleep in there somewhere or you could bog down the game with a minor bug :D Share this post Link to post Share on other sites
Nicolai 10 Posted February 23, 2010 lol ok thanks guys :P Share this post Link to post Share on other sites