Thread Tools Display Modes
09-07-16, 11:08 AM   #1
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Question 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:



  Reply With Quote
09-07-16, 07:59 PM   #2
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
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;
  Reply With Quote
09-10-16, 08:42 PM   #3
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Originally Posted by elcius View Post
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
  Reply With Quote
09-10-16, 09:44 PM   #4
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
GetCurrentMapZone()
  Reply With Quote
09-11-16, 02:00 PM   #5
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Originally Posted by elcius View Post
GetCurrentMapZone()
Thank you!
  Reply With Quote
09-14-16, 06:09 PM   #6
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Originally Posted by elcius View Post
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:

print(GetCurrentMapDungeonLevel())
print(GetNumDungeonMapLevels() )
print(GetMapInfo())
10, 4050.080078125, -1132.0799560547, 4873.330078125, -583.24401855469
4, 10, 11, 12
Dalaran70, 668, 778, false

Last edited by Oniya : 09-14-16 at 06:44 PM.
  Reply With Quote
09-14-16, 11:49 PM   #7
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
woops,
Code:
local worldx, worldy = x2+(x1-x2)*px, y2+(y1-y2)*py;
is correct, i forgot they put the top-left offset 2nd.
  Reply With Quote
10-23-16, 10:28 AM   #8
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Originally Posted by elcius View Post
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!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » New Dalaran GetWorldLocFromMapPos not working

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off