Wrecking Crew Posted May 24, 2013 Posted May 24, 2013 I'm crossing my fingers and going ahead with this, it *should* work... Instead of using a Continuous Action event with Condition is Time More 10 and Actions is Do Script to detect 3 Red vehicles in a zone and set a flag using MIST, I want to change it to a Switched Condition with Conditions = Time More 10 And Part Of Coalition In Zone, and Actions is the same Do Script to detect 3 Red vehicles in the zone and set the flag. Anyone know if multiple Conditions for the Actions -> Do Script won't work? Eventually I'll find out... if you know I'd appreciate hearing more. --- Another situation with Do Script that detects Red vehicles in a zone and sets a flag to True - can that same flag be in the Conditions where it is checked for Is False? So if the flag to be set in the MIST Do Script is already True, then don't run the Action. I *think* this is another opportunity to use a Switch Condition event instead of a Continuous Action event. ^^^ Similar to that -- in the Do Script to detect a Red vehicle in a zone and set a flag, there is a Stop Flag in the script - can the stop Flag in the script be the same flag that is set in the script? Kinda sounds silly, may not have a practical use, but I do wonder if this would run, or not. If I end up testing these scenarios I'll post back here,,, it's just that I have a lot of edits to do before I can get around to testing these ideas. 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.
Grimes Posted May 24, 2013 Posted May 24, 2013 Anyone know if multiple Conditions for the Actions -> Do Script won't work? Yes. Do Script and Do Script File are exactly the same as other triggered actions. If the required conditions are true, the action is done. Assuming you are using mist.flagFunc.units_in_zones, you don't need to put it on a continuous or switched condition trigger. Simply using "once" will do. Basically the flag functions "create" a custom trigger that is automatically checked every few seconds to see if the required conditions exist, and then sets the flag true. If you were using a continuous>timeMore>Do Script then you would be constantly adding new "triggers" for the scripting engine to check when only one instance is required. Yes the stop flag can be the same flag you set to true. Also you can do pretty much whatever you like with the flags. The flag funcs simply set it true exactly how it would work if you had another trigger that would also set the flag to true. 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
ENO Posted May 24, 2013 Posted May 24, 2013 So the script is never technically "achieved" and filed away so the once condition works throughout... Am I understanding that correctly? "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
Grimes Posted May 25, 2013 Posted May 25, 2013 Well it entirely depends one what the script actually does. Most scripts will indeed just run once as if it was setting a flag or displaying a message and whatever the trigger rules are set will define when the script is run. In the case of mist "FlagFuncs" when you call these functions the function is automatically rescheduled to run again. In many ways it is similar to creating a trigger. However not all scripts reschedule, thus it depends on what is coded. 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
Wrecking Crew Posted May 25, 2013 Author Posted May 25, 2013 (edited) All right.. :-) The reason for the Switched Condition is to account for Blue being able to destroy the Red vehicles before a countdown timer ends. I give Blue the opportunity to clear the zone, but then Red can come back into the zone, so I need the Switched Condition instead of the Once type event. I am running events that detect Red in an outer zone, sending messages to each coalition, also detecting if Red is out of the outer zone, when Red breaches the inner zone with one vehicle, also detect if the inner zone is clear of Red, and finally detect when Red gets 3 or more vehicles in the inner zone to win the mission. I *really* like that ability to check the number of the units in the zone. By adding the Condition = Part Of Coalition In Zone I can avoid the constant checking of the event with a Continuous Action. I wonder if the Continuous Action events are a source of the issues I was having in Combined Arms slots. http://forums.eagle.ru/showthread.php?t=107070 --- The other idea I had is what happens if there is both a Do Script Action and another Action such as setting another flag or whatever - activating a group. etc. I think that if the Conditions requirement(s) are met then the Do Script MIST function will then check it's own condition and perform its own action, and if there are additional Actions for the event they will execute independently of the Do Script. Right Now I have only the Do Script MIST code in the Actions window for every MIST event I am running, each sets one flag. Then I use a second event that checks the Condition of the MIST flag is True and go from there. --- Can the MIST code for the unit_in_zone set multiple flags by separating them with commas or another delimiter? Something like this - mist.flagFunc.units_in_zones{ units = {'[blue][vehicle]'}, zones = {'Point Bastion'}, flag = 99, flag = 100, flag = 101, req_num = 8, stopflag = 1000 WC Edited May 25, 2013 by Wrecking Crew 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.
Wrecking Crew Posted May 25, 2013 Author Posted May 25, 2013 (edited) Hmmm, I think there could be a problem with a Switched Condition with Part Of Coalition In Zone - when the Do Script for unit_in_zone has the required number set higher than 1: If required number > 1 then the first unit to reach the zone will switch the condition on the Part Of Coalition In Zone, and the Do Script Action will run to check its condition but will not set its flag. Then when additional units come into the zone the event condition won't switch again, so the Do Script won't trigger when it needs to. I would think it will work for required number = 1. So, I will need a Continuous Action event for my scheme, when the units_in_zone is checking for > 1 unit. ^^^ Ahh Grimes, I reread what you said above about the Once event type. A Once event with Condition = Time More 10 and Action Do Script for the units_in_zone function will continue to monitor the zone? If Yes then I never need a Continuous Action - because every time x number of units enter the zone then that Once event will set its flag to true. I gotta test this one... be back. --- BTW - to recognize which trigger events are MIST, I am leading the description with 'mist.' WC Edited May 25, 2013 by Wrecking Crew 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.
Wrecking Crew Posted May 25, 2013 Author Posted May 25, 2013 I have a test mission that is working -- I'll post it. 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.
Wrecking Crew Posted May 25, 2013 Author Posted May 25, 2013 (edited) This test mission looks for multiple events when red vehicles enter a zone. There are two groups of four vehicles. The first group goes in and out of the zone and then triggers the second group to do the same. Run this at about 5x acceleration and it will go pretty quick. It is working, such that every time red units *enter* the zone a Switched Condition event runs the MIST units_in_zones function and sets a flag. The MIST code looks for 1 unit, 2, 3 and 4 units and sets separate flags which then pop flares. The idea of setting two or more flags with the MIST function does not quite work - I tried two flags but only the second flag is set to true, as seen by the green smoke instead of a flare coming off of unit #4. The events do not trigger as units leave the zone - the MIST units_in_zone function fires as more units enter the zone, but do not fire as the number decreases. I tested Continuous Action events for the MIST functions. This approach severely impacted my frame rates in this simple mission. I strongly suspect this is why I had the trouble with Combined Arms - I will update that post in just a bit, and will follow up on it later after I've adjusted my missions. So, what worked is a Switched Condition event with Conditions = Time More 10 And Part Of Coalition In Zone, and Action = Do Script for the MIST units_in_zone function. I was surprised that this worked, good thing it's tested now... [ATTACH]82463[/ATTACH] Edited May 25, 2013 by Wrecking Crew 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.
Wrecking Crew Posted May 25, 2013 Author Posted May 25, 2013 Yes, switching out the Continuous Action events for the MIST units_in_zones function with Switched Condition types seems to have eliminated the problems I was having with the Combined Arms slots in my missions. From the testing earlier, I think everything will work the way I want it to - detecting multiple entries into zones as time goes on in the missions. Thanks for the help Grimes, and to Speed as well for all your work on MIST. 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.
mwd2 Posted May 25, 2013 Posted May 25, 2013 before MiST 2.0 i got the same problem: okay thanks, next problem :music_whistling: i use mist.flagFunc.units_in_polygon { units={'tank'}, zone={ [1]=mist.DBs.unitsByName['inf1'].point, [2]=mist.DBs.unitsByName['inf2'].point, [3]=mist.DBs.unitsByName['inf3'].point, [4]=mist.DBs.unitsByName['inf4'].point, }, flag=5 } to let a counter start, if the tank unit in the zone. This work without any problem, but if i move the unit out of the zone, the counter still run! What must i do, to stop let the flag 5 be true? with a modification of MiST 1.1, it works (!! but MiST 2.0 change the lines!): Flagfuncs don't actually set a flag to false if the condition isn't true. For some of them it would be logical to alternate from true to false it would probably be a good idea to add that functionality into it. I *think* a simple modification to the function itself would add this capability. The following suggestion is not an official Mist feature, but just an idea on how to make it work.... Open up Mistv1_1 and go to line 1980 and insert this: if num_in_zone < req_num then trigger.action.setUserFlag(flag, false) end I didn't actually test it, but it should work. If we add in a feature like this in the future, it might require an additional variable to be set or not, as Speed and I would need to discuss the best way of implementing it. :) Playing: DCS World Intel i7-13700KF, 64GB DDR5 @5600MHz, RTX 4080 ZOTAC Trinity, WIN 11 64Bit Prof. Squadron "Serious Uglies" / Discord-Server: https://discord.gg/2WccwBh Ghost0815
Grimes Posted May 25, 2013 Posted May 25, 2013 Yes, switching out the Continuous Action events for the MIST units_in_zones function with Switched Condition types seems to have eliminated the problems I was having with the Combined Arms slots in my missions. I should have said outright to NEVER user flagFuncs on a continuous trigger. It simply isn't required. Like I said before, it creates something very similar to a trigger when the script is run. If its run twice, it will create two identical triggers. If you leave it on continuous>time more, it will create a new trigger for every second the sim is running, thus it will eventually bog things down. Think of the trigger it creates as: Once> Time more (whatever time it started at) and At least x units in zone from unit list> Set Flag True No the function isn't capable of setting multiple flags to true. I would advise you to just use a 4th flag that isn't modified by anything else, and when that flag becomes true, set the other three true. mwd2, yeah we didn't officially add that to the script. Mostly because I forgot about it. 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
mwd2 Posted May 26, 2013 Posted May 26, 2013 mwd2, yeah we didn't officially add that to the script. Mostly because I forgot about it. :) i think, the modification must go to line 2258 of MiST 2_0.lua, in my case for mist.flagFunc.units_in_polygon Playing: DCS World Intel i7-13700KF, 64GB DDR5 @5600MHz, RTX 4080 ZOTAC Trinity, WIN 11 64Bit Prof. Squadron "Serious Uglies" / Discord-Server: https://discord.gg/2WccwBh Ghost0815
Recommended Posts