ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Imperial City base detection? (https://www.esoui.com/forums/showthread.php?t=10622)

Toirealach 06/30/23 03:35 AM

Imperial City base detection?
 
Is there any way to test to see if a player is currently in their home base in the Imperial City Sewers?

Masteroshi430 06/30/23 04:30 AM

Quote:

Originally Posted by Toirealach (Post 48042)
Is there any way to test to see if a player is currently in their home base in the Imperial City Sewers?

Getting the map id maybe?

Baertram 06/30/23 05:52 AM

Code:

/script d("Current mapId: " ..tostring(GetCurrentMapId()) )
Or using merTorchbug Updated and improved
/tb GetCurrentMapId()
----- @return name string, mapType [UIMapType|#UIMapType], mapContentType [MapContentType|#MapContentType], zoneIndex luaindex, description string
/tb GetMapInfoByIndex(GetCurrentMapIndex())

MapContentType should return MAP_CONTENT_AVA then
and zoneIndex most probably will be the zoneIndex of the Imperial Sewers (there might exist multiple zoneIndices/zoneIds for the different parts of the sewers, not sure. Maybe onlky the mapIds differ there) then

Toirealach 06/30/23 11:29 AM

Quote:

Originally Posted by Baertram (Post 48044)
Code:

GetMapInfoByIndex(GetCurrentMapIndex())
MapContentType should return MAP_CONTENT_AVA then
and zoneIndex most probably will be the zoneIndex of the Imperial Sewers (there might exist multiple zoneIndices/zoneIds for the different parts of the sewers, not sure. Maybe onlky the mapIds differ there) then

That's exactly what I tried in my code and it doesn't seem to return the right information. It says I'm in Imperial Sewers and in Harena Hypogeum even when I'm inside the Ebonheart Pact Base rather than on the other side of the door actually in the Harena Hypogeum area.

Baertram 06/30/23 12:40 PM

Sometimes,if mapIds and zoneIds do not help, the map's texture name helps. Dunno which API function returned that one but perhaps it contains an string identifer then that you could use.
I think LibZone got an API function to return that.

Toirealach 06/30/23 01:55 PM

Quote:

Originally Posted by Baertram (Post 48055)
Sometimes,if mapIds and zoneIds do not help, the map's texture name helps. Dunno which API function returned that one but perhaps it contains an string identifer then that you could use.
I think LibZone got an API function to return that.

I tried:

Code:

        local mapID = GetCurrentMapId()
        local tileFilename = ""
        for tileIndex = 1, 5 do
                tileFilename = GetMapTileTextureForMapId(mapID, tileIndex) or "NONE"
                d(string.format("tileIndex: %d, tileFileName: %s", tileIndex, tileFilename))
        end

And it returns the same thing on either side of the base door:

tileIndex: 1, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_0.dds
tileIndex: 2, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_1.dds
tileIndex: 3, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_2.dds
tileIndex: 4, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_3.dds
tileIndex: 5, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_4.dds

Baertram 07/01/23 05:59 AM

Okay, looks like the game is not differentiating it then :( Only way to find out then is maybe mapId + player position on it if mapId is a special one. If for example mapId = IC district mapId 1 and the position on x or y axis is above a value, then you are in the base. But if the pos. values are below a value, you are outside the base next to the door.

Else I don't know what could be used here if there is not other API returning some "IsInBase" stuff.

Other idea as event trackes do that: Could you maybe check for the mapPins of the base vendor's that do not show outside of the bases?

Toirealach 07/01/23 01:28 PM

Quote:

Originally Posted by Baertram (Post 48059)
Okay, looks like the game is not differentiating it then :( Only way to find out then is maybe mapId + player position on it if mapId is a special one. If for example mapId = IC district mapId 1 and the position on x or y axis is above a value, then you are in the base. But if the pos. values are below a value, you are outside the base next to the door.

Else I don't know what could be used here if there is not other API returning some "IsInBase" stuff.

Other idea as event trackes do that: Could you maybe check for the mapPins of the base vendor's that do not show outside of the bases?

Yes, thanks for the suggestions. I was going to walk around each base and calculate distances and vectors from things like dungeon entrances near the bases to estimate that the player is likely inside the base.

sirinsidiator 07/02/23 06:06 AM

You could try using GetUnitRawWorldPosition to determine if the player is inside the bounding box of a base. Unlike regular map or world coordinates it gives you the "real" position inside 3d space of the loaded world data.
The bases are not really behind the doors you see when you enter, but somewhere a bit further away, so it should be possible to find 2 points that surround the base, but won't overlap with the area outside of it.

Then you can just run the check as needed, or if you want to have a callback, you should be able to use EVENT_PLAYER_ACTIVATED for most entrances and for the ones that do not have a loading screen it should be enough to listen to the invulnerability buff being added (I believe it is also added when you leave the base?).

Toirealach 07/02/23 03:41 PM

Quote:

Originally Posted by sirinsidiator (Post 48063)
You could try using GetUnitRawWorldPosition to determine if the player is inside the bounding box of a base. Unlike regular map or world coordinates it gives you the "real" position inside 3d space of the loaded world data.
The bases are not really behind the doors you see when you enter, but somewhere a bit further away, so it should be possible to find 2 points that surround the base, but won't overlap with the area outside of it.

Then you can just run the check as needed, or if you want to have a callback, you should be able to use EVENT_PLAYER_ACTIVATED for most entrances and for the ones that do not have a loading screen it should be enough to listen to the invulnerability buff being added (I believe it is also added when you leave the base?).

This is a fantastic suggestion! I'll give it a try this coming week! Thank you!

Toirealach 07/04/23 02:32 PM

Quote:

Originally Posted by Toirealach (Post 48068)
This is a fantastic suggestion! I'll give it a try this coming week! Thank you!

Hey just to let you know, I worked out some coordinates for the bases using your suggestion and it works great! Thanks!


All times are GMT -6. The time now is 04:49 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI