WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   New Dalaran GetWorldLocFromMapPos not working (https://www.wowinterface.com/forums/showthread.php?t=54421)

Oniya 09-07-16 11:08 AM

New Dalaran GetWorldLocFromMapPos not working
 
Anyone know why that can be or how to fix it?

Lua Code:
  1. local x,y = GetPlayerMapPosition("player")
  2. print(x,y)
  3.  
  4. local _, worldX, worldY = GetWorldLocFromMapPos(GetPlayerMapPosition("player"))
  5.  
  6. print(worldX, worldY)
  7.  
  8. print(GetCurrentMapAreaID())
  9. print(GetMapInfo())

returning:




elcius 09-07-16 07:59 PM

Don't use GetWorldLocFromMapPos, it doesn't work correctly, just calculate the world position manually:
Code:

local f,x1,y1,x2,y2 = GetCurrentMapDungeonLevel();
local px,py = GetPlayerMapPosition("player");
local worldx, worldy = x1+(x2-x1)*px, y1+(y2-y1)*py;


Oniya 09-10-16 08:42 PM

Quote:

Originally Posted by elcius (Post 318800)
Don't use GetWorldLocFromMapPos, it doesn't work correctly, just calculate the world position manually:
Code:

local f,x1,y1,x2,y2 = GetCurrentMapDungeonLevel();
local px,py = GetPlayerMapPosition("player");
local worldx, worldy = x1+(x2-x1)*px, y1+(y2-y1)*py;


Thank you ^^

If we in city or in Open world - what change for GetCurrentMapDungeonLevel()? - as it can return null value for x2,y2

elcius 09-10-16 09:44 PM

GetCurrentMapZone()

Oniya 09-11-16 02:00 PM

Quote:

Originally Posted by elcius (Post 318911)
GetCurrentMapZone()

Thank you!

Oniya 09-14-16 06:09 PM

Quote:

Originally Posted by elcius (Post 318911)
local f,x1,y1,x2,y2 = GetCurrentMapDungeonLevel();
local px,py = GetPlayerMapPosition("player");
local worldx, worldy = x1+(x2-x1)*px, y1+(y2-y1)*py;

For dalaran it seems to be return still slightly wrong coordinates, maybe be we need somehow use f variable (level) in calculation too? As Dalaran - level 3 ?


http://www.wowhead.com/zone=7502/dalaran

Dalaran info:

Quote:

print(GetCurrentMapDungeonLevel())
print(GetNumDungeonMapLevels() )
print(GetMapInfo())
Quote:

10, 4050.080078125, -1132.0799560547, 4873.330078125, -583.24401855469
4, 10, 11, 12
Dalaran70, 668, 778, false

elcius 09-14-16 11:49 PM

woops,
Code:

local worldx, worldy = x2+(x1-x2)*px, y2+(y1-y2)*py;
is correct, i forgot they put the top-left offset 2nd.

Oniya 10-23-16 10:28 AM

Quote:

Originally Posted by elcius (Post 319058)
woops,
Code:

local worldx, worldy = x2+(x1-x2)*px, y2+(y1-y2)*py;
is correct, i forgot they put the top-left offset 2nd.

Will try it out, thank you!


All times are GMT -6. The time now is 06:41 AM.

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