PHP Code:
name = "Route 117"
author = "whitemane"
description = [[Start anywhere between the exit of the Route 117 and the Pokecenter Mauville City.]]
movesNotToForget = { "" } --add moves here
mounts= { "" } --add color+bicycle here
rectanglesCount = 4
rectangles = {
{89, 41, 94, 42}, -- bottom-right 1
{65, 34, 69, 35}, -- middle 1
{64, 37, 70, 38}, -- middle 2
{87, 43, 92, 44} -- bottom-right 2
}
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 Mauville City" then
moveToCell(7, 22)
elseif getMapName() == "Mauville City" then
moveToCell(2, 18)
elseif getMapName() == "Mauville City Stop House 2" then
moveToCell(0, 7)
elseif getMapName() == "Route 117" then
moveToRectangle(
rectangles[selectedRectangle][1],
rectangles[selectedRectangle][2],
rectangles[selectedRectangle][3],
rectangles[selectedRectangle][4]
)
end
else
if getMapName() == "Route 117" then
moveToCell(101, 33)
elseif getMapName() == "Mauville City Stop House 2" then
moveToCell(10, 6)
elseif getMapName() == "Mauville City" then
moveToCell(28, 13)
elseif getMapName() == "Pokecenter Mauville City" 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 sendUsablePokemon() or run() 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