C_Map.GetBestMapForUnit

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 8.0.1 / 1.13.2

Returns the current UI map for the given unit. Only works for the player and group members.

uiMapID = C_Map.GetBestMapForUnit(unitToken)

Arguments

unitToken
string : UnitId

Returns

uiMapID
number? : UiMapID - Returns the "lowest" map the unit is on. For example, if a unit is in a microdungeon it will return that instead of the zone or continent map.

Details

Related API C_Map.GetMapInfo
GetInstanceInfo
Related Events ZONE_CHANGED
ZONE_CHANGED_NEW_AREA

Example

Prints the current map for the player.

/run local mapID = C_Map.GetBestMapForUnit("player"); print(format("You are in %s (%d)", C_Map.GetMapInfo(mapID).name, mapID))
-- You are in Stormwind City (84)

Patch changes

Battle for Azeroth Patch 8.0.1 (2018-07-17): Added.