Hello There, Guest! Login Register


Random scripts [Single/Multiple Trainer]
#1
I've wanted to share a couple scripts that, I don't know if they have been posted already but a couple were modified with the base script.

Note: All the scripts were just modified in a few things but the base script belong to their rightful creators.

All of them were tested after being modified to make sure that they work properly.

Personally, I highly suggest the ones for route 28 and Mt. Silver 1F since there can farm a lot of money with multiple Pokemon, as far as I've seen.




This one is for the Route 28, to the right of Mt. Silver exterior, it is for multiple Pokemon (I mean, that it can swap the Pokemon if it runs out of PP or is killed)
-- Copyright © 2016 Silv3r <silv3r@openmailbox.org>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.

name = "Leveling: Victory Road (near Indigo Plateau)"
author = "Silv3r"
description = [[This script will train all the pokémons of your team.
It will also try to capture shinies by throwing pokéballs.
Start anywhere Mt. Silver Exterior or Mt. silver Pokecenter.]]

function onStart()
    shinyCounter = 0
    wildCounter = 0
    pokecenterCounter = 0
end

function onBattleMessage(wild)
    if stringContains(wild, "A Wild SHINY ") then
        shinyCounter = shinyCounter + 1
        wildCounter = wildCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
    elseif stringContains(wild, "A Wild ") then
        wildCounter = wildCounter + 1
        log("Info | Shineys encountered: " .. shinyCounter)
        log("Info | Pokemon encountered: " .. wildCounter)
    end
end

function onDialogMessage(pokecenter)
    if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
        pokecenterCounter = pokecenterCounter + 1
        log("Info | Times in Pokecenter: " .. pokecenterCounter)
    end
end

function onPause()
    log("Info | Shineys encountered: " .. shinyCounter)
    log("Info | Pokemon encountered: " .. wildCounter)
    log("Info | Times in Pokecenter: " .. pokecenterCounter)
end

function IsSorted()
    if getTeamSize() == 1 then
        return true
    elseif getTeamSize() == 2 then
        if getPokemonLevel(1) <= getPokemonLevel(2) then
            return true
        else
            return false
        end
    elseif getTeamSize() == 3 then
        if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) then
            return true
        else
            return false
        end
    elseif getTeamSize() == 4 then
        if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) then
            return true
        else
            return false
        end
    elseif getTeamSize() == 5 then
        if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) then
            return true
        else
            return false
        end
    elseif getTeamSize() == 6 then
        if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) and getPokemonLevel(5) <= getPokemonLevel(6) then
            return true
        else
            return false
        end
    end
end

function sortTeamByUsablePokemon()
    if getTeamSize() == 1 then
        return
    elseif getTeamSize() == 2 then
        if not isPokemonUsable(1) then
            if isPokemonUsable(2) then
                return swapPokemon(1, 2)
            end
        end
    elseif getTeamSize() == 3 then
        if not isPokemonUsable(1) then
            if isPokemonUsable(2) then
                return swapPokemon(1, 2)
            elseif isPokemonUsable(3) then
                return swapPokemon(1, 3)
            end
        end
    elseif getTeamSize() == 4 then
        if not isPokemonUsable(1) then
            if isPokemonUsable(2) then
                return swapPokemon(1, 2)
            elseif isPokemonUsable(3) then
                return swapPokemon(1, 3)
            elseif isPokemonUsable(4) then
                return swapPokemon(1, 4)
            end
        end
    elseif getTeamSize() == 5 then
        if not isPokemonUsable(1) then
            if isPokemonUsable(2) then
                return swapPokemon(1, 2)
            elseif isPokemonUsable(3) then
                return swapPokemon(1, 3)
            elseif isPokemonUsable(4) then
                return swapPokemon(1, 4)
            elseif isPokemonUsable(5) then
                return swapPokemon(1, 5)
            end
        end
    elseif getTeamSize() == 6 then
        if not isPokemonUsable(1) then
            if isPokemonUsable(2) then
                return swapPokemon(1, 2)
            elseif isPokemonUsable(3) then
                return swapPokemon(1, 3)
            elseif isPokemonUsable(4) then
                return swapPokemon(1, 4)
            elseif isPokemonUsable(5) then
                return swapPokemon(1, 5)
            elseif isPokemonUsable(6) then
                return swapPokemon(1,6)
            end
        end
    end
end
    
function getTotalUsablePokemonCount()
    local count = 0
    for pokemonId = 1, getTeamSize(), 1 do
        if isPokemonUsable(pokemonId) then
            count = count + 1
        end
    end
    return count
end

function onPathAction()
    if getTotalUsablePokemonCount() ~= 1 then
        goHunt()
    else
        goPC()
    end
end

function goHunt()
        if not isPokemonUsable(1) then
            sortTeamByUsablePokemon()
        elseif getMapName() == "Mt. Silver Pokecenter" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Route 28")
        elseif getMapName() == "Route 28" then
            moveToGrass()
end
end

function goPC()
        if not IsSorted() then
            sortTeamByLevelAscending()
        elseif getMapName() == "Route 28" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Mt. Silver Pokecenter")
        elseif getMapName() == "Mt. Silver Pokecenter" then
            usePokecenter()
        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 getTotalUsablePokemonCount() == 1 then
        return run() or sendUsablePokemon() or sendAnyPokemon()
    else
        return attack() or sendUsablePokemon() or run()
    end
end


This is to train only the first Pokemon on your team at Route 28.
name = ">Vermilion City<"
author = "CaptWAR"
description = "Leveling Script"

function onPathAction()
   if isPokemonUsable(1) then
       if getMapName() == "Mt. Silver Pokecenter" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Route 28")
        elseif getMapName() == "Route 28" then
            moveToGrass()

       end
   else
       if getMapName() == "Route 28" then
            moveToMap("Mt. Silver Exterior")
        elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Mt. Silver Pokecenter")
        elseif getMapName() == "Mt. Silver Pokecenter" then
            usePokecenter()
       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()
   end
end




This is for Digglet Cave, also for multiple Pokemon, there was one but for a single Pokemon, this one is for multiple as well.

-- Copyright © 2016 Silv3r <silv3r@openmailbox.org>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.

name = "Leveling: Victory Road (near Indigo Plateau)"
author = "Silv3r"
description = [[This script will train all the pokémons of your team.
It will also try to capture shinies by throwing pokéballs.
Start anywhere between the exit of the Victory Road and the Indigo Plateau.]]

function onStart()
   shinyCounter = 0
   wildCounter = 0
   pokecenterCounter = 0
end

function onBattleMessage(wild)
   if stringContains(wild, "A Wild SHINY ") then
       shinyCounter = shinyCounter + 1
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   elseif stringContains(wild, "A Wild ") then
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   end
end

function onDialogMessage(pokecenter)
   if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
       pokecenterCounter = pokecenterCounter + 1
       log("Info | Times in Pokecenter: " .. pokecenterCounter)
   end
end

function onPause()
   log("Info | Shineys encountered: " .. shinyCounter)
   log("Info | Pokemon encountered: " .. wildCounter)
   log("Info | Times in Pokecenter: " .. pokecenterCounter)
end

function IsSorted()
   if getTeamSize() == 1 then
       return true
   elseif getTeamSize() == 2 then
       if getPokemonLevel(1) <= getPokemonLevel(2) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 3 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 4 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 5 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 6 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) and getPokemonLevel(5) <= getPokemonLevel(6) then
           return true
       else
           return false
       end
   end
end

function sortTeamByUsablePokemon()
   if getTeamSize() == 1 then
       return
   elseif getTeamSize() == 2 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           end
       end
   elseif getTeamSize() == 3 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           end
       end
   elseif getTeamSize() == 4 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           end
       end
   elseif getTeamSize() == 5 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           end
       end
   elseif getTeamSize() == 6 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           elseif isPokemonUsable(6) then
               return swapPokemon(1,6)
           end
       end
   end
end
   
function getTotalUsablePokemonCount()
   local count = 0
   for pokemonId = 1, getTeamSize(), 1 do
       if isPokemonUsable(pokemonId) then
           count = count + 1
       end
   end
   return count
end

function onPathAction()
   if getTotalUsablePokemonCount() ~= 1 then
       goHunt()
   else
       goPC()
   end
end

function goHunt()
       if not isPokemonUsable(1) then
           sortTeamByUsablePokemon()
       elseif getMapName() == "Pokecenter Vermilion" then
           moveToMap("Vermilion City")
       elseif getMapName() == "Vermilion City" then
           moveToMap("Route 11")
       elseif getMapName() == "Route 11" then
           moveToMap("Digletts Cave Entrance 2")
       elseif getMapName() == "Digletts Cave Entrance 2" then
           moveToRectangle(18, 23, 23, 26)
end
end

function goPC()
       if not IsSorted() then
           sortTeamByLevelAscending()
       elseif getMapName() == "Digletts Cave Entrance 2" then
           moveToMap("Route 11")
       elseif getMapName() == "Route 11" then
           moveToMap("Vermilion City")
       elseif getMapName() == "Vermilion City" then
           moveToMap("Pokecenter Vermilion")
       elseif getMapName() == "Pokecenter Vermilion" then
           usePokecenter()
       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 getTotalUsablePokemonCount() == 1 then
       return run() or sendUsablePokemon() or sendAnyPokemon()
   else
       return attack() or sendUsablePokemon() or run()
   end
end



This one is for the water part, right next to the left just entering Mt. Silver 1, requires at least 1 Pokemon with surf in team. This one is very useful to train Grass and Electric types. As well, for multiple Pokemon.

-- Copyright © 2016 Silv3r <silv3r@openmailbox.org>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.

name = "Leveling: Victory Road (near Indigo Plateau)"
author = "Silv3r"
description = [[This script will train all the pokémons of your team.
It will also try to capture shinies by throwing pokéballs.
Start anywhere between the exit of the Victory Road and the Indigo Plateau.]]

function onStart()
   shinyCounter = 0
   wildCounter = 0
   pokecenterCounter = 0
end

function onBattleMessage(wild)
   if stringContains(wild, "A Wild SHINY ") then
       shinyCounter = shinyCounter + 1
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   elseif stringContains(wild, "A Wild ") then
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   end
end

function onDialogMessage(pokecenter)
   if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
       pokecenterCounter = pokecenterCounter + 1
       log("Info | Times in Pokecenter: " .. pokecenterCounter)
   end
end

function onPause()
   log("Info | Shineys encountered: " .. shinyCounter)
   log("Info | Pokemon encountered: " .. wildCounter)
   log("Info | Times in Pokecenter: " .. pokecenterCounter)
end

function IsSorted()
   if getTeamSize() == 1 then
       return true
   elseif getTeamSize() == 2 then
       if getPokemonLevel(1) <= getPokemonLevel(2) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 3 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 4 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 5 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 6 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) and getPokemonLevel(5) <= getPokemonLevel(6) then
           return true
       else
           return false
       end
   end
end

function sortTeamByUsablePokemon()
   if getTeamSize() == 1 then
       return
   elseif getTeamSize() == 2 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           end
       end
   elseif getTeamSize() == 3 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           end
       end
   elseif getTeamSize() == 4 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           end
       end
   elseif getTeamSize() == 5 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           end
       end
   elseif getTeamSize() == 6 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           elseif isPokemonUsable(6) then
               return swapPokemon(1,6)
           end
       end
   end
end
   
function getTotalUsablePokemonCount()
   local count = 0
   for pokemonId = 1, getTeamSize(), 1 do
       if isPokemonUsable(pokemonId) then
           count = count + 1
       end
   end
   return count
end

function onPathAction()
   if getTotalUsablePokemonCount() ~= 1 then
       goHunt()
   else
       goPC()
   end
end

function goHunt()
       if not isPokemonUsable(1) then
           sortTeamByUsablePokemon()
       elseif getMapName() == "Mt. Silver Pokecenter" then
           moveToMap("Mt. Silver Exterior")
       elseif getMapName() == "Mt. Silver Exterior" then
            moveToMap("Mt. Silver 1F")
           elseif getMapName() == "Mt. Silver 1F" then
                   moveToWater()
       end
end

function goPC()
       if not IsSorted() then
           sortTeamByLevelAscending()
       elseif getMapName() == "Mt. Silver 1F" then
           moveToMap("Mt. Silver Exterior")
       elseif getMapName() == "Mt. Silver Exterior" then
           moveToMap("Mt. Silver Pokecenter")
            elseif getMapName() == "Mt. Silver Pokecenter" then
               usePokecenter()
       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 getTotalUsablePokemonCount() == 1 then
       return run() or sendUsablePokemon() or sendAnyPokemon()
   else
       return attack() or sendUsablePokemon() or run()
   end
end


This one is for the water part but only trains the first Pokemon in your team, still requires 1 Pokemon with surf. The base of this script was the one for Digglet Cave.

name = ">Vermilion City<"
author = "CaptWAR"
description = "Leveling Script"

function onPathAction()
   if isPokemonUsable(1) then
       if getMapName() == "Mt. Silver Pokecenter" then
           moveToMap("Mt. Silver Exterior")
       elseif getMapName() == "Mt. Silver Exterior" then
           moveToMap("Mt. Silver 1F")
       elseif getMapName() == "Mt. Silver 1F" then
           moveToWater()

       end
   else
       if getMapName() == "Mt. Silver 1F" then
           moveToMap("Mt. Silver Exterior")
       elseif getMapName() == "Mt. Silver Exterior" then
           moveToMap("Mt. Silver Pokecenter")
       elseif getMapName() == "Mt. Silver Pokecenter" then
           usePokecenter()
       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()
   end
end



This one is for Digglet Cave but using multiple Pokemon.
-- Copyright © 2016 Silv3r <silv3r@openmailbox.org>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.

name = "Leveling: Victory Road (near Indigo Plateau)"
author = "Silv3r"
description = [[This script will train all the pokémons of your team.
It will also try to capture shinies by throwing pokéballs.
Start anywhere between the exit of the Victory Road and the Indigo Plateau.]]

function onStart()
   shinyCounter = 0
   wildCounter = 0
   pokecenterCounter = 0
end

function onBattleMessage(wild)
   if stringContains(wild, "A Wild SHINY ") then
       shinyCounter = shinyCounter + 1
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   elseif stringContains(wild, "A Wild ") then
       wildCounter = wildCounter + 1
       log("Info | Shineys encountered: " .. shinyCounter)
       log("Info | Pokemon encountered: " .. wildCounter)
   end
end

function onDialogMessage(pokecenter)
   if stringContains(pokecenter, "Would you like me to heal your Pokemon?") then
       pokecenterCounter = pokecenterCounter + 1
       log("Info | Times in Pokecenter: " .. pokecenterCounter)
   end
end

function onPause()
   log("Info | Shineys encountered: " .. shinyCounter)
   log("Info | Pokemon encountered: " .. wildCounter)
   log("Info | Times in Pokecenter: " .. pokecenterCounter)
end

function IsSorted()
   if getTeamSize() == 1 then
       return true
   elseif getTeamSize() == 2 then
       if getPokemonLevel(1) <= getPokemonLevel(2) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 3 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 4 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 5 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) then
           return true
       else
           return false
       end
   elseif getTeamSize() == 6 then
       if getPokemonLevel(1) <= getPokemonLevel(2) and getPokemonLevel(2) <= getPokemonLevel(3) and getPokemonLevel(3) <= getPokemonLevel(4) and getPokemonLevel(4) <= getPokemonLevel(5) and getPokemonLevel(5) <= getPokemonLevel(6) then
           return true
       else
           return false
       end
   end
end

function sortTeamByUsablePokemon()
   if getTeamSize() == 1 then
       return
   elseif getTeamSize() == 2 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           end
       end
   elseif getTeamSize() == 3 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           end
       end
   elseif getTeamSize() == 4 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           end
       end
   elseif getTeamSize() == 5 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           end
       end
   elseif getTeamSize() == 6 then
       if not isPokemonUsable(1) then
           if isPokemonUsable(2) then
               return swapPokemon(1, 2)
           elseif isPokemonUsable(3) then
               return swapPokemon(1, 3)
           elseif isPokemonUsable(4) then
               return swapPokemon(1, 4)
           elseif isPokemonUsable(5) then
               return swapPokemon(1, 5)
           elseif isPokemonUsable(6) then
               return swapPokemon(1,6)
           end
       end
   end
end
   
function getTotalUsablePokemonCount()
   local count = 0
   for pokemonId = 1, getTeamSize(), 1 do
       if isPokemonUsable(pokemonId) then
           count = count + 1
       end
   end
   return count
end

function onPathAction()
   if getTotalUsablePokemonCount() ~= 1 then
       goHunt()
   else
       goPC()
   end
end

function goHunt()
       if not isPokemonUsable(1) then
           sortTeamByUsablePokemon()
       elseif getMapName() == "Pokecenter Vermilion" then
           moveToMap("Vermilion City")
       elseif getMapName() == "Vermilion City" then
           moveToMap("Route 11")
       elseif getMapName() == "Route 11" then
           moveToMap("Digletts Cave Entrance 2")
       elseif getMapName() == "Digletts Cave Entrance 2" then
           moveToRectangle(18, 23, 23, 26)
end
end

function goPC()
       if not IsSorted() then
           sortTeamByLevelAscending()
       elseif getMapName() == "Digletts Cave Entrance 2" then
           moveToMap("Route 11")
       elseif getMapName() == "Route 11" then
           moveToMap("Vermilion City")
       elseif getMapName() == "Vermilion City" then
           moveToMap("Pokecenter Vermilion")
       elseif getMapName() == "Pokecenter Vermilion" then
           usePokecenter()
       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 getTotalUsablePokemonCount() == 1 then
       return run() or sendUsablePokemon() or sendAnyPokemon()
   else
       return attack() or sendUsablePokemon() or run()
   end
end
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)