Jump to content

Request: Add ‘AirBase’ object to S_EVENT_PLAYER_ENTER_UNIT


Recommended Posts

Posted

It’s in the Take off event but not in the birth or enter unit events and it would be a huge help if it was as there’s no way to know which base a newly spawned client is in with out brute force point interrogation!

 

Thanks

  • Thanks 1
Posted

Agreed, it would be a nice addition.

In the mean time, you can get the unit from initiator, and Unit.getPoint() for the location of the unit

Provided that the unit was spawned on an airfield (make sure via a check of alt versus land.height() at that location), all you need to do is iterate all airfields (via Coalition.getAirfields()) and pick the one with the closest distance to the unit.  Not elegant, agreed, but workable. 

 

-ch

  • Thanks 1
  • 3 months later...
Posted
-- I thought there was an event.place object (Airbase) if not you could...
local c_pos = event and event.initiator and event.initiator:getPlayerName() and event.initiator:getPosition() or nil
local n_base = c_pos and c_pos.p and Airbase.getNearset(c_pos.p) or nil
local b_name = n_base and n_base:getName() or nil

 

Creator & Developer of XSAF ::An AI model that wants to kill you, and needs no help from humans.

Discord: PravusJSB#9484   twitch.tv/pravusjsb  https://www.patreon.com/XSAF  https://discord.gg/pC9EBe8vWU https://bmc.link/johnsbeaslu

Work with me on Fiverr: https://www.fiverr.com/pravusjsb

  • Recently Browsing   0 members

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