Clayt Posted May 11, 2015 Posted May 11, 2015 So I have been getting to grips with the mission editor and have encountered a problem. The issue is that I can't seem to get ground unit groups to respawn once destroyed, aircraft on the other hand respawn just fine. For the aircraft I use this: TYPE- Switched Condition CONDITIONS- lua predicate if not Group.getByName('ENEMY CAP') then return true end ACTIONS- if not Group.getByName('ENEMY CAP') then mist.respawnGroup('ENEMY CAP') end However, when I try exactly the same for ground units they never respawn. Does anybody have any ideas? Help is greatly appreciated.
Clayt Posted May 12, 2015 Author Posted May 12, 2015 After testing this and looking at a few other threads I have found that although the ground units were destroyed they had to be deactivated before they would respawn properly. The problem is that I want to keep ground units respawning and the mission editor functions don't recognize them once they have respawned, from what I have read that means I will have to use mist to deactivate the new groups. I'll definitely have to study lua coding in depth, sadly I feel I've got a long way to go yet but perhaps it's not as complex as I'm making it out to be?
Grimes Posted May 12, 2015 Posted May 12, 2015 There is a bug that has caused us to code around it. Basically Group.getByName() isn't supposed to return anything if the group is completely dead, but it is, that is the bug. There is a work-around by using something along the lines of... lua predicate: if Group.getByName('ENEMY CAP') and Group.getByName('ENEMY CAP'):isExist() == false or not Group.getByName('ENEMY CAP') then return true end You don't actually need the if statement in the action because with the lua condition its already been proved true. So it could just be the mist command. 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
Clayt Posted May 12, 2015 Author Posted May 12, 2015 Thanks for the reply Grimes, I have just tested that lua predicate condition you posted and I'm still having no luck getting it to work for the destroyed ground units. Here is how I tried it for some tanks: TYPE - switched condition CONDITIONS - lua predicate: if Group.getByName('ENEMY') and Group.getByName('ENEMY'):isExist() == false or not Group.getByName('ENEMY') then return true end ACTIONS - mist.respawnGroup('ENEMY') end
Clayt Posted May 15, 2015 Author Posted May 15, 2015 OK it seems like I've got it working, for the lua predicate I'm using :getSize. CONDITIONS - lua predicate: if Group.getByName('ENEMY TANK'):getSize() < 1 then return true end I reckon that's as efficient as possible but my lua knowledge is lacking :surrender:
Grimes Posted May 15, 2015 Posted May 15, 2015 Yeah that works. The problem is it appears that the isExist() function is now also bugged. 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
Recommended Posts