Jump to content

Recommended Posts

Posted

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

Posted

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

  • Thanks 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

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

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...