Hello There, Guest! Login Register


Hoenn Safari Farm Help, Code Fix
#1
Would be nice to get this working, most of it is done, but doesnt seem to be executing correctly

name = "Elite Catcher"
author = "Virus"
description = "Safari Farmer, Night And Day, Uses 1st Pokemon"

-- ******** Configuration Section *********

-- Money left when you want the script to Stop

MinMoney = 5000

-- Balls left when you want it to buy more,and how many more you want to buy

MinBalls = 15
BuyBalls = 30


-- ******** End configuration Section *****


function onStart()
    torchicCounter = 0
    houndourCounter = 0
    shinyCounter = 0
    pokecenterCounter = 0

end

function onBattleMessage(wild)
    if wild == "A Wild SHINY " then
        shinyCounter = shinyCounter + 1
    elseif wild == "A Wild [FF9900]Torchic[-] Attacks!" then
        snubullCounter = torchicCounter + 1
    elseif wild == "A Wild [FF9900]Houndour[-] Attacks!" then
        taurosCounter = houndourCounter + 1
    end
end

function onDialogMessage(pokecenter)
    if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
        pokecenterCounter = pokecenterCounter + 1
    end
end

function onPause()
    log("Torchic Counter: " .. torchicCounter)
    log("houndour Counter: " .. houndourCounter)
    log("Shinies Caught: " .. shinyCounter)
    log("Times in Pokecenter: " .. pokecenterCounter)
end

function onBattleAction()
    if (getActivePokemonNumber() == 1) then
        if isWildBattle() and (isOpponentShiny() or getOpponentName()=="Torchic" or getOpponentName()=="Aipom" or getOpponentName()=="Houndour") then
            return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball") or sendUsablePokemon() or run()
        else
            return attack() or sendUsablePokemon() or run()
        end
    else
        return sendUsablePokemon() or run()
    end
end

function onPathAction()

if(getMoney()<MinMoney) then
    
    fatal("You got less money than"..MinMoney.. "shutting down the bot")

elseif ((getItemQuantity("PokeBall") < MinBalls) and (getMapName() != "Hoenn Safari Zone Area 1" and getMapName() != "Hoenn Safari Zone Area 5" and getMapName() != "Hoenn Safari Zone Area 6")) then
        
        if getMapName() == "Hoenn Safari Zone Lobby" then
            moveToMap("Route 121")
        elseif getMapName() == "Route 121" then
            moveToMap("Lilycove City")
        elseif getMapName() == "Lilycove City" then
            moveToMap("LilyCove Department Store 1F")
        elseif getMapName() == "LilyCove Department Store 1F" then
            moveToMap("LilyCove Department Store 2F")
        elseif getMapName() == "LilyCove Department Store 2F" then            
                talkToNpcOnCell(7, 2)
            elseif isShopOpen() then
                    buyItem("PokeBall", BuyBalls)
        end


elseif (not isPokemonUsable(1) and (getMapName() != "Hoenn Safari Zone Area 1" and getMapName() != "Hoenn Safari Zone Area 5" and getMapName() != "Hoenn Safari Zone Area 6")) then    
        if getMapName() == "Hoenn Safari Zone Lobby" then
            moveToMap("Route 121")
        elseif getMapName() == "Route 121" then
            moveToMap("Lilycove City")
        elseif getMapName() == "Lilycove City" then
            moveToMap("Pokecenter Lilycove City")        
        elseif getMapName() == "Pokecenter Lilycove City" then
            usePokecenter()
    end

elseif isPokemonUsable(1) then
        

        if getMapName() == "Pokecenter Lilycove City" then
            moveToMap("Lilycove City")
        elseif getMapName() == "LilyCove Department Store 2F" then
            moveToMap("LilyCove Department Store 1F")
        elseif getMapName() == "LilyCove Department Store 1F" then
            moveToMap("Lilycove City")
        elseif getMapName() == "Lilycove City" then
            moveToMap("Route 121")
        elseif getMapName() == "Route 121" then
            moveToMap("Hoenn Safari Zone Lobby")
        elseif getMapName() == "Hoenn Safari Zone Lobby" then
            talkToNpcOnCell(21,5)

        elseif (isMorning()) then

                if getMapName() == "Hoenn Safari Zone Area 1" then
                        moveToMap("Hoenn Safari Zone Area 5")
                elseif getMapName() == "Hoenn Safari Zone Area 5" then
                        moveToMap("Hoenn Safari Zone Area 6")
                elseif getMapName() == "Hoenn Safari Zone Area 6" then            
                        moveToGrass()
                end

        elseif (isNoon() or isNight()) then

                    if getMapName() == "Hoenn Safari Zone Area 1" then
                        moveToMap("Hoenn Safari Zone Area 5")
                elseif getMapName() == "Hoenn Safari Zone Area 5" then
                        moveToMap("Hoenn Safari Zone Area 6")
                elseif getMapName() == "Hoenn Safari Zone Area 6" then            
                        moveToGrass()
                    end
                end
        end
    end
 
Reply
#2
after some testing , it doesnt seem to want to talk to the npc in Hoenn Safari Zone Lobby, The Coordinates for the npc are correct, but is it maybe because there is a desk between them?
 
Reply
#3
if the desk is the issue, do a simple if statement to only perform talktonpc when you are at the correct cell
e.g.
if getPlayerX()==x and getPlayerY ==y then
talkToNpcOnCell(tx, ty)
else
moveToCell(x,y)
end
penguins
 
Reply
#4
gamer233 if the desk is the issue, do a simple if statement to only perform talktonpc when you are at the correct cell
e.g.
if getPlayerX()==x and getPlayerY ==y then
talkToNpcOnCell(tx, ty)
else
moveToCell(x,y)
end
Doesnt help, still doesnt execute anything, seems that the bot stops when it arrives to the lobby

returns [23:27:39] Bot started
[23:27:40] Bot stuck, sending resynchronization request.
[23:27:40] System: You are no longer AFK!
[23:27:41] Bot still stuck, stopping the script.
[23:27:41] Bot stopped

This is how i added it if youre curious

elseif isPokemonUsable(1) then


if getMapName() == "Pokecenter Lilycove City" then
moveToMap("Lilycove City")
elseif getMapName() == "LilyCove Department Store 2F" then
moveToMap("LilyCove Department Store 1F")
elseif getMapName() == "LilyCove Department Store 1F" then
moveToMap("Lilycove City")
elseif getMapName() == "Lilycove City" then
moveToMap("Route 121")
elseif getMapName() == "Route 121" then
moveToMap("Hoenn Safari Zone Lobby")
elseif getMapName() == ("Hoenn Safari Zone Lobby") then

if getPlayerX() == 21 and getPlayerY == 7 then
talkToNpcOnCell(21, 5)
else
moveToCell(21,7)
end
 
Reply
#5
When talking to a npc between a desk u must use the desk coordinates.
 
Reply
#6
asomeguy When talking to a npc between a desk u must use the desk coordinates.

If do that then it just tells me "No npc found"
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)