Hello There, Guest! Login Register


Route 6 SPATK/HP EV Edit
#1
Couldn't find this anywhere so I edited silvers original script to also fight Slowpokes for the HP EV, I use a pikachu so onMoveLearning is setup for that, can change to your need. Figured someone might want it like I did..

-- 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 = "SpAttack EV: Route 6, Water (near Vermilion)"
author = "Silv3r"
description = [[This script will train the first pokémon of your team.
It will only attack pokémon giving special attack EV.
It will also try to capture shinies by throwing pokéballs.
Start anywhere between Vermilion City and Route 6.
You need a pokémon with surf.]]

function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Vermilion" then
            moveToMap("Vermilion City")
        elseif getMapName() == "Vermilion City" then
            moveToMap("Route 6")
        elseif getMapName() == "Route 6" then
            moveToRectangle(15, 35, 30, 41)
        end
    else
        if getMapName() == "Route 6" then
            moveToMap("Vermilion City")
        elseif getMapName() == "Vermilion City" then
            moveToMap("Pokecenter Vermilion")
        elseif getMapName() == "Pokecenter Vermilion" 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 and (isOpponentEffortValue("SpAttack") or isOpponentEffortValue("HP")) then
        return attack() or run() or sendUsablePokemon() or sendAnyPokemon()
    else
        return run() or attack() or sendUsablePokemon() or sendAnyPokemon()
    end
end


function onLearningMove(moveName, pokemonIndex)
  name = getPokemonName(pokemonIndex)
  if name == "Pikachu" then
    return forgetAnyMoveExcept({"Electro Ball", "Discharge", "Thunder", "ThunderShock"})
    end
end
 
Reply
#2
Nice edit!

if getActivePokemonNumber() == 1 and isOpponentEffortValue("SpAttack") or isOpponentEffortValue("HP") then

Be careful about the priority, and has a higher precedence than or. If you encounter an HP opponent with your second pokémon, the condition will be valid and you will attack it.

if getActivePokemonNumber() == 1 and (isOpponentEffortValue("SpAttack") or isOpponentEffortValue("HP")) then

Just use parenthesis to prevent this. Smile
 
Reply
#3
[3:10:24 PM] Disconnected from the server.
[3:12:45 PM] Could not load script Def.lua:
chunk_1Sad15,0): unexpected symbol near '�'
can you help me ?
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)