cfrag Posted July 8, 2021 Posted July 8, 2021 This is probably a silly question, as it must have been solved a million times over: Using Lua, how would I determine in the callback to a ID=6 (ejection) event that a player ejected? The unit (initiator) no longer identifies as a player unit, and the target (seat) has no name. What am I overlooking - or how a you detecting that a player has ejected? Thanks -ch
Grimes Posted July 9, 2021 Posted July 9, 2021 Make a list of unit objects that can be players and cross reference it. For instance mist makes a DB of aircraft names players can occupy and the check could be as simple as: local initName = event.initiator:getName() if initName and mist.DBs.humansByName[initName] then -- a player ejected 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
cfrag Posted July 9, 2021 Author Posted July 9, 2021 Thanks Grimes! That's indeed the way I'm doing it (I collect all user occupied units by name - and capture player_entered_unit to update - and then check the now empty unit's name against that list) - and I was wondering if there was a better, less roundabout way. Thank you so much for clearing that up! -ch
Recommended Posts