Hello There, Guest! Login Register


PLS HELP ON MY SCRIPT
#1
Why does my script works but when i got to b2f of vr it errors and says : Error during the script execution: chunk_1Sad19,23-31): attempt to call a nil value


description = [[This script will hunt aron and level your pokemon at Ever Grande City]]


function onPathAction()


    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Ever Grande City" then
            moveToMap("Ever Grande City")
        elseif getMapName() == "Ever Grande City" then
            moveToMap("Victory Road Hoenn 1F")
        elseif getMapName() == "Victory Road Hoenn 1F" then
            moveToMap("Victory Road Hoenn B1F")
elseif getMapName() == "Victory Road Hoenn B1F" then
            moveToMap("Victory Road Hoenn B2F") 
        elseif getMapName() == "Victory Road Hoenn B2F" then
        moveToRectange(41, 39, 46, 40)
        end
    else
       if getMapName() == "Victory Road Hoenn B2F" then
            moveToMap("Victory Road Hoenn B1F")
       elseif getMapName() == "Victory Road Hoenn B1F" then
            moveToMap("Victory Road Hoenn 1F")
       elseif getMapName() == "Victory Road Hoenn 1F" then
            moveToMap("Ever Grande City")
       elseif getMapName() == "Ever Grande City" then
            moveToMap("Pokecenter Ever Grande City")
       elseif getMapName() == "Pokecenter Ever Grande City" then
            usePokecenter()
        end
    end
end


function startBattle()

    if getActivePokemonNumber() == 1 then
                 return sendPokemon(2)
             elseif ( getActivePokemonNumber() == 2 ) and ( getOpponentHealth() > 1 ) then
                 return weakAttack()
             elseif ( getOpponentHealth() == 1 ) then
                 return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball") or sendAnyPokemon()
             end
end


function onBattleAction()

      if isWildBattle() and ( getOpponentName() == "Aron" ) then 
         startBattle()
      else
         run()
      end
end
 
Reply
#2
(2018-04-16, 12:43:12)jofie123 Why does my script works but when i got to b2f of vr it errors and says : Error during the script execution: chunk_1Sad19,23-31): attempt to call a nil value


description = [[This script will hunt aron and level your pokemon at Ever Grande City]]


function onPathAction()


    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Ever Grande City" then
            moveToMap("Ever Grande City")
        elseif getMapName() == "Ever Grande City" then
            moveToMap("Victory Road Hoenn 1F")
        elseif getMapName() == "Victory Road Hoenn 1F" then
            moveToMap("Victory Road Hoenn B1F")
elseif getMapName() == "Victory Road Hoenn B1F" then
            moveToMap("Victory Road Hoenn B2F") 
        elseif getMapName() == "Victory Road Hoenn B2F" then
        moveToRectange(41, 39, 46, 40)
        end
    else
       if getMapName() == "Victory Road Hoenn B2F" then
            moveToMap("Victory Road Hoenn B1F")
       elseif getMapName() == "Victory Road Hoenn B1F" then
            moveToMap("Victory Road Hoenn 1F")
       elseif getMapName() == "Victory Road Hoenn 1F" then
            moveToMap("Ever Grande City")
       elseif getMapName() == "Ever Grande City" then
            moveToMap("Pokecenter Ever Grande City")
       elseif getMapName() == "Pokecenter Ever Grande City" then
            usePokecenter()
        end
    end
end


function startBattle()

    if getActivePokemonNumber() == 1 then
                 return sendPokemon(2)
             elseif ( getActivePokemonNumber() == 2 ) and ( getOpponentHealth() > 1 ) then
                 return weakAttack()
             elseif ( getOpponentHealth() == 1 ) then
                 return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball") or sendAnyPokemon()
             end
end


function onBattleAction()

      if isWildBattle() and ( getOpponentName() == "Aron" ) then 
         startBattle()
      else
         run()
      end
end
Im not sure, but i haven't actually uploaded the script but maybe in the "moveToRectange(41, 39, 46, 40)". Its possible those coordinates dont exist. like i said i dont really know but its worth a try.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)