• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Evolution triggered by fainting

mewlover22

Pokemon Creator
455
Posts
15
Years
  • So i asked a friend of mine about a way to evolve eevee to ghost type and he came up with something what we want to know is if we can do it. His idea is have eevee have a move like shadow ball and when it faints have it evolve to the new pokemon. Were wondering if this can be done and if so what do we need to do. Now I know that has move is type of evolution but that will just make eevee evolve what we want to do is make it die then evolve it.
     

    Sir_Tman

    Overworked game Dev
    201
    Posts
    8
    Years
  • So first you are going to need to go to PokemonEvolution or Pokemon_Evolution

    There you should be presented with a list of evolution methods go to the bottom of the list undder "class PBEvolutopn" and add the line
    Code:
    MoveTypeFainted  = NUM #NUM = which ever number comes next on the list
    
    
    #Example
    LevelDay                 = 29
    LevelNight                = 30
    UpsideDownLevel       = 31
    [COLOR="Red"]MoveTypeFainted       = 32[/COLOR]

    Next add to the next set of lines at the end of EVONAMES add
    Code:
    ,"MoveTypeFainted"

    The lines need to look something like this it dosent exacle need to look like this.
    Code:
    EVONAMES=["Unknown",
         "Happiness","HappinessDay","HappinessNight","Level","Trade",
         "TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater",
         "Silcoon","Cascoon","Ninjask","Shedinja","Beauty",
         "ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove",
         "HasInParty","LevelMale","LevelFemale","Location","TradeSpecies",
         "HappinessMoveType","TypeDark","LevelRain","LevelDay","LevelNight",
         "UpsideDownLevel"[COLOR="Red"],"MoveTypeFainted"[/COLOR]
      ]


    Next Scroll down and find the line def pbMiniCheckEvolution(pokemon,evonib,level,poke)

    Code:
    [COLOR="Blue"]when[/COLOR] PBEvolution::MoveTypeFainted
       [COLOR="blue"]for[/COLOR] i in 0...4
            [COLOR="Blue"]return[/COLOR] poke if pokemon.isFainted? && pokemon.moves[i].type==level
          end

    Make sure the when lines up

    You may have something like
    Code:
        when PBEvolution::LevelDay
          return poke if pokemon.level>=level&& PBDayNight.isDay?(pbGetTimeNow)
        when PBEvolution::LevelNight
          return poke if pokemon.level>=level && PBDayNight.isNight?(pbGetTimeNow)
        when PBEvolution::UpsideDownLevel
          return poke if pokemon.level>=level
        [COLOR="Red"]when PBEvolution::MoveTypeFainted
          for i in 0...4
            return poke if pokemon.isFainted? && pokemon.moves[i].type==level
          end[/COLOR]
      end
      return -1
    end

    The next thing to do is add this to Eevee's Evolutions

    In the Pokemon.txt
    Find Name=Eevee
    Scroll do till you find its evolutions
    Code:
    Evolutions=VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,465,GLACEON,Location,433,SYLVEON,Custom2,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,

    Add to the end this line
    Code:
    Evolutions=VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,465,GLACEON,Location,433,SYLVEON,Custom2,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,[COLOR="Red"]WISPEON,MoveTypeFainted,7,[/COLOR]

    WISPEON=InternalName
    MoveTypeFainted=Evolution Methord
    7=the type number defined in the types.txt which will be the type of move you have.

    This should work for you.
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • Thank you so much for your help and this will work as long as i have set up in the script?

    Edit: I have set it up but the game says that 7 is an incorrect value.

    VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,28,GLACEON,Loc

    ation,34,AEREON,Location,50,SYLVEON,HappinessMoveType,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,GHOSTEON,MoveTy

    peFainted,7,

    That is my evolution set up how do i fix it?
     
    Last edited:

    ptisnjunk95

    Made in Portugal
    129
    Posts
    11
    Years
  • Thank you so much for your help and this will work as long as i have set up in the script?

    Edit: I have set it up but the game says that 7 is an incorrect value.

    VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,28,GLACEON,Loc

    ation,34,AEREON,Location,50,SYLVEON,HappinessMoveType,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,GHOSTEON,MoveTy

    peFainted,7,

    That is my evolution set up how do i fix it?

    You have double comma before UMBREON

    Edit: Sorry. Try inputting another comma before GHOSTEON.

    Code:
    Evolutions=VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,465,GLACEON,Location,433,SYLVEON,Custom2,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,,GHOSTEON,MoveTypeFainted,7
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • Now it's telling me that type 18 isn't valid any idea what is wrong i can't get it to work no mater what i do?

    Edit here's the new setup im trying.

    VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,28,GLACEON,Loc

    ation,34,AEREON,Location,50,SYLVEON,HappinessMoveType,18,GHOSTEON,MoveTypeFainted,7,ESPEON,HappinessDay,,UMBREON,Hap

    pinessNight,
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • no because of the new issue idk how to fix it says 18 is right idk how to fix this.

    Edit this is the problem.
    ---------------------------
    Pokemon Sun
    ---------------------------
    Exception: RuntimeError

    Message: Incorrect value 18 in PBTypes

    File PBS/pokemon.txt, section 6, key Evolutions





    Compiler:441:in `checkEnumField'

    Compiler:423:in `csvEnumField!'

    Compiler:1889:in `pbCompilePokemonData'

    Compiler:1875:in `each'

    Compiler:1875:in `pbCompilePokemonData'

    Compiler:1872:in `each'

    Compiler:1872:in `pbCompilePokemonData'

    Compiler:4098:in `pbCompileAllData'

    Compiler:4212



    This exception was logged in

    C:\Users\Chris\Saved Games/Pokemon Sun/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------
     
    Last edited:

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You're using the evolution method HappinessMoveType. The variable is not how much happiness is required; it's the type required. Do you think this is more likely to be a number, or the internal name of a type? Check Essentials v16 if you're not sure.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Well, yes. That's how the evolution method works in Essentials v16 - it expects the internal name of a type. Makes sense, given that the method's variable is supposed to be a type. Where else do you define/use a type by a number rather than its internal name?
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • So i have run into an issue the game tries to evolve eevee but as soon as it does the game crashes and says there is no method set up for the ghost eveo i put the code right below the last method in version 16 under custom 1 and it's not working any idea what's wrong?
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • Still trying to solve the issue here but idk what the issue is.
    Evolution triggered by fainting
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Let's spend a moment here without any imagination. Let's just use our English.

    The error message you got is in English, for the most part. There are a couple of numbers in there (938 and a funky-looking one with an x in it at the end). The rest of it is English words, although some of them are smushed together, as though the writer forgot to put spaces between them. Point is, it can be read by a person who can understand English.

    There's not much to it - only two short lines. It's not exactly Lord of the Rings.

    The first line of the error message looks like it's pointing at where the error occurs. It names a script section, which I can tell because the first word is "Script" and then there's the name of a script section in single quote marks. The third word is "line", which is followed by a number. I can only presume this is a line number, probably one within the aforementioned script section. Something must have happened there, something related to this error message if that line is being named in it. Finally, "NoMethodError occurred". This is an error message, and it looks like this particular error is a NoMethodError. No prizes for guessing what that might mean.

    Now, the second line. "undefined method..." Hang on a minute. NoMethodError? Undefined method? Further evidence of what is going on here! And what's more, the third word is in single quote marks - perhaps this is the name of the method that's undefined? Is a script trying to call this method, but it's undefined? Quite possibly. As for those last two words, one is "for" (is the missing method supposed to belong to the thing that's about to be named?) and the last one is in <these things>. It's some joined-up words, which looks like the name of a class (and a script section, incidentally, but it actually refers here to the class) and a funky number which looks weird so we'll just ignore it - it won't be important. I bet it'll be different if you run the game again and reproduce this error.



    I hope all that sounded patronising to you. Error messages can be read, they can be understood. This one is particularly easy, because it's so short and clear. If someone claims they don't understand it, I cannot think of a single reason why they don't other than they're simply not trying. And if they don't want to try, I don't want to try either.
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • I get what it's saying my question is why won't eevee evolve as he is supposed to i did what the user on here suggested i do to set up the method and i think something is missing or i did something wrong. Sorry for repeating the same thing again but I'm no good at scripting and I want to try this new method out because of friend of mine suggested it to me.
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • First of all, I have no experience with Pokemon essentials or gamedev outside of the GBA. That said, I'm pretty sure this is your issue here:

    Code:
    return poke if pokemon.isFainted?

    pokemon.isFainted cannot be evaluated because the engine either can't find it, or it doesn't exist. It could be syntactically expecting brackets around the if clause here. I'm unfamiliar with the programming language you're using, so I cannot say for sure. The error says it's missing the method, but I believe it's just interpreting the property/member you're trying to fetch as a method.

    1) Have you coded this ".isFainted" property into your pokemon struct/class/whatever it is?
    2) Does it require brackets around the clause? Then apply the brackets.

    Sincerely, the guy who doesn't know what he's talking about
     

    mewlover22

    Pokemon Creator
    455
    Posts
    15
    Years
  • try using this instead

    Code:
    return poke if pokemon.hp<=0
    that's how I do it, and it works.

    Good suggestion but other than trying a battle out and leveling him up then having him faint is there any other way to test this in debug mode?

    EDIT: Set up a debug test and he did evolve thanks for the fix.
     
    Last edited:
    6
    Posts
    4
    Years
    • Seen Jun 26, 2021
    Hi there, I´ve been trying to use this code but it doesnt work:

    when PBEvolution::Fainted
    return poke if (pokemon.hp<=0)

    I tried changing pokemon.hp<=0 for pokemon.hp>0 to see if at least it evolves and works but whenever the Pokemon levels up (this was just to know if the code was ok)

    Now that i know that the evolution method is well scripted I´d like to know how to make it work properly so the Pokemon evolves after it faints
     
    Back
    Top