stephen.v.sargent Posted December 29, 2021 Share Posted December 29, 2021 Updated a little more elegantly: dofile("C:\\.......My Mission\\TestMission06.lua") local waypoints = {} local i=1 while true do local str=wyptstxt[i] if not str then break end i=i+1 local t = {} for n in str:gmatch("%S+") do table.insert(t, tonumber(n)) end local lat=t[1] local lon=t[2] local route = {} route = coord.LLtoLO(lat, lon) waypoints[#waypoints+1] = mist.fixedWing.buildWP(route,"turningpoint",200,500,"agl") end local myLog = mist.Logger:new('waypoints',waypoints) local GroupDrone = {} GroupDrone = Group.getByName("Drone") local DroneWhat ={} DroneWhat = mist.goRoute(GroupDrone, waypoints) where TestMission06.lua is : wyptstxt={} wyptstxt[1]="44.19277778 38.62527778" wyptstxt[2]="44.99277778 38.62527778" wyptstxt[3]="44.99277778 39.62527778" wyptstxt[4]="44.19277778 39.62527778" i.e. a file where an indefinate number of waypoints can be added. Note that doing this in a do file gets round the exclusion of lua io functions in DCS Link to comment Share on other sites More sharing options...
MajSchrute Posted February 5, 2022 Share Posted February 5, 2022 if (Group.getByName('truck-1') and Group.getByName('truck-1'):getSize() == 0) or not Group.getByName('truck-1') then mist.respawnGroup('truck-1', true) end How can I add a 2 minute delay to the respawn of the group? Link to comment Share on other sites More sharing options...
Grimes Posted February 6, 2022 Share Posted February 6, 2022 You either need to put the check in a function or set that check to run at a rate slower than two minutes otherwise you would end up with the respawn being scheduled multiple times. In other words if you have it check if a group is dead every 10 seconds, and it scheduled the group to respawn in two minutes, then the group would respawn 12 times for two minutes after the initial two minute delay. You could do something like this. Basically set a time when you want a group to respawn and have a function check to see if that time has come. If it has then it respawns the group. groups = {} function checkGroups() for gName, gData in pairs(groups) do if type(gData) == 'number' and timer.getTime() > gData then mist.respawnGroup(gName, true) groups[gName] = nil end end end mist.scheduleFunction(checkGroups, {}, timer.getTime() + 1, 30) ----- Then if you wanted to add a group to it if (Group.getByName('truck-1') and Group.getByName('truck-1'):getSize() == 0) or not Group.getByName('truck-1') then groups['truck-1'] = timer.getTime() + 120 end 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 Link to comment Share on other sites More sharing options...
Kevstosmart Posted February 10, 2022 Share Posted February 10, 2022 (edited) Good evenings guys! I’ve been trying to get something cooked up for liberation but need a bit of help. I’m just trying to populate the map with zones with a generic “xxxxx-1” zone naming over blue and red airbases. I’ve been trying to use and it does nothing, mist works I’m able to spawn stuff via the veaf script thank you in advance guys loaded it as a do script file 5 Seconds after mist loads mist.marker.add(table vars ) local ab = coalition.getAirbases(1) for i = 1, #ab do local v = {} v.pos = ab[i]:getPoint() v.markFor = {coa = {'red'}} v.radius = 3000 v.mType = 'circle' mist.marker.add(v) end Edited February 10, 2022 by Kevstosmart Link to comment Share on other sites More sharing options...
toutenglisse Posted February 10, 2022 Share Posted February 10, 2022 48 minutes ago, Kevstosmart said: ...I’ve been trying to use and it does nothing... You need to replace v.mType by v.markType 1 Link to comment Share on other sites More sharing options...
Kevstosmart Posted February 10, 2022 Share Posted February 10, 2022 53 minutes ago, toutenglisse said: You need to replace v.mType by v.markType SCRIPTING: Mission script error: [string "C:\Users\k4ort\AppData\Local\Temp\DCS.openbeta\/~mis000009CA.lu..."]:1: ')' expected near 'vars' using this mist.marker.add(table vars ) local ab = coalition.getAirbases(1) for i = 1, #ab do local v = {} v.pos = ab[i]:getPoint() v.markFor = {coa = {'blue'}} v.radius = 1500 v.markType = 'circle' mist.marker.add(v) end Link to comment Share on other sites More sharing options...
toutenglisse Posted February 10, 2022 Share Posted February 10, 2022 17 minutes ago, Kevstosmart said: SCRIPTING: Mission script error... I was wrong both v.mType and v.markType work Remove the first line mist.marker.add(table vars ) Link to comment Share on other sites More sharing options...
Kevstosmart Posted February 10, 2022 Share Posted February 10, 2022 5 minutes ago, toutenglisse said: I was wrong both v.mType and v.markType work Remove the first line mist.marker.add(table vars ) I’ll give it a shot tomorrow again, I did try it and got a error in “main chunk “ line 8 when I removed that. If you want pm me it’s for a group project and it’s our last step. Link to comment Share on other sites More sharing options...
toutenglisse Posted February 10, 2022 Share Posted February 10, 2022 10 hours ago, Kevstosmart said: I’ll give it a shot tomorrow again, I did try it and got a error in “main chunk “ line 8 when I removed that. If you want pm me it’s for a group project and it’s our last step. Strange, it works on my side. Here is a script example that marks all airbases with red or blue ring and a text mark that can give base name and number : Spoiler local BaseNum = 0 local ab = coalition.getAirbases(1) for i = 1, #ab do if ab[i]:getDesc()["category"] == 0 then BaseCall = ab[i]:getCallsign() else BaseCall = 'helipad' end BaseNum = BaseNum+1 local v = {} v.pos = ab[i]:getPoint() v.color = {255, 0, 0, 1} v.fillColor = {255, 0, 0, 0.3} v.radius = 3000 v.mType = 'circle' mist.marker.add(v) local v = {} v.pos = ab[i]:getPoint() v.text = BaseCall .. ' ' .. BaseNum v.mType = 0 mist.marker.add(v) end local BaseNum = 0 local ab = coalition.getAirbases(2) for i = 1, #ab do if ab[i]:getDesc()["category"] == 0 then BaseCall = ab[i]:getCallsign() else BaseCall = 'helipad' end BaseNum = BaseNum+1 local v = {} v.pos = ab[i]:getPoint() v.color = {0, 0, 255, 1} v.fillColor = {0, 0, 255, 0.3} v.radius = 3000 v.mType = 'circle' mist.marker.add(v) local v = {} v.pos = ab[i]:getPoint() v.text = BaseCall .. ' ' .. BaseNum v.mType = 0 mist.marker.add(v) end Link to comment Share on other sites More sharing options...
Kevstosmart Posted February 10, 2022 Share Posted February 10, 2022 1 hour ago, toutenglisse said: Strange, it works on my side. Here is a script example that marks all airbases with red or blue ring and a text mark that can give base name and number : Hide contents local BaseNum = 0 local ab = coalition.getAirbases(1) for i = 1, #ab do if ab[i]:getDesc()["category"] == 0 then BaseCall = ab[i]:getCallsign() else BaseCall = 'helipad' end BaseNum = BaseNum+1 local v = {} v.pos = ab[i]:getPoint() v.color = {255, 0, 0, 1} v.fillColor = {255, 0, 0, 0.3} v.radius = 3000 v.mType = 'circle' mist.marker.add(v) local v = {} v.pos = ab[i]:getPoint() v.text = BaseCall .. ' ' .. BaseNum v.mType = 0 mist.marker.add(v) end local BaseNum = 0 local ab = coalition.getAirbases(2) for i = 1, #ab do if ab[i]:getDesc()["category"] == 0 then BaseCall = ab[i]:getCallsign() else BaseCall = 'helipad' end BaseNum = BaseNum+1 local v = {} v.pos = ab[i]:getPoint() v.color = {0, 0, 255, 1} v.fillColor = {0, 0, 255, 0.3} v.radius = 3000 v.mType = 'circle' mist.marker.add(v) local v = {} v.pos = ab[i]:getPoint() v.text = BaseCall .. ' ' .. BaseNum v.mType = 0 mist.marker.add(v) end Awesome, quick question as I’m not on the computer! What did it make the actual zone it created not the mark point Link to comment Share on other sites More sharing options...
toutenglisse Posted February 10, 2022 Share Posted February 10, 2022 3 hours ago, Kevstosmart said: Awesome, quick question as I’m not on the computer! What did it make the actual zone it created not the mark point I sent you a pm. Link to comment Share on other sites More sharing options...
Grimes Posted February 11, 2022 Share Posted February 11, 2022 https://github.com/mrSkortch/MissionScriptingTools/releases/tag/4.5.106 Finally pushing 4.5 to master build. I don't really have any major overhauls planned so any additions and fixes should be merged quicker into it from development. Most of this is documented on the hoggit wiki. However I still need to add a few pages to it. Cumulative list of additions since 4.4.90: +added: mist.getPathLength() +added: mist.getPathInSegments() +added: mist.getPointAtDistanceOnPath() +added: mist.projectPoint() +added: mist.utils.getHeadingPoints() +added: mist.vec.normalize() +added: mist.getGroupTable() Returns the verbatim table for a group as defined in the mission editor. +added: mist.debug.writeGroup() This function is used to write a group table directly to a file of the groups name.lua. The point of this is to easily get the contents into a separate file. +added: mist.debug.writeTypes() This function iterates through units placed in the mission file and writes to a file containing a list of object typeNames, CLSIDs, and liveries +added: mist.shape.insideShape() Returns if the first shape is inside the second shape. +added: mist.shape.circleInCircle() +added: mist.shape.circleInPoly() +added: mist.shape.polyInPoly() +added: mist.shape.polyInCircle() +added: mist.shape.getPointOnSegment() +added: mist.shape.segmentInsersect() +added: mist.mapValue() +added: mist.utils.hexToRGB() +added: mist.getWindBearingAndVel() +added: mist.getUnitsByAttribute() +added: mist.getGroupsByAttribute() +added: mist.stringCondense() +added: mist.debug.changeSetting() +added: mist.debug.mark() +added: mist.marker.add() +added: mist.marker.getNextId() +added: mist.marker.remove() +added: mist.marker.get() +added: mist.marker.drawZone() +added: mist.marker.drawShape() +added mist.groupIsDead() +added better error handling messages in a number of functions +added mist.DBs.drawingByName and mist.DBs.drawingIndexed. Note: the above tables contains the values associated with the new drawings in the mission editor. Can be used with mist.marker.drawShape to activate a drawing shape created. There are limitations to this due to the scripting engine lacking a number of the draw features. For example rotating text, line thickness, icons, and outline types. Note 2: The shapes created in the editor are allowed to share a name. As a result entries sharing names in mist.DBs.drawingsByName will be overwritten with whichever value was used last. All are added to mist.DBs.drawingIndexed. -modified: properties table to zone entries in database -modified: mist.dynAdd will now check tasks assigned in route for any beacons and will update the groupId or unitId as needed. -modified: mist.getGroupData now has optional route boolean. If present it will also return the route. This allows the user to skip a function call. -modified: mist.debug.dump_G now accepts a boolean value that deletes entries that I commonly delete when dumping _G. -modified: mist.teleportToPoint -modified: mist.respawnInZone -modified: mist.cloneInZone -modified: mist.teleportInZone All four above functions now support additional parameters that can be used to alter specific behavior. -newGroupName : forces the create group to use this name - anyTerrain : If present no terrain check is performed to verify the new position is valid - validTerrain : Customize valid terrain types for the group to spawn on - initTasks : Keep initial tasking - offsetWP1 : Offsets the initial WP the group spawns at. Will go to next WP as defined in the editor. - offsetRoute : Offsets the entire route by the new location the group spawned at. - Modified: the following functions to support static objects: getUnitsInZones, getUnitsInPolygon, getUnitsInMovingZones, and getUnitsLOS, makeUnitTable - Modified: makeUnitTable to exlude units by category. - Modified: groupRandomDistSelf and groupToRandomZone to accept optional disableRoads parameter - Fixed: DB entry for country names to use the values stored in the country table instead of the localized name within the miz. This fixes a missmatch when spawning units for the third reich - Modified: getRandPointInCircle to use a default radius of 1000m if none provided. - Optimized: any instance of trigger.misc.getZone to reference mist.DBs.zonesByName instead = Modified mist.DBs.const.callsigns to include the new callsigns - Modified mist messages to update the display only if a change has been made. This will reduce spam in new DCS Message Log feature. It is still dependent on how often messages are updated, if you update a message for a stop watch timer then expect spam. -fixed: typo in mist.dynAdd -fixed: typo is mist.teleportToPoint -fixed: bug with mist.getLeadingPos where the position appeared to be reversed from what it was expecting -Fixed: verifyDB to check for empty string from static objects because it apparently can happen. -Fixed: checkSpawnedEventsNew to better handle errors from dbUpdate -Fixed: getUnitsInPolygon was erroneously checking for category 14 instead of 1 -Fixed: getUNitsInZones had an incorrectly named variable that defined an entry as nil. 1 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 Link to comment Share on other sites More sharing options...
Hellfire Posted February 13, 2022 Share Posted February 13, 2022 (edited) GitHub - lukrop/GCICAP: Autonomous GCI and CAP script for DCS: World. I'm using GCICAP.lua in what used to be a working mission until DCS's latest updates. I suspect it's the changes to the airbase names in NTTR. I had to load MOOSE update and modify some code to fix issues with it but MIST based GCICAP is also kicking error. ERROR SCRIPTING: MIST|doScheduledFunctions|1286: Error in scheduled function: [string "C:\Users\Gamer\AppData\Local\Temp\DCS\/~mis0000535D.lua"]:1453: attempt to index local 'airbase' (a nil value) That error points at line 1453 in GCICAP local airbase_pos = airbase:getPoint() Have there been any updates to mist to address this or am I barking up the wrong tree? I did update mission to mist_4_5_106. Edited February 13, 2022 by Hellfire Link to comment Share on other sites More sharing options...
Grimes Posted February 13, 2022 Share Posted February 13, 2022 The mist error is simply because the mist scheduler is used to call the GCICAP code. As you correctly figured out the error is with GCICAP. You could try adding some debug code to GCICAP to figure out what the problem might be. For instance above any line that calls airbase:getPoint() add something like the following to see if it gives a name for the airbase that it is erroring on: env.info(airbase:getName()) Best guess it isn't populating the airbase list correctly. 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 Link to comment Share on other sites More sharing options...
horus-DCS Posted February 25, 2022 Share Posted February 25, 2022 (edited) Hi, I have a question. I've been testing 4.5.106 and want to use groupToRandomPoint function for a respawned group. It would set the route correctly, but the group doesn't move initially after it spawned. I have to increase speed bar manually as a JTAC or TACCOM to move it. The previous version(4.4.78) I've used didn't have this problem. Do I miss something? Should I add some tasks? test.miz Edited February 25, 2022 by horus-DCS Link to comment Share on other sites More sharing options...
ADHS Posted February 25, 2022 Share Posted February 25, 2022 (edited) Hello. Is there a MIST function equals to UNIT ALIVE (conditions section, Mission Editor). Thank you PS: i've found this one: boolean Unit.isActive(Class Self ) but there wasn't an example so me to understand the correct syntax. Edited February 25, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits. Link to comment Share on other sites More sharing options...
toutenglisse Posted February 25, 2022 Share Posted February 25, 2022 1 hour ago, ADHS said: ...Is there a MIST function equals to UNIT ALIVE (conditions section, Mission Editor)... Hi - you can use : if Unit.getByName('yourUnitName') then (means if the unit is alive then ...) This code line works for Units only, for Groups you must use more conditions, because a dead Group is still True for scripting engine : if (Group.getByName('truck-1') and Group.getByName('truck-1'):getSize() == 0) or not Group.getByName('truck-1') then There are other means/functions for Unit Alive check, like : if Unit.getByName('yourUnitName'):isExist() == true then (isActive, with same way to use code than isExist, is for checking if an existing Unit is active, from "late activation" state, or still unactive) 1 1 Link to comment Share on other sites More sharing options...
ADHS Posted February 26, 2022 Share Posted February 26, 2022 (edited) toutenglisse Thank you VERY MUCH!! my friend. (Especially for your time to help me with details) Your HELP is always opening doors. Edited February 26, 2022 by ADHS Democracy was already invented, while Scrat was eating oak fruits. Link to comment Share on other sites More sharing options...
Grimes Posted February 26, 2022 Share Posted February 26, 2022 17 hours ago, horus-DCS said: The previous version(4.4.78) I've used didn't have this problem. Do I miss something? Should I add some tasks? I think it is something that I had changed and inadvertently causes a long running bug/behavior with DCS scripting because you are giving it an order immediately after it spawns. I have not pinpointed the exact cause within mist, but I have a pretty good guess. The solution would be kind of an ugly fix because it would work only in specific circumstances. In the meantime the AI accept the move order as long as you don't call the groupToRandomPoint function at the same time that you call teleportToPoint. Set it to on a trigger that occurs a second after they spawn or schedule it to occur later. Ideally you could do some of the legwork and pass the new route directly to teleportToPoint, which works flawlessly. local v = {groupName = 'RED transporter-1', point = mist.getRandomPointInZone('test'), action = 'respawn', disperse = true, maxDisp = 60, radius = 30, innerRadius = 20} v.route = {} v.route[#v.route + 1] = mist.ground.buildWP(v.point, "Cone", 4) v.route[#v.route + 1] = mist.ground.buildWP(mist.getRandomPointInZone('AO-' .. mist.random(2)), "Cone", 4) mist.teleportToPoint(v) 1 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 Link to comment Share on other sites More sharing options...
horus-DCS Posted March 1, 2022 Share Posted March 1, 2022 On 2/26/2022 at 1:43 PM, Grimes said: Ideally you could do some of the legwork and pass the new route directly to teleportToPoint, which works flawlessly. Thanks Grimes as always. But I still have a question... mist.message.add and other msg functions won't remove previous messages even after its determined display time. mist.message.add{text = 'TEST1', displayTime = 5, msgFor = {coa = {'all'}}} --screenshot's code, MIST 4.5.106 After a while I have to see the messages all over the screen! If I use a name of the message the text won't stack but I still get permanent messages of other names when any message is activated. Link to comment Share on other sites More sharing options...
Grimes Posted March 3, 2022 Share Posted March 3, 2022 Fixed it and a few other small fixes. https://github.com/mrSkortch/MissionScriptingTools/releases/tag/4.5.107 1 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 Link to comment Share on other sites More sharing options...
horus-DCS Posted March 4, 2022 Share Posted March 4, 2022 On 3/3/2022 at 10:16 AM, Grimes said: Fixed it and a few other small fixes. https://github.com/mrSkortch/MissionScriptingTools/releases/tag/4.5.107 Thank you sir! I think the 107 still has some bugs? Please check the attached mission. 1. I can't hear the sound for the 'complete' message, because it's activated over the previous msg('checking...') ongoing 2 'checking...' msg should be displayed only for 2s, but it doesn't disappear until the next msg('complete', 10s) is gone. 3. (I'm not sure if it's a bug, just a normal question) The mist msg doesn't work for individual ground units with an input value of msgFor = {units = ~~} ? test.miz Link to comment Share on other sites More sharing options...
Grimes Posted March 7, 2022 Share Posted March 7, 2022 I reverted the message display to v4 version of it for now. Its on development branch. If you dont have any issues I'll pull request it to the main branch. On 3/4/2022 at 2:48 PM, horus-DCS said: 3. (I'm not sure if it's a bug, just a normal question) The mist msg doesn't work for individual ground units with an input value of msgFor = {units = ~~} ? DCS limitation presently. Well its been a feature request for over 6 years at this point so saying "presently" is a bit of an understatement. There simply is no outTextForUnit, outSoundForUnit, or addCommandForUnit functions. The smallest it goes is at a group level. Mist filters all of the messages being sent down to the appropriate group. If you assigned a message to be displayed for 2 specific units that are in the same group then it'll realize a copy is being sent and ignore it. Alot of the problems encountered with the messaging changes (v5) was that I was trying to be a little more efficient with how it processed the messages. Basically it was constantly checking all of the active messages and re-printing a single message to each client. This is due to any possible "privacy" of wanting to send a message to a specific group. It also checks for any Combined Arms slots and if any are present sends a message to red and blue coalitions before sending to each client. Thus any CA specific message is immediately overwritten by the group messages. Anyway ED added the message log and it turns out constantly displaying a new message several times a second tends to needlessly spam the log and people find that annoying. Also one of the original reasons for the mist functionality was so that multiple messages didn't overwrite older messages, however many years ago ED rectified this by changing how messages work. So I got to thinking to essentially do the message code only as needed instead of constantly, and that is where the problems occurred. 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 Link to comment Share on other sites More sharing options...
ADHS Posted March 14, 2022 Share Posted March 14, 2022 Hello. I have setup some groups that will appear as advance spawn client places. Is there a way to hide these groups from the slot selection (briefing) menu ? Thank you. Democracy was already invented, while Scrat was eating oak fruits. Link to comment Share on other sites More sharing options...
Grimes Posted March 14, 2022 Share Posted March 14, 2022 Unfortunately no. That is all ED's UI. 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now