Zlin Posted May 29, 2013 Posted May 29, 2013 Can anyone tell me if all of the triggers that are available in the mission editor are able to be called from a lua script or expression? I'm specifically interested in the Time Since Flag trigger. Is there a way to call that trigger from a lua script?
IADC Posted May 29, 2013 Posted May 29, 2013 Can anyone tell me if all of the triggers that are available in the mission editor are able to be called from a lua script or expression? I'm specifically interested in the Time Since Flag trigger. Is there a way to call that trigger from a lua script? I dont know but I like the way you think....
Grimes Posted May 29, 2013 Posted May 29, 2013 Yes most of the trigger conditions can be recreated with lua. Time since flag is a little tricky though, and generally it would probably best to use only lua to accomplish the same sort of thing. local whatever = timer.getTime() Once> if whatever then if timer.getTime() > whatever + timeSinceFlag then return true end end> DO Action The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Zlin Posted May 29, 2013 Author Posted May 29, 2013 Thank you for your replies. Maybe I'm trying to do something the hard way. I want an event to occurr at a random time between 20 and 120 seconds after either the mission starts or if possible, after a flag is set. I tried to set a flag to a random number between 20 and 120 and then tried to use the .getAbsTime() function and compare that time to the value of my flag. I must not be understanding the getAbsTime() function though as it gave me a number like 4905.2 when the elapsed mission time was only 24 seconds. Any thoughts? In my scenario, I want to have a hmmwv on patrol (follow waypoints) and at a random time from say 20 to 120 seconds, I want that unit to explode. This way, the unit will explode at a random time (hence a random location). This is to create variety in a medevac type mission.
Grimes Posted May 29, 2013 Posted May 29, 2013 You can do that very easily with triggers: Once> Whatever>Set Flag 1 Random Value 0 to 100 AND Flag 1 increase 20 (this will set the flag value between 0 and 100 and then add 20 to that value, hence 20 to 120. Switched Condition> Time SInce Flag 1 is 1 second> Flag 1 decrease 1 Once> Flag 1 = 1> Explode Unit The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts