2019-03-19, 15:44:35
PHP Code:
name = "Leveling in Sky Pillar 1F"
author = "whtmn"
description = "Leveling in Sky Pillar 1F, Start anywhere between Sky Pillar 1F and Pokecenter Pacifidlog Town."
movesNotToForget ={""} --add moves here
mounts= { ""}
rectanglesCount = 4
rectangles = {
{1, 10, 6, 11},
{1, 13, 5, 13},
{8, 10, 14, 10},
{6, 5, 9, 6}
}
selectedRectangle = 0
function onStart()
selectRandomRectangle()
for _, mountName in ipairs(mounts) do
if hasItem(mountName) then
setMount(mountName)
break
end
end
end
function onPathAction()
if isPokemonUsable(1) then
if getMapName() == "Pokecenter Pacifidlog Town" then
moveToCell(8, 22)
elseif getMapName() == "Pacifidlog Town" then
moveToCell(40, 15)
elseif getMapName() == "Route 131" then
moveToCell(41, 1)
elseif getMapName() == "Sky Pillar Entrance" then
if getPlayerY() > 32 then
moveToCell(26, 32)
else
moveToCell(27, 6)
end
elseif getMapName() == "Sky Pillar Entrance Cave 1F" then
moveToCell(17, 6)
elseif getMapName() == "Sky Pillar 1F" then
moveToRectangle(
rectangles[selectedRectangle][1],
rectangles[selectedRectangle][2],
rectangles[selectedRectangle][3],
rectangles[selectedRectangle][4]
)
end
else
if getMapName() == "Sky Pillar 1F" then
moveToCell(8, 13)
elseif getMapName() == "Sky Pillar Entrance" then
if getPlayerY() < 8 then
moveToCell(35, 23)
else
moveToCell(27, 49)
end
elseif getMapName() == "Sky Pillar Entrance Cave 1F" then
moveToCell(7, 17)
elseif getMapName() == "Route 131" then
moveToCell(0, 30)
elseif getMapName() == "Pacifidlog Town" then
moveToCell(19, 12)
elseif getMapName() == "Pokecenter Pacifidlog Town" then
talkToNpcOnCell(8, 14)
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 run() or sendUsablePokemon() or sendAnyPokemon()
else
return run() or attack() or sendUsablePokemon() or sendAnyPokemon()
end
end
function onLearningMove(moveName, pokemonIndex)
forgetAnyMoveExcept(movesNotToForget)
end
function onBattleMessage(message)
-- Switch rectangle after each battle.
if stringContains(message, "you have won") then
selectRandomRectangle()
end
end
function selectRandomRectangle()
selectedRectangle = math.random(1, rectanglesCount)
log("Using rectangle " .. selectedRectangle .. ".")
end