jhonny912 Posted June 18, 2014 Posted June 18, 2014 I tried to create a trigger as well: once-time less 600-activate Group, hoping that the unit would randomly in 600 seconds, it activates to start mission! What is the procedure to activate a random unit in a time frame? Thank you
Exorcet Posted June 18, 2014 Posted June 18, 2014 Your issue is not completely clear. Do you want a unit to activate at a random time, so that when it spawns in the mission changes each time? Or do you want to spawn a randomly selected unit at a set time? For the first one you either need MIST scripting or multiple time condition triggers with a random percentage. Example: Once > Time more 60 Random 10% [OR] Time more 120 Random 11% [OR] Time more 180 Random 12.5% [OR] ... Time more 600 Random 100% (you can leave this out, I just placed it to show the pattern) > Activate group For the second idea try selecting a group from a set of groups with a flag value: Once > Time more 600 > Flag 1 equals random value (X:Y) NEXT TRIGGER Once > Flag 1 equals 1 > Activate group 1 NEXT TRIGGER Once > Flag 1 equals 2 > Activate group 2 etc Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files
ENO Posted June 18, 2014 Posted June 18, 2014 in theory you can always just go- "Condition / random 1%" and every second there will be a 1% chance that it'll fire- until it fires. Disadvantage is I've found that if another condition needs to be met first (time more 20 minutes) it'll check random 1% continuously WHILE the 20 minutes is being counted down... so more often than not it'll fire at 20 minutes (because the random condition will have been met within 20 minutes)... or soon thereafter. You can also go flag based on set times- setting flag random value tends to favour first and last values as has been discussed in the mission editor's corner... There is a script I use on page 16 of the MIST thread that you can set a flag random value between 1 and 10 or whatever... and if flag x value is 1 the unit is activated on a time more 5 minutes, value 2 time more 10 minutes, value 3 15 minutes... etc. You could also do variable groups in this fashion, while leaving the group activate value random... So value of x flag is 1, then group A spawns at the random interval... "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
jhonny912 Posted June 18, 2014 Author Posted June 18, 2014 Your issue is not completely clear. Do you want a unit to activate at a random time, so that when it spawns in the mission changes each time? Or do you want to spawn a randomly selected unit at a set time? For the first one you either need MIST scripting or multiple time condition triggers with a random percentage. Example: Once > Time more 60 Random 10% [OR] Time more 120 Random 11% [OR] Time more 180 Random 12.5% [OR] ... Time more 600 Random 100% (you can leave this out, I just placed it to show the pattern) > Activate group For the second idea try selecting a group from a set of groups with a flag value: Once > Time more 600 > Flag 1 equals random value (X:Y) NEXT TRIGGER Once > Flag 1 equals 1 > Activate group 1 NEXT TRIGGER Once > Flag 1 equals 2 > Activate group 2 etc Should I use the MIST software to do both?
jhonny912 Posted June 18, 2014 Author Posted June 18, 2014 in theory you can always just go- "Condition / random 1%" and every second there will be a 1% chance that it'll fire- until it fires. Disadvantage is I've found that if another condition needs to be met first (time more 20 minutes) it'll check random 1% continuously WHILE the 20 minutes is being counted down... so more often than not it'll fire at 20 minutes (because the random condition will have been met within 20 minutes)... or soon thereafter. You can also go flag based on set times- setting flag random value tends to favour first and last values as has been discussed in the mission editor's corner... There is a script I use on page 16 of the MIST thread that you can set a flag random value between 1 and 10 or whatever... and if flag x value is 1 the unit is activated on a time more 5 minutes, value 2 time more 10 minutes, value 3 15 minutes... etc. You could also do variable groups in this fashion, while leaving the group activate value random... So value of x flag is 1, then group A spawns at the random interval... Sorry but I don't understand what are "flags", help?:helpsmilie:
ENO Posted June 18, 2014 Posted June 18, 2014 Don't worry I never did either. I'll explain but need a real keyboard. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
Exorcet Posted June 18, 2014 Posted June 18, 2014 Should I use the MIST software to do both? You don't need to use it. Here is an example mission at the X shaped airport near Kobuleti, one group will spawn west of the X at 10 or 20 or 30 seconds. Three groups on are the X itself, one at the north, one at the middle, and one at the south. Only one of those will spawn after 30 seconds. Open the mission and look at the triggers page.Example.miz Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files
jhonny912 Posted June 18, 2014 Author Posted June 18, 2014 You don't need to use it. Here is an example mission at the X shaped airport near Kobuleti, one group will spawn west of the X at 10 or 20 or 30 seconds. Three groups on are the X itself, one at the north, one at the middle, and one at the south. Only one of those will spawn after 30 seconds. Open the mission and look at the triggers page. Now I understand, thanks! :thumbup: But it is a trigger for a unit that is certainly within 5 minutes Active?
Stonehouse Posted June 18, 2014 Posted June 18, 2014 One other alternative too, you can actually have the aircraft in game but uncontrolled (they act like static aircraft in concept until controlled by the AI) until your trigger condition is met. There are pluses and minuses to this method. The units are in game so can be destroyed (which you can perhaps get around with trigger conditions by activating a different group if one is destroyed) but you avoid pauses/stutters that can happen when units spawn. Depending on the situation it can give players more immersion to see parked aircraft start up and take off rather than suddenly appear on the runway - it all depends on how you want your mission to work and look and what's appropriate for your needs. You can have a mix of both methods and you might use the uncontrolled method over spawning if the start point of the AI aircraft is in plain sight of your players. All stock DCS nothing from Mist.
galevsky06 Posted June 18, 2014 Posted June 18, 2014 (edited) I would do that this way: function setFlag(arg) trigger.action.setUserFlag(arg[1], arg[2]) end timer.scheduleFunction(setFlag, { [1] = "55", [2] = true }, timer.getTime() + math.random(600));Then, do your action (AI TASK SET groupname.start) with trigger condition Flag 55 is true in the mission editor. Edited June 18, 2014 by galevsky06
ENO Posted June 19, 2014 Posted June 19, 2014 (edited) Sorry but I don't understand what are "flags", help?:helpsmilie: This got long real fast... but if you try out the different concepts one at a time I think you can build a solid understanding of what a flag is, and what its potential can be. Okay- the easiest way to describe a flag is a point of reference upon which you can build a trigger. These can be flags 1 to 99999 (with one exception for the AI Action flags that need to be adjusted to allow full value- otherwise they can only go to 100 - unless that has been fixed?). Think of it as a place holder... You want to create a trigger that sends a message when a unit is destroyed. That's easy... since we have a "unit is destroyed" trigger condition already. But what you want more specifically in your mission is for a few minutes to pass before you send that message. How do you do that? Well- the mission already creates a marker when the unit is destroyed... but it doesn't allow you to create a point in time when that happened so you can build a trigger off of it (in the ME it doesn't but you could probably make a script for it... anyway... we'll stick to flags). So what a person can do is go into the mission editor, create a "run once" trigger with the condition of "unit destroyed" with an action of "flag on (1)" Now flag 1 is "on" or "set." Now this flag can be used as a reference... and can have triggers built around it in conditions... For example: run once / flag 1 true / message to coalition "Good work for destroying the target." The thing is- if flag 1 is set to true and the way to set flag 1 to true was to destroy the target- you could have also just used the trigger "run once / unit destroyed / message to coalition. Where the flag comes in is when you want a few minute's delay... in which case your trigger would look like: Run once / time since flag 1 (120) / message to coalition "Good work..." Remember- all times are measured in seconds! ________________________________________________________________________________________________________ STOP HERE FOR PHASE 1 So let's look into some other opportunities for flags... Flags can also be given a value... that way once a flag has reached a certain value you can set another action. Let's say I want to move 4 cargo crates into a zone using hueys... and once all 4 get moved into the zone I want to reward the pilot with some air support. Each crate delivered in a zone would increase a flag's value by one... this would look like this: Run once / unit in zone (crate unit ID) / flag increase value 1, 1 (flag 1 increased by 1) Run once / unit in zone (crate unit ID2) / flag increase value 1,1 Run once / unit in zone (crate unit ID3) / flag increase value 1,1 Run once / unit in zone (crate unit ID4) / flag increase value 1,1 Doing it that way allows you to countdown the number of crates remaining- you could also just go (unit1 in zone /unit 2 in zone etc but not have a way to easily track progress. Now you can go (flag 1 equals 1/ you have 3 crates left to move... Flag 1 equals 2, you have 2 crates left etc) Technically I think you could probably set it as a "Switched condition" and use OR functions in the condition- but that is the most straightforward way... each with their own trigger. Your last trigger for this concept would be: Run once / flag equals 1, 4 (flag 1 equals 4) / group activate (group ID of plane group you placed in the mission on late activation) __________________________________________________________________________________________________________________________________________ STOP HERE FOR PHASE 2 Let's say you want to send a message every 30 minutes that a mission is ongoing... you can increase a flag value (using flag number 10 as an example here) using a "continuous" trigger. It looks like this: Continuous / time more 10 / flag 10 increase 1 This will cause flag 10 to increase by one every second (roughly). Then because this is going to need to happen every 30 minutes and will likely happen several times- we can use "switched condition" for the next one. Switched condition / flag 10 equals 1800 (30 minutes) / Message to coalition "30 minutes has passed." (AND) Set Flag value 10, 1 (resets the flag to 1 and allows the count to begin again.) Flag 10 will then start from a value of 1 and increase in value by 1 every second until it gets to 1800 again at which point the process will repeat. I've also been able to stack objectives with messages so people can get a better idea of what is going on in the mission if they are late. 1) Lay out objectives 1 / 2 / 3 in the mission briefing. Each one will be assigned a flag 1 / 2 / 3 that will be set to true when accomplished. 2) When objective 1 is being performed ( flag 1 / 2 / 3 are not true), this can be used as a condition for a similar countdown. Additional conditions would be needed to the above countdown trigger... So your countdown flag (10) would need to have reached 1800, but flag 1 / 2 /3 would also need to be considered false resulting in a message that could say "You are working on objective 1 in the briefing." Once the first objective is complete, you can set flag 1 to true. (once / group destroyed / flag 1 true) 3) Once objective 1 is complete, flag 1 is set to true but 2 / 3 are still false. The condition on your counter would be changed so that it looks like "switched condition / flag equals 1800 AND Flag 1 true Flag 2 / 3 False / "Objective 1 is complete. Please proceed with objective number 2." AND set flag 10 to 1 (to reset the counter) 4) When objective 2 is complete (once / group 2 dead / flag 2 true), then you can adjust the countdown message again (switched condition / flag 1 true AND flag 2 true AND flag 3 false) and send the message "You are working on the 3rd objective in the briefing." AND set flag 10 to 1. 5) Once all objectives are complete, you can run "run once / flag 1 /2 /3 true / Message "Congrats all objectives are completed. That flag will only fire one time and could be independent of our countdown... The countdown trigger would still be "switched condition / flag 10 value 1800 AND flag 1/2/3 true / flag 4 true AND set flag 10 to 1. Remember- you're now using flag 4 as a place holder to set a time of reference for when the mission was complete to wrap up the mission. If you send a message there right at that point, it'll overlap with your "mission complete" message that your broadcast in number 5 above. 6) So now- you can give the troops 20 minutes to RTB. Your countdown timer can still carry on as before (switched condition / flag 10 = 1800 AND flag 1/2/3/4 is true / "Mission is complete... RTB" AND set flag 10 to 1. (If you don't set all 3 as true then you could have two conditions the same. 4 is true so that's one met condition... but 1/2/3 are also true so that is a second met condition. This will result in some overlap of messages. You can also countdown from mission complete in a separate set of triggers... ie: Run once / time since flag 4 (300) / message "you have 15 minutes to rtb." Run once / time since flag 4 (600) / message "you have 10 minutes to rtb." Run once / time since flag 4 (900) / message "you have 5 minutes to rtb." etc. _______________________________________________________________________________________________________________________________________ YOU MADE IT~! This got out of hand on me pretty fast but I hope it helps! Edited June 20, 2014 by ENO "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
ENO Posted June 20, 2014 Posted June 20, 2014 (edited) lol sorry- that's why I said you had to take it one step at a time. I broke it up into sections... It's funny all I wanted to do was say... a flag is A, and it can do B and C. Enjoy... Whoops. Edited June 20, 2014 by ENO "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
jhonny912 Posted June 21, 2014 Author Posted June 21, 2014 Thanks everyone, I realized something more
Wrecking Crew Posted June 21, 2014 Posted June 21, 2014 This got long real fast... LOL! Add this to the discussion... :smartass: my guide for using flags. https://drive.google.com/file/d/0BwHk38uryutrMXZBWlk5ZjdRbjQ/edit?usp=sharing WC Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.
rvotri Posted December 28, 2016 Posted December 28, 2016 Would be a lot easyer if ED used "string names" for flags instead of numbers. I personally think it sucks to have to write in a sepparated notebook the meaning for all my flags. There are missions that i use a lot of them (84) on my last work. AND would be lot easyer if, instead to place a lot of confused set of flags and randon percentages, they provide a "Randon Time (x,x)" on condition check. Come on ED... You guys made a "freaking" simulator with a freaking physic... A "Randon Time Check" and "Flags Names" wouldn't be hard to make... Make we, designers, happy! Who cares...
Pikey Posted December 28, 2016 Posted December 28, 2016 If you spent long enough to create 84 flags, how come you never saw the RANDOM condition. Which, if you wanted can be set with an additional, TIME MORE condition. Or other conditions. Or the set random to a flag.....and increment flag per second - but you might "freak" out over another flag. Flags changed to variables, hmm, its getting awfully close to just writing a LUA snippet for a random number generator, why dont you just google that, you could give it a variable name and be done with your flags ;) Would be a lot easyer if ED used "string names" for flags instead of numbers. I personally think it sucks to have to write in a sepparated notebook the meaning for all my flags. There are missions that i use a lot of them (84) on my last work. AND would be lot easyer if, instead to place a lot of confused set of flags and randon percentages, they provide a "Randon Time (x,x)" on condition check. Come on ED... You guys made a "freaking" simulator with a freaking physic... A "Randon Time Check" and "Flags Names" wouldn't be hard to make... Make we, designers, happy! ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
rvotri Posted January 12, 2017 Posted January 12, 2017 If you spent long enough to create 84 flags, how come you never saw the RANDOM condition. Which, if you wanted can be set with an additional, TIME MORE condition. Or other conditions. Or the set random to a flag.....and increment flag per second - but you might "freak" out over another flag. Flags changed to variables, hmm, its getting awfully close to just writing a LUA snippet for a random number generator, why dont you just google that, you could give it a variable name and be done with your flags ;) No.. I didn't say that i never saw Randon generators, but, for sure a randon function would be less painfull, more intuitive and more produtive. 84 flags are just a example, use to build huge missions to my own server, flags help me to keep things working, but principally keep the flow stable since game has resources limitations... 4 sure i use lua scripting, good missions, or at least real ones wouldn't never be possible using the standard mission editor. Anyway i still keep the beg: "Build a randon generator" and add a field to "Name" for flags, and, off course, add "select boxes" when when we need them. Exactly like what happen when using "Group Activate", you cannot set an inexistent group there. TY ED. Who cares...
FlightControl Posted January 13, 2017 Posted January 13, 2017 There is a very easy solution. Suggest you learn the SPAWN class in the Moose framework, and you'll be doing the show in no time... A bit of very simple lua coding is required. [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE]
Ignition Posted January 16, 2017 Posted January 16, 2017 With MOOSE you can do it with this: http://flightcontrol-master.github.io/MOOSE/Documentation/Spawn.html##(SPAWN).SpawnScheduled Is the easiest way to do it.
rvotri Posted January 17, 2017 Posted January 17, 2017 There is a very easy solution. Suggest you learn the SPAWN class in the Moose framework, and you'll be doing the show in no time... A bit of very simple lua coding is required. Wow! I didn't knew about it, i just have read MOOSE modules's index :book: and it has a lot of usefull things there... I use MIST for a long time, but it has some BUGs and limitations, Can u please, post some tutorial or video so i could get started? TY Who cares...
Ignition Posted January 17, 2017 Posted January 17, 2017 Wow! I didn't knew about it, i just have read MOOSE modules's index :book: and it has a lot of usefull things there... I use MIST for a long time, but it has some BUGs and limitations, Can u please, post some tutorial or video so i could get started? TY MIST is very good and give you excelent tools but MOOSE for me is much more friendly and easy. To start https://www.youtube.com/watch?v=HftfRW7wZ1M He has uploaded a lot of videos explaining very well different functions and examples. Also there're a lot of documentation on the website, but with the intellisense in the Lua editor you almost don't need it. Its all very well documented, so good that I can make things happen without any knowledge of Lua :P.
FlightControl Posted February 6, 2017 Posted February 6, 2017 Wow! I didn't knew about it, i just have read MOOSE modules's index :book: and it has a lot of usefull things there... I use MIST for a long time, but it has some BUGs and limitations, Can u please, post some tutorial or video so i could get started? TY Hey! If you want help with MOOSE, send me a PM. I can get you on our MOOSE user community on slack. FC [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE]
FlightControl Posted February 6, 2017 Posted February 6, 2017 MIST is very good and give you excelent tools but MOOSE for me is much more friendly and easy. To start https://www.youtube.com/watch?v=HftfRW7wZ1M He has uploaded a lot of videos explaining very well different functions and examples. Also there're a lot of documentation on the website, but with the intellisense in the Lua editor you almost don't need it. Its all very well documented, so good that I can make things happen without any knowledge of Lua :P. And you too Ignition, send me a PM, you're not on slack yet, are you? [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE]
Recommended Posts