Hello There, Guest! Login Register


Easy fix for maps named "Link"
#1
Lots of map links have been renamed to "Link" so I thought I'd put together a small tutorial on how to deal with that.

In the traditional way to write logic for moving between maps, you might write something like this:


function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Pewter" then
            moveToMap("Pewter City")
        elseif getMapName() == "Pewter City" then
            moveToMap("Route 3")
        elseif getMapName() == "Route 3" then
            moveToGrass()
        end
    else
        if getMapName() == "Route 3" then
            moveToMap("Pewter City")
        elseif getMapName() == "Pewter City" then
            moveToMap("Pokecenter Pewter")
        elseif getMapName() == "Pokecenter Pewter" then
            usePokecenter()
        end
    end
end


This looks fine and it would have worked in the past, but now, for whatever reason, the link from Pewter City to Route 3 is labeled as "Link".

You might think that what you need to do is call `moveToMap("Link")`, but that's not a good idea for one reason: if there's more than one link on the same map labeled as "Link", it could very easily fail and move to the wrong map.

The solution to this is very simple. All you need to do is hover over the cell that the link is on, and look at the (x,y) coordinate of that cell.


[Image: 4OidtdNaRhGo3TmuiL4jcA.png]


Then you can plug that data into your script, replacing 'moveToMap("Route 3")' with 'moveToCell(65, 33)'

function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Pewter" then
            moveToMap("Pewter City")
        elseif getMapName() == "Pewter City" then
            moveToCell(65, 33)
        elseif getMapName() == "Route 3" then
            moveToGrass()
        end
    else
        if getMapName() == "Route 3" then
            moveToMap("Pewter City")
        elseif getMapName() == "Pewter City" then
            moveToMap("Pokecenter Pewter")
        elseif getMapName() == "Pokecenter Pewter" then
            usePokecenter()
        end
    end
end


Those interested in helping me put together data that Pathfinder can use read below:
Show ContentSpoiler:
 
Reply
#2
much appreciate that guide, ty!
 
Reply
#3
(2017-09-06, 06:48:33)Savage eMan much appreciate that guide to sustanon 250 ty!

What an elegant solution. Thanks for the effort and sharing Zonz.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)