Hello There, Guest! Login Register


Victory Road Leveling Script (Help)
#1
Hello, can anyone help? I edit this script, but after the first 3 Pokemon die, and the character leaves the "Victory Road Kanto 3F" location, he sees no further action and stops the bot. How can i fix this?

name = "Victory Road"
author = "Gandalf"
description = [[Start anywhere between the exit of the Victory Road and the Indigo Plateau.]]

function onPathAction()
   if not (isPokemonUsable(1)) and isPokemonUsable(2)   then
           swapPokemon(1,2)
   elseif not (isPokemonUsable(1)) and isPokemonUsable(3) then
           swapPokemon(1,3)
   elseif isPokemonUsable(1)or isPokemonUsable(2)or isPokemonUsable(3) then
       
       if getMapName() == "Indigo Plateau Center" then
           moveToCell(10, 28)
       elseif getMapName() == "Indigo Plateau" then
           moveToCell(21, 31)
       elseif getMapName() == "Victory Road Kanto 3F" then
           moveToRectangle(20, 29, 25, 35)
       end
   else
       if getMapName() == "Victory Road Kanto 3F" then
           moveToCell(46, 13)
       elseif getMapName() == "Indigo Plateau" then
           moveToCell(33, 12)
       elseif getMapName() == "Indigo Plateau Center" then
           talkToNpcOnCell(4, 22)
       end
   end
end

function onBattleAction()
   if isWildBattle() and isOpponentShiny() then
       if useItem("Ultra Ball") or useItem("Great Ball") or useItem("Pokeball") then
           return
       end
   end
   if getActivePokemonNumber() == 1 then
       return attack() or sendUsablePokemon() or run() or sendAnyPokemon()
   else
       return run() or attack() or sendUsablePokemon() or sendAnyPokemon()
   end
end
 
Reply
#2
I modified your code as follows, hope it can help you

function onPathAction()
first_usable=0
for i=1,3 do
if first_usable<1 and isPokemonUsable(i) then
first_usable=i
break
end
end
if first_usable==1 then
"Go to Fight!"
elseif first_usable>1 then
swapPokemon(1,first_usable)
else
"Go to Pokecenter"
end
end
 
Reply
#3
I'm sorry that I take your time, I just started editing scripts yesterday, and I do not understand much about it.
Now when adding your lines to the code, I get the following message:

[14:34:07] Could not load script Victory Road Complete.lua:
chunk_1: (14,9-23): unexpected symbol near 'Go to Fight!'

I tried to insert these lines in different ways but the result is one.
 
Reply
#4
My strings, "Go to Fight!", "Go to Pokecenter", are not real code that can be run.
I means you should replace your code into these palces

function onPathAction()
first_usable=0
for i=1,3 do
if first_usable<1 and isPokemonUsable(i) then
first_usable=i
break
end
end
if first_usable==1 then
if getMapName() == "Indigo Plateau Center" then
moveToCell(10, 28)
elseif getMapName() == "Indigo Plateau" then
moveToCell(21, 31)
elseif getMapName() == "Victory Road Kanto 3F" then
moveToRectangle(20, 29, 25, 35)
end
elseif first_usable>1 then
swapPokemon(1,first_usable)
else
if getMapName() == "Victory Road Kanto 3F" then
moveToCell(46, 13)
elseif getMapName() == "Indigo Plateau" then
moveToCell(33, 12)
elseif getMapName() == "Indigo Plateau Center" then
UsePokecenter()
end
end
end
 
Reply
#5
I replaced, everything works fine, but after leaving Victory Road Kanto 3F, instead of going to the pokercenter, he stands still and stops.

[14:53:15] Position updated: Indigo Plateau (21, 30) [OK]
[14:53:22] No action executed: stopping the bot.
[14:53:22] Bot stopped
 
Reply
#6
check the name of the map after the leaving Victory Road Kanto 3F.
there may be mistakes in the name in your code

I have read your logs, It looks fine.
I'm sorry that I don't know why

maybe you can add "print(getMapName() )" before "if getMapName() == "Victory Road Kanto 3F" then" to debug
 
Reply
#7
Okay, thanks, i try it
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)