Ignition Posted February 25, 2016 Posted February 25, 2016 First of all, amazing script. All of this nice tools should be in the mission editor. Hi, how can I give an order like mist.groupToRandomZone to a group created with mist.cloneToRandomZone. I can clone the group but I don't know how to give them orders. The idea is to clone groups multiple times so I think I need to put a variable in the group name. Thanks.
Grimes Posted February 26, 2016 Posted February 26, 2016 That is pretty straight forward actually. mist.cloneInZone() returns a string of the new groups name. If I remember correctly there was an issue with the game where you have to wait a short period of time before issuing an order to a newly spawned group. Basically it can't be assigned instantly, but like a 0.1 second delay is probably enough. The following is an example of how this might work... for i = 1, 10 do local newGroupName = mist.cloneInZone('myCloneGroup', 'zoneX') mist.scheduleFunction(mist.groupToRandomZone, {newGroupName, 'zoneWhatever'}, timer.getTime() + 1) end 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
Ignition Posted February 26, 2016 Posted February 26, 2016 (edited) That is pretty straight forward actually. mist.cloneInZone() returns a string of the new groups name. If I remember correctly there was an issue with the game where you have to wait a short period of time before issuing an order to a newly spawned group. Basically it can't be assigned instantly, but like a 0.1 second delay is probably enough. The following is an example of how this might work... for i = 1, 10 do local newGroupName = mist.cloneInZone('myCloneGroup', 'zoneX') mist.scheduleFunction(mist.groupToRandomZone, {newGroupName, 'zoneWhatever'}, timer.getTime() + 1) end Thanks for the help! But I don't know what I'm doing wrong because the spawned groups don't want to move. For testing purposes I did a Switched Condition -> Random 100, Time Since Flag 1,10 -> Do Script do local newGroupName = mist.cloneInZone('USA 1', 'Respawn USA') mist.scheduleFunction(mist.groupToRandomZone, {newGroupName, 'AO'}, timer.getTime() + 1) end Flag Increase 1,1 They respawn every 10 seconds fine but they don't move at all. I checked the name of the 'AO' zone and its fine. I also changed the timer.getTime to +10 and no luck. Sorry I'm new in this. Thanks Edited February 26, 2016 by Ignition
Ignition Posted February 27, 2016 Posted February 27, 2016 Its possible that mist.cloneInZone is not returning a string of the name of the new group? I'm using mist.message.add to show the value of newGroupName and it doesn't show anything. If I try to show the value of another variable it shows correctly but I can't show the return of mist.cloneInZone, I think thats why the units aren't moving.
Ignition Posted February 29, 2016 Posted February 29, 2016 The trick was mist.scheduleFunction(mist.groupToRandomZone, {newGroupName["name"], 'AO'}, timer.getTime() + 1) Now its working thank you.
Quax456 Posted March 9, 2016 Posted March 9, 2016 Teleporting an Inf_template Hello dear fellows, following I was trying to realize for a couple of weeks. Via event_pilot_eject I call a function which is fetching the position provide mist.teleportToPoint with this position and all neccessary variables all I get is the Unit will be cloned, spawned and teleportet, but the height is unfortunatly the same of the ejected pilot and not on ground level. I have tried to correct it with mist.utils.makeVec3GL but same result. Any ideas???? My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 2TB Samsung 990 PRO, RTX4080, Thrustmaster HOTAS WARTHOG Stick + WINWING ORION 2 + MFG Crosswinds, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2
Grimes Posted March 11, 2016 Posted March 11, 2016 Pilots have rarely been considered to be "real" objects. They don't sync in MP, AI don't see them in the sense that they will try to attack, and I'm pretty surprised they are detectable by the scripting engine. I think we will have to wait for ED to add in actual "pilot" infantry or change how the ejected pilots interact with the world before we get to have fun with them via the scripting engine. 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
Quax456 Posted March 11, 2016 Posted March 11, 2016 Pilots have rarely been considered to be "real" objects. They don't sync in MP, AI don't see them in the sense that they will try to attack, and I'm pretty surprised they are detectable by the scripting engine. I think we will have to wait for ED to add in actual "pilot" infantry or change how the ejected pilots interact with the world before we get to have fun with them via the scripting engine. Hu wait! I think I haven't made clear what I'm trying to do! My eventHandler catches the event if a Pilot ejects. It could be an AI Pilot or a Human. The "event.initiator" delivers me a point postion which I use with mist.teleportToPoint and a formerly created infantry template to clone him on this position. The psotition is right, but not the Y-heigt!!!! look at these: local function spawnDownedPilot(unitName) local coa = tms.coaToSide(Unit.getByName(unitName):getCoalition()) local vars = {} vars.action = 'clone' if coa == 'blue' then vars.gpName = 'blue crashed pilot' elseif coa == 'red' then vars.gpName = 'red crashed pilot' end vars.point = Unit.getByName(unitName):getPoint() tms.debug('EVENT SPAWN EJECTED PILOT as infantry on Point: ' .. mist.utils.tableShow(vars.point)) downedPilot[#downedPilot+1] = mist.teleportToPoint(vars) end Later I will use these Infantry to be rescued by CSAR Choppers.....maybe :D My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 2TB Samsung 990 PRO, RTX4080, Thrustmaster HOTAS WARTHOG Stick + WINWING ORION 2 + MFG Crosswinds, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2
lukrop Posted March 11, 2016 Posted March 11, 2016 Hu wait! I think I haven't made clear what I'm trying to do! My eventHandler catches the event if a Pilot ejects. It could be an AI Pilot or a Human. The "event.initiator" delivers me a point postion which I use with mist.teleportToPoint and a formerly created infantry template to clone him on this position. The psotition is right, but not the Y-heigt!!!! Later I will use these Infantry to be rescued by CSAR Choppers.....maybe :D This functionality is provided by CSAR. Use it or check out how Ciribob is going about that task. GCICAP Release | GCICAP issue tracker
FSFIan Posted March 11, 2016 Posted March 11, 2016 As far as I know, when spawning ground units, DCS does not expect an altitude at all, so MiST will ignore whatever altitude you specify in your vec3 anyway. I think what happens here is that you spawn the infantry unit at the precise moment that the pilot ejects. DCS will cast a ray from an infinite height down at the ground and spawn the unit whereever that ray collides with an object (in your case, that is the plane that your pilot just ejected from). That's how I built the HMMWV Archway in the image below. You can either try to delay the spawn by a small amount of time and hope the aircraft is out of the way by then, or you can issue a movement order (a small distance in any direction will do). IIRC the unit will drop back to the ground as soon as it starts moving. 1 DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
Quax456 Posted March 11, 2016 Posted March 11, 2016 Ahhh, ok.... will give it a try. Thanks a lot :thumbup: My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 2TB Samsung 990 PRO, RTX4080, Thrustmaster HOTAS WARTHOG Stick + WINWING ORION 2 + MFG Crosswinds, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2
Quax456 Posted March 11, 2016 Posted March 11, 2016 IAN! My hero, your explanation does the trick. Without it I would have tried infinitly. Many, many thanks.... :smartass: My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 2TB Samsung 990 PRO, RTX4080, Thrustmaster HOTAS WARTHOG Stick + WINWING ORION 2 + MFG Crosswinds, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2
Grimes Posted March 12, 2016 Posted March 12, 2016 I wouldn't have thought that it checks for different object types. I've only ever tested it with ground forces, never thought to try and spawn a ground object in the same position as an aircraft. That would explain how the game can place infantry on rooftops and aircraft on top of the shelters on Nevada. 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
FSFIan Posted March 12, 2016 Posted March 12, 2016 (edited) When I first played around with what would eventually become DCS Witchcraft, I had a code snippet that allowed me to spawn a vehicle at a relative position to some other object. I experimented with spawning a tank at different distances in front of my A-10C (to ensure they would be spawned where I was looking). Then I took off and spawned things near my A-10C while in flight. When I spawned them in front of me, I would collide with them soon after and explode. I figured out that by spawning them a certain distance behind me, I would briefly hear them scrape against my A-10C and they would then stay in mid-air. I think that was followed by spawning some red smoke in the same location and trying to get a guns kill on a stationary airborne target :D Can't remember whether I killed one or they dropped to the ground as soon as the first bullet hit though. Edited March 12, 2016 by [FSF]Ian DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
EasyEB Posted March 15, 2016 Posted March 15, 2016 I've not had any success at all with GroupToRandomZone in Nevada. All my guys are doing is driving around in circles. Which button do I press to get it to work? I feel like I'm missing something obvious...
Quax456 Posted March 16, 2016 Posted March 16, 2016 I've not had any success at all with GroupToRandomZone in Nevada. All my guys are doing is driving around in circles. Which button do I press to get it to work? I feel like I'm missing something obvious... Have you made a table out of more than one zone? e.g.: {'zone1','zone2','zone3'} This will order them to a random point of one of this zones...I guess :smilewink: Or maybe you post your code so someone can take a look if it will work or not!? My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 2TB Samsung 990 PRO, RTX4080, Thrustmaster HOTAS WARTHOG Stick + WINWING ORION 2 + MFG Crosswinds, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2
EasyEB Posted March 16, 2016 Posted March 16, 2016 Right, sorry! I've been using the example code do mist.groupToRandomZone('myGroup2', {'myZone1', 'myZone2'}, 'cone', nil, nil, true) end The group is named "myGroup2", starting inbetween the two trigger zones "myZone1" and "myZone2".
Grimes Posted March 16, 2016 Posted March 16, 2016 I've not had any success at all with GroupToRandomZone in Nevada. All my guys are doing is driving around in circles. Which button do I press to get it to work? I feel like I'm missing something obvious... It appears to be an issue when it needs to use roads. It was written in way that exploited expected AI behavior. Basically if you tell AI to use an "on road" waypoint, but position of that point isn't actually on a road, the AI would find the nearest road to that point. At least on Nevada, the AI can't find the road unless the unit is directly on top of a road when given the order. Weirdly it works just fine for the "on road" waypoint at the end of the route that is created. By that I mean the AI drive to the nearest road to the point and then go off road to the actual random position that was generated. Though it has some issues in downtown LV which isn't all that surprising. It isn't something I can easily fix on my own because it would basically require an expensive process to try and find a road by checking hundreds if not thousands of points near the ground. 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
EasyEB Posted March 16, 2016 Posted March 16, 2016 I see. I think. But the problem is even when there are no roads even near to where either the group or the zones are, with use roads both true and false. I've also tried setting the zones big and small (if there would be a problem finding a path to a steep point for example) to no avail.
ickyline Posted March 19, 2016 Posted March 19, 2016 Hello, Iv tried to put mist with the last update, but it seems to not working with the actual version of dcs world. Did you have the same problem?
Grimes Posted March 20, 2016 Posted March 20, 2016 It works fine for me. How are you loading 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
Shaman Posted March 28, 2016 Posted March 28, 2016 Hi, I need a straight answer from experienced mission builder. Is it best to load script MISC on MISSION START trigger, or 2sec or 5sec ahead? 51PVO Founding member (DEC2007-) 100KIAP Founding member (DEC2018-) :: Shaman aka [100☭] Shamansky tail# 44 or 444 [sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer
Grimes Posted March 28, 2016 Posted March 28, 2016 Doesn't matter as long as it is before any scripts that utilize it are run. I like doing mission start or whenever it gets fixed the initialization script file. Right no the init script file isn't working so its almost always mission start. 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
Shaman Posted March 28, 2016 Posted March 28, 2016 Thanks for feedback. I am a bit lost in second part of your answer. So is this the correct way, I can expect it will always work? 51PVO Founding member (DEC2007-) 100KIAP Founding member (DEC2018-) :: Shaman aka [100☭] Shamansky tail# 44 or 444 [sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer
Stonehouse Posted March 28, 2016 Posted March 28, 2016 He's basically saying as early as possible. I think from memory the init script file runs first and then mission start and then everything else is later. I use a single mission start with multiple actions and the first is always mist and then other scripts like flakmgr or GCICAP follow.
Recommended Posts