Evolution triggered by fainting

Started by mewlover22 January 21st, 2016 8:46 AM
  • 2335 views
  • 17 replies

mewlover22

Pokemon Creator

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 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

Non-binary
Australia
Seen March 9th, 2020
Posted December 9th, 2019
201 posts
4.9 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
MoveTypeFainted  = NUM #NUM = which ever number comes next on the list


#Example
LevelDay                 = 29
LevelNight                = 30
UpsideDownLevel       = 31
MoveTypeFainted       = 32
Next add to the next set of lines at the end of EVONAMES add
,"MoveTypeFainted"
The lines need to look something like this it dosent exacle need to look like this.
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","MoveTypeFainted"
  ]

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

when PBEvolution::MoveTypeFainted
   for i in 0...4
        return poke if pokemon.isFainted? && pokemon.moves[i].type==level
      end
Make sure the when lines up

You may have something like
    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
    when PBEvolution::MoveTypeFainted
      for i in 0...4
        return poke if pokemon.isFainted? && pokemon.moves[i].type==level
      end
  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
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
Evolutions=VAPOREON,Item,WATERSTONE,JOLTEON,Item,THUNDERSTONE,FLAREON,Item,FIRESTONE,LEAFEON,Location,465,GLACEON,Location,433,SYLVEON,Custom2,18,ESPEON,HappinessDay,,UMBREON,HappinessNight,WISPEON,MoveTypeFainted,7,
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

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 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?

ptisnjunk95

Made in Portugal

Age 24
Male
Portugal
Seen October 22nd, 2016
Posted February 22nd, 2016
129 posts
7.5 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.

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

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 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

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 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
---------------------------

Maruno

Lead Dev of Pokémon Essentials

England
Seen 2 Days Ago
Posted 6 Days Ago
5,246 posts
12.4 Years
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.
Go to the Essentials Docs Wiki

Essentials Docs Wiki

Follow me on Twitter: @maruno42


Maruno

Lead Dev of Pokémon Essentials

England
Seen 2 Days Ago
Posted 6 Days Ago
5,246 posts
12.4 Years
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?
Go to the Essentials Docs Wiki

Essentials Docs Wiki

Follow me on Twitter: @maruno42


Maruno

Lead Dev of Pokémon Essentials

England
Seen 2 Days Ago
Posted 6 Days Ago
5,246 posts
12.4 Years
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.
Go to the Essentials Docs Wiki

Essentials Docs Wiki

Follow me on Twitter: @maruno42


mewlover22

Pokemon Creator

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 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.

FBI

Free supporter

Male
Unknown Island
Seen 2 Weeks Ago
Posted December 17th, 2019
1,910 posts
7.5 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:

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
...

Rot8er_ConeX

Male
The Dissa Region
Seen February 22nd, 2018
Posted May 8th, 2017
822 posts
5.1 Years
try using this instead

return poke if pokemon.hp<=0
that's how I do it, and it works.
Features of Pokemon Entropy

The black circular "doodles" in the lower right corner of my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.

mewlover22

Pokemon Creator

Male
South Carolina
Seen 2 Days Ago
Posted 2 Weeks Ago
419 posts
11.7 Years
try using this instead

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.
Seen 3 Weeks Ago
Posted 3 Weeks Ago
1 posts
99 Days
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