Pikey Posted December 13, 2015 Posted December 13, 2015 Anyone got a reasonably simple way of detecting that an aircraft is parked rather than starting up? Altitude is a no go as they may land different airbase and its not a radar alt, speed is 0 during the startup so that doesn't work on it's own, location is always similar. Ideally im looking to despawn the aircraft when its completed it's route and landed and respawn using mist.respawnGroup ('whatever') pretty much continuously, so several groups and activations do not work. Thanks. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Stonehouse Posted December 14, 2015 Posted December 14, 2015 Pretty sure there is a engine shutdown event which could be coupled with altitude = land height at the vec2 and perhaps velocity vector < small amount or alternatively you can tell from events whether an aircraft has landed so you could determine an aircraft has landed and then check repeatable for engine shutdown for landed aircraft and then despawn it using destroy() - I assume this would then trigger a respawn??
Pikey Posted December 14, 2015 Author Posted December 14, 2015 Hmm, so not within the basic trigger system, i'd need to put pen to paper with LUA :( Or delegate! :) ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Stonehouse Posted December 14, 2015 Posted December 14, 2015 Or delegate! :) Cheeky bugger ;D Hmmm maybe. Depends on other things well outside the confines of DCS. Someone else may also step up and do it quicker than me. If I am lucky.......
Stacker Posted December 14, 2015 Posted December 14, 2015 This should get you going - I couldn't get the unit.destroy to work (crashed DCS), so the destroy only works on the group level. This means the first unit to shutdown after landing will destroy the entire group irrespective of where they are. Haven't tested in MP so don't know what would happen etc.. but should give you a head start. In your mission, load in MIST and then a few seconds later just load a script file containing this etc.. The 'getPlayerName' bit is an attempt to stop it destroying you as all AI units have a blank name. do local function cleanupLanded(event) if( event.id == world.event.S_EVENT_ENGINE_SHUTDOWN and event.initiator) then local landedUnit = event.initiator local landedGroup = Unit.getGroup(landedUnit) if(Unit.getPlayerName(landedUnit) == nil) then landedGroup:destroy() end end end mist.addEventHandler(cleanupLanded) end i7-4790K@4.7GHz : EVGA 1070 SC : 16GB Corsair Vengence Pro : 2xEVO 840 SSD : EVGA 850W PSU : CORSAIR H100i Cooler : ASUS Z97-AR MB : CORSAIR OBSIDIAN 750D FULL TOWER
Stonehouse Posted December 14, 2015 Posted December 14, 2015 (edited) Interesting. So it worked for you Stacker using the mist eventhandler? I did build something last night but using world event handlers - ended up here http://forums.eagle.ru/showpost.php?p=2599175&postcount=1 Sorry - reread your post - you too hit the unit:destroy() issue Edited December 14, 2015 by Stonehouse
lukrop Posted December 14, 2015 Posted December 14, 2015 (edited) One should be able to workaround the unit:destroy() issue just by scheduling it to a later point in time. In regards of performance this is a good idea since code inside event handlers should run/be done as fast as possible and the deletion of an object could take some time. Though I dunno what the engine really does behind the scenes of course. Maybe you can dissect/adapt this function for your purpose, essentially it does what you want but checks if all members of the group are on the ground. Edited December 14, 2015 by lukrop grammar GCICAP Release | GCICAP issue tracker
Stacker Posted December 14, 2015 Posted December 14, 2015 Interesting. So it worked for you Stacker using the mist eventhandler? Yeah. I don't do much scripting these days so I didn't even consider using the built in world event handling. I find mist just does a lot of stuff you don't have to worry about. One should be able to workaround the unit:destroy() issue just by scheduling it to a later point in time. In regards of performance this is a good idea since code inside event handlers should run/be done as fast as possible and the deletion of an object could take some time... Right, I see how it's done. Yes that would be a better solution so that whenever we get a S_EVENT_ENGINE_SHUTDOWN we iterate through that units group and if ALL elements are either dead or shutdown we destroy the group, got it. This was just a quick and dirty hack to help a guy out - I guess this problem has been solved before. I'm surprised MIST hasn't incorporated some de-spawn logic already... (hint hint). 1 i7-4790K@4.7GHz : EVGA 1070 SC : 16GB Corsair Vengence Pro : 2xEVO 840 SSD : EVGA 850W PSU : CORSAIR H100i Cooler : ASUS Z97-AR MB : CORSAIR OBSIDIAN 750D FULL TOWER
Pikey Posted December 15, 2015 Author Posted December 15, 2015 Ha not you! I can only delegate to folks i slave away for in my own group! I had someone in mind, definitely not yourself. But now that you volunteered....I jest... So the issues i'm running into involve the types of problems you in the thread are also trying to solve. AFAIK the group and unit thing that broke since 1.5 is part of the redesign of the groups and units when MP two pilot per plane hit. We wait with baited breath on this. The detection of the event is fair enough and thankyou Stacker! The issue is with the additional bugs of trying to identify the group after it has respawned with MIST, that seems to be a new bug. Apparently LUA predicates can get the group OK but I've not been able to achieve it in LUA for some reason despite the code being out there. In game I cannot identify the respawned group by any means using the ME trigger system, that's broken too. This never used to be a problem before to respawn things, if I set an if exists type check it catches the death first time, same as using an out of trigger or damaged etc. As soon as the unit respawns it respawns every second because it never detects its presence in the game by group name. Unit names change. Cheeky bugger ;D Hmmm maybe. Depends on other things well outside the confines of DCS. Someone else may also step up and do it quicker than me. If I am lucky....... ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Pikey Posted December 15, 2015 Author Posted December 15, 2015 (edited) I need to put this in context. The 'why' is important. All im trying to do is create a permanent CAP that when it finishes it spawns again, forever without any interaction, but unlimited. The reason for this ask is that we play a permanent campaign which records all flights, triggers, positions of units between sessions so I can take over the world in realtime as a continuous session and it can survive server restarts. Eventually the blues will capture the airfield(s) and I'd like to stop these CAP when they are overrun. When the server state is captured it takes the original flightplans of the CAPs or the picture of the mission for planes as they would have been when the mission launched. I currently have a mission that has a 30-40 hour play time. It took as long to write as a decent 2 hour mission and has only 600-700 units, not all of which are present at any one time. This is a net saving of time to write missions of 10 times. This is why we are all here, we've been talking campaigns for years. GCICAP was a principle part of this. Any automation or script was a principle part of this, its what we all work for. All the ground triggers and saving works, it's been proven and the main part for me is over now. What used to be simple now suddenly got complicated - the Air defence CAP. I also use some players for this, but they need to be supplemented. So the predicament for many, is how to get a flight to respawn, whatever happened to it, half shot down, stuck on the runway, all those silly things. And how to despawn the respawn and spawn it again all using the same triggers. Oh and I use only 28 triggers and 3 community scripts and a mod. It's principally PvE or asymetric TvT so has a different format to Blue Flag but I may incorporate FARP features when i can work that into the game. Edited December 15, 2015 by Pikey can't stop writing. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Recommended Posts