• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] A custom evolution method that requires a held item and a specific evolution stone

DarrylBD99

Content Creator and Game Developer
  • 319
    Posts
    5
    Years
    So, I am working on Pokemon Essentials V18 and I have realised that the evolution methods have changed a lot since V17.2. Therefore, I am not sure how to actually make this new evolution method. Can someone help me with this evolution method? I want it so that way you are required to use a evolution stone that will be specified inside the script, but you will also need a held item that will be defined inside the pbs.
     
    I couldn't think of a way to make this evolution method work solely in the PBSFile, but this should do the trick(haven't tested it yet though):

    In "Pokemon_Evolution" add this line:
    Code:
    HoldAndUseItem       = XX
    don't forget to change this function:
    Code:
    def self.maxValue; return XX; end
    Then add this piece of code at the bottom:
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
        next item == parameter if isConst?(pkmn.item,:PBItems,[COLOR="Red"]:POTION[/COLOR])
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?([COLOR="Red"]:POTION[/COLOR])
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })
    In the PBS File you define the item to be used on the Pokemon while the held item is defined in the red parts of the function above. :)
    Code:
    Evolutions = CINCCINO,HoldAndUseItem,SHINYSTONE
     
    I couldn't think of a way to make this evolution method work solely in the PBSFile, but this should do the trick(haven't tested it yet though):

    In "Pokemon_Evolution" add this line:
    Code:
    HoldAndUseItem       = XX
    don't forget to change this function:
    Code:
    def self.maxValue; return XX; end
    Then add this piece of code at the bottom:
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
        next item == parameter if isConst?(pkmn.item,:PBItems,[COLOR="Red"]:POTION[/COLOR])
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?([COLOR="Red"]:POTION[/COLOR])
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })
    In the PBS File you define the item to be used on the Pokemon while the held item is defined in the red parts of the function above. :)
    Code:
    Evolutions = CINCCINO,HoldAndUseItem,SHINYSTONE

    Thanks but... you kinda made it the opposite way around... I wanted to use the specific stone, but with different held items defined inside the pbs...
     
    Try this version then. :)
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
        next isConst?(item,:PBItems,:POTION) && pkmn.hasItem?(parameter)
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?(parameter)
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })
     
    Try this version then. :)
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
        next isConst?(item,:PBItems,:POTION) && pkmn.hasItem?(parameter)
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?(parameter)
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })

    I am sorry, but it doesn't work at all...
     
    I'm sorry, that was my mistake :/. If you still got the patience, this one worked for me. Should have tested the ones before.:)
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
       [COLOR="Red"] next item==PBItems::EVOSTONE && pkmn.hasItem?(parameter)[/COLOR]
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?(parameter)
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })
    Don't forget to define the item as an evolutionstone in your PBS
    Code:
    900,EVOSTONE,Evo Stone,Evo Stones,1,5000,"",[COLOR="Red"]1,0,7[/COLOR]
     
    I'm sorry, that was my mistake :/. If you still got the patience, this one worked for me. Should have tested the ones before.:)
    Code:
    PBEvolution.register(:HoldAndUseItem, {
      "parameterType" => :PBItems,
      "itemCheck"     => proc { |pkmn, parameter, item|
       [COLOR="Red"] next item==PBItems::EVOSTONE && pkmn.hasItem?(parameter)[/COLOR]
      },
      "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?(parameter)
        pkmn.setItem(0)   # Item is now consumed
        next true
      }
    })
    Don't forget to define the item as an evolutionstone in your PBS
    Code:
    900,EVOSTONE,Evo Stone,Evo Stones,1,5000,"",[COLOR="Red"]1,0,7[/COLOR]

    Thanks a lot, it works like a charm
     
    Back
    Top