Hello There, Guest! Login Register


Universal EV Trainer with Config
#26
At Version 3.4


can i train ATK and Speed at the same time ?
if not, can you update it or give me any advice.

thankyou, redskhie

this is my edited code
config :
  -- Copyright © 2016 redskhie                



    -- Map Configurations

-- Insert/Change the Mapnames of your training route
-- Mapnames is CASE SENSITIVE
-- Leave others blank if unused

pc = "Pokecenter Lavender"
map1 = "Lavender Town"
map2 = ""
map3 = ""
map4 = ""
TrainingMap = "Route 12"



    -- Training Spots
-- Inserting/Changing Options: "Rectangle" , "Grass" , "Water"

TrainingSpot = "Grass"

-- Leave and unchanged if your training in GRASS or WATER
-- You can specify a Rectangle by finding a (upper left corner and lower right corner) or (upper right corner and lower left corner) character cells on PRO Client
    -- It is for the movement of your character
            -- press "F2" and type "/loc" or "/pos"
-- Change the number on what rectangle movement you desired

RectMinX = 1
RectMinY = 1
RectMaxX = 1
RectMaxY = 1



    -- Effort Value

-- Change to what kind of EV training you want to do
-- Options: "atk","speed","defense","spattack","spdefense","hp"    --case sensitive

atk = true
speed = true
defense = false
spattack = false
spdefense = false
hp = false


-- Set/Change the number of EV you needed

atkEVneed = 252
speedEVneed = 252
defenseEVneed = 0
spattackEVneed = 0
spdefenseEVneed = 0
hpEVneed = 6

    --ITEM CONFIG

-- Set/Change the name of the mount you want to use on LAND

mount = "Bicycle"

-- Set/Change to true if you want to use mount,else false

mountSwitch = true

    
-- Set/Change the name of an Item you want to equipp

item = "Macho Brace"

-- Set to "true if you want to give item to Pokemon, else "false"

equipitem = true

-- Set to "true" if you want to remove held item after reaching to EV points you wanted, else "false"

unequipitem = true






    -- Copyright © 2016 redskhie

EV script :
name = "Universal Effort Value Trainer"
author = "redskhie"
description = [[EV Training]]

dofile "config.lua"


function onStart()
    
    startime = os.time()

    shinycount = 0
    pcCount = 0
    wildcount = 0
    startMoney = getMoney()

    attackEv = getPokemonEffortValue(1, "Attack")
    defenseEv = getPokemonEffortValue(1, "Defense")
    speedEv = getPokemonEffortValue(1, "Speed")
    spattackEv = getPokemonEffortValue(1, "Spattack")
    spdefenseEv = getPokemonEffortValue(1, "Spdefense")
    hpEv = getPokemonEffortValue(1, "HP")
    log("-----------------------------------------------------------")
    log("--------- We are now Commencing the Training Routine ---------")
    log("-----------------------------------------------------------")
    log("---------------")
    log("Starting routine at "..TrainingMap.." ~~~ GOODLUCK!")
    log("Training your ~~"..getPokemonName(1).."~~")
    log("---------------")
    log("We will stop until we reach your desired Effort Values ")
    log("---------------")
    log("***"..getPokemonName(1).." EV STATS***")
    log("Attack: "..getPokemonEffortValue(1, "Attack"))
    log("Defense: "..getPokemonEffortValue(1, "Defense"))
    log("Speed: "..getPokemonEffortValue(1, "Speed"))
    log("Special Attack: "..getPokemonEffortValue(1, "Spattack"))
    log("Special Defense: "..getPokemonEffortValue(1, "Spdefense"))
    log("Health Points: "..getPokemonEffortValue(1, "HP"))
    log("---------------")

end

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

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

function onPause()
    
    log("-----------------------------------------------------------")
    log("---------------------- Routine Paused ---------------------")
    log("-----------------------------------------------------------")
    log("***"..getPokemonName(1).." EV STATS***")
    log("--"..getPokemonHeldItem(1).."--")
    log("Attack: "..getPokemonEffortValue(1, "Attack"))
    log("Defense: "..getPokemonEffortValue(1, "Defense"))
    log("Speed: "..getPokemonEffortValue(1, "Speed"))
    log("Special Attack: "..getPokemonEffortValue(1, "Spattack"))
    log("Special Defense: "..getPokemonEffortValue(1, "Spdefense"))
    log("Health Points: "..getPokemonEffortValue(1, "HP"))
    log("---------------")
    log("Info | Shinies encountered: " .. shinycount)
    log("Info | Pokemon encountered: " .. wildcount)
    log("Info | Times in Pokecenter: " .. pcCount)
    log("---------------")
    log("Pokedollars earned: "..tostring(getMoney() - startMoney))
    log("---------------")
    endtime = os.time()
    log(string.format("Bot running time: %.2f", os.difftime(endtime,startime)/3600 ).. " hours")
    log("or")
    log(string.format("Bot running time: %.2f", os.difftime(endtime,startime)/60 ).. " minutes")
    log("---------------")
        
end

function onStop()
    log("-----------------------------------------------------------")
    log("---------------------- Routine Stopped ---------------------")
    log("-----------------------------------------------------------")
    log("***"..getPokemonName(1).." STATS***")
    log("Attack: "..getPokemonEffortValue(1, "Attack"))
    log("Defense: "..getPokemonEffortValue(1, "Defense"))
    log("Speed: "..getPokemonEffortValue(1, "Speed"))
    log("Special Attack: "..getPokemonEffortValue(1, "Spattack"))
    log("Special Defense: "..getPokemonEffortValue(1, "Spdefense"))
    log("Health Points: "..getPokemonEffortValue(1, "HP"))
    log(" ")
    
    endtime = os.time()
    log(string.format("Bot running time: %.2f", os.difftime(endtime,startime)/3600 ).. " hours")
    log("or")
    log(string.format("Bot running time: %.2f", os.difftime(endtime,startime)/60 ).. " minutes")
    log(" ")

end

function ride()
        if mountSwitch then
            if not isOutside() then
                path()
            elseif not isSurfing() then
                if not isMounted() then
                    log("Riding on my pet!!!")
                    useItem(mount)
                elseif isMounted() then
                    path()
                end
            elseif isSurfing() then
                path()
            end
        elseif mountSwitch == false then
            path()
        end
end

function rideheal()
        if mountSwitch then
            if not isOutside() then
                pokecenter()
            elseif not isSurfing() then
                if not isMounted() then
                    log("Riding on my pet!!!")
                    useItem(mount)
                elseif isMounted() then
                    pokecenter()
                end
            elseif isSurfing() then
                pokecenter()
            end
        elseif mountSwitch == false then
            pokecenter()
        end
end

function path()

    if getPokemonHeldItem(1) == item or equipitem == false then
    if getMapName() == pc then
        moveToMap(map1)
    elseif getMapName() == map1 then
        return moveToMap(map2) or moveToMap(TrainingMap)
    elseif getMapName() == map2 then
        return moveToMap(map3) or moveToMap(TrainingMap)
    elseif getMapName() == map3 then
        return moveToMap(map4) or moveToMap(TrainingMap)
       elseif getMapName() == map4 then
        return moveToMap(TrainingMap)
    elseif getMapName() == TrainingMap then
        if TrainingSpot == "Rectangle" then
            moveToRectangle(RectMinX,RectMinY,RectMaxX,RectMaxY)
        elseif TrainingSpot == "Grass" then
            moveToGrass()
        elseif TrainingSpot == "Water" then
            moveToWater()
        end
    end
    end

end

function pokecenter()

        if getMapName() == TrainingMap then    
            return moveToMap(map1) or moveToMap(map2) or moveToMap(map3) or moveToMap(map4) or moveToMap(pc)
        elseif getMapName() == map4 then    
            moveToMap(map3)
        elseif getMapName() == map3 then    
            moveToMap(map2)
        elseif getMapName() == map2 then    
            moveToMap(map1)
        elseif getMapName() == map1 then    
            moveToMap(pc)
           elseif getMapName() == pc then
            usePokecenter()
        end

end

function unequip()

    if unequipitem then
if getPokemonHeldItem(1) == item then
           takeItemFromPokemon(1)
           log(" ")
           log("Item successfully remove on " ..getPokemonName(1).. "...")
           log(" ")
end
    end

end

function brace()

    if equipitem then
if hasItem(item) and getPokemonHeldItem(1) != item then
           giveItemToPokemon(item, 1)
           log(" ")
           log("Macho Brace successfully equipped on " ..getPokemonName(1).. ".")
           log(" ")
end
    end

end

function getEV()
attackEv = getPokemonEffortValue(1, "Attack")
    defenseEv = getPokemonEffortValue(1, "Defense")
    speedEv = getPokemonEffortValue(1, "Speed")
    spattackEv = getPokemonEffortValue(1, "Spattack")
    spdefenseEv = getPokemonEffortValue(1, "Spdefense")
    hpEv = getPokemonEffortValue(1, "HP")
end

function onPathAction()
getEV()
    if isPokemonUsable(1) then
        
        if atk == true  then
            if attackEv < atkEVneed then   
                return brace() or ride()
            elseif attackEv >= atkEVneed then
atk = false
                return unequip() or ride()
            end
        elseif speed == true  then
            if speedEv < speedEVneed then
                return brace() or ride()
            elseif speedEv >= speedEVneed then
speed = false
                return unequip() or ride()
            end
        elseif defense == true  then
            if defenseEv < defenseEVneed then
                return brace() or ride()
            elseif defenseEv >= defenseEVneed then
defense = false
                return unequip() or ride() 
            end
        elseif spattack == true  then
            if spattackEv < spattackEVneed then 
                return brace() or ride()
            elseif spattackEv >= spattackEVneed then
spattack = false
                return unequip() or ride()
            end
        elseif spdefense == true  then
            if spdefenseEv < spdefenseEVneed then   
                return brace() or ride()
            elseif spdefenseEv >= spdefenseEVneed then
spdefense = false
                return unequip() or ride() 
            end
        elseif hp == true  then
            if hpEv < hpEVneed then   
                return brace() or ride()
            elseif hpEv >= hpEVneed then
hp = false
                return unequip() or ride()
            end
elseif not atk and not speed and not defense and not spattack and not spdefense and not hp then
return unequip() or fatal("Effort Value reaches Setting Max Value then Stopping the bot")
        end
        
    else
        rideheal()      
    end

end

function onBattleAction()
    if isWildBattle() and ( isOpponentShiny() ) then
        return useItem("Pokeball") or useItem("Great Ball") or useItem("Ultra Ball") or sendAnyPokemon() or attack() or run()
    else
        checkAll()
    end 
end

function checkAll()
if atk and getActivePokemonNumber() == 1 and isOpponentEffortValue("Attack") and (attackEv < atkEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"Attack").. " Attack EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
elseif speed and getActivePokemonNumber() == 1 and isOpponentEffortValue("Speed") and (speedEv < speedEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"Speed").. " Spe EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
elseif defense and getActivePokemonNumber() == 1 and isOpponentEffortValue("Defense") and (defenseEv < defenseEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"Defense").. " Defense EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
elseif spattack and getActivePokemonNumber() == 1 and isOpponentEffortValue("Spattack") and (spattackEv < spattackEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"Spattack").. " Spattack EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
elseif spdefense and getActivePokemonNumber() == 1 and isOpponentEffortValue("Spdefense") and (spdefenseEv < spdefenseEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"Spdefense").. " Spdef EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
elseif hp and getActivePokemonNumber() == 1 and isOpponentEffortValue("HP") and (hpEv < hpEVneed) then
        log("Your "..getPokemonName(1).." have "..getPokemonEffortValue(1,"HP").. " HP EVs.")
        return attack() or sendPokemon(2) or sendPokemon(3) or sendAnyPokemon() or run()
else
return run() or sendUsablePokemon() or sendAnyPokemon()
end
end
 
Reply
#27
You can test it. And this code is only for 1 Training location. BTW I included a link for multiple EV train but its only Kanto supported.
God Karp Trainer loading... *splash*splash Huh

 
Reply
#28
[11:03:48 AM] Bot started
[11:03:48 AM] -----------------------------------------------------------
[11:03:48 AM] --------- We are now Commencing the Training Routine ---------
[11:03:48 AM] -----------------------------------------------------------
[11:03:48 AM] ---------------
[11:03:48 AM] Error during the execution of 'onStart': Logs.lua:(6,7-62): attempt to concatenate a nil value
[11:03:48 AM] Bot stopped
[11:03:48 AM] Bot running time: 0.00 hours
[11:03:48 AM] or
[11:03:48 AM] Bot running time: 0.00 minutes
[11:03:48 AM]  
Anyone getting this issue?
 
Reply
#29
i am getting same issue :/
 
Reply
#30
I have the following error: "Error during the execution of 'onStart': Logs.lua: (6,7-62): attempt to concatenate a nil value"

-- Set/Change the number of EV you needed

AttackPointsNeed = 0
SpeedPointsNeed = 240
DefensePointsNeed = 0
SpattackPointsNeed = 196
SpdefensePointsNeed = 0
HpPointsNeed = 52



--CONTINUE LEVELLING WHEN DESIRED EV REACHED?

continueLevel = true

levelMap = "Ecruteak City"
levelSpot = "NearExit"
--if near exit
levelMapNearExit = "Ecruteak City"
--if rectangle
RectMinX4 = 1
RectMinY4 = 1
RectMaxX4 = 1
RectMaxY4 = 1
levelPC = "Pokecenter Ecruteak"
stopLevel = 47

levelMap2 = "Route 37"
levelSpot2 = "NearExit"
--if near exit
levelMapNearExit2 = "Ecruteak City"
--if rectangle
RectMinX5 = 1
RectMinY5 = 1
RectMaxX5 = 1
RectMaxY5 = 1
levelPC2 = "Pokecenter Ecruteak"
stopLevel2 = 99
 
Reply
#31
Its not working anymore (Route 12).
 
Reply
#32
hello, im new here especially with the .lua script and config. usually i just use the .txt script upload it to the bot.
could you please help me how to use the .lua and config?
is it same as i used the .txt?
 
Reply
#33
where i configure to start whenever i want?
 
Reply
#34
Hello to this script work just I go in the config.lua put as I want and then I open the proshine and select config.lua?
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)