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

Another fun error that I need help with

Nickalooose

--------------------
  • 1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    By any chance does anyone know how to fix this error

    Exception: NoMethodError
    Message: undefined method `>' for nil:NilClass
    PokemonEvolution:692:in `pbCheckEvolutionEx'
    PokemonEvolution:690:in `each'
    PokemonEvolution:690:in `pbCheckEvolutionEx'
    PokemonEvolution:701:in `pbCheckEvolution'
    PokemonField:786:in `pbEvolutionCheck'
    PokemonField:783:in `each'
    PokemonField:783:in `pbEvolutionCheck'
    PokemonField:1069
    PokemonField:1065:in `call'
    PBEvent:54:in `trigger'

    This happens when I level up in battle
    Actually it happens right after the battle upon returning to the main game
     
    Last edited:
    Okay it seems nobody knows, maybe this will help.
    I took the liberty or messing around with the scripts myself to see if I can find the error.
    First I thought maybe my new evolution method was clashing with another or soemthing... It wasn't... Then I decided to look for anything with ">" in the evolution checks, there are 2... 1 in def pbCheckEvolutionEx... An another in def pbEvolutionCheck...
    So I changed the one in CheckEvolutionEx, and an error appeared within EvolutionCheck... So I changed that one... And the error is gone...
    So I guess my question for my reply is:
    Does it have to be ">0" or can it be anything that equals this, I.E. "==1", "!=0", etc. etc.
    Come on guys, I can't give any more information that I have, I've narrowed it down to 1 little arrow sign, out of any of the scripts being called at any one time, if none of the examples matter, then this error is solved!
     
    The > symbol needs to be there.

    Clearly it's your new evolution method(s) that are the cause of this problem. I would guess that one of them doesn't return poke, which is why pbCheckEvolutionEx ends up trying to compare nil to 0 (hence your error). You shouldn't get nil there, just a number, so the actual problem is in an earlier script (i.e. your new methods).

    You most certainly can give more information than you have, e.g. the code you've added. If you want to keep it private than you can PM me. You should undo any fiddling you've done, and let the only changes you've made in that script section be the adding of your new evolution methods.
     
    Yeah I thought that, but then I commented my new methods, out, and the error was still there.
     
    Start again, then. Use an original copy of that script section, add in solely your new methods' code and see what happens. If you still have the problem, post all the code you added.
     
    I checked all my methods, and re-wrote them, it had something to do with the one that evolves Eevee into Glaceon or Leafeon(evolve depending on location), I used an if statement here, and it was returning poke, during the if, not at the end... Each one I added seperate were fine, this one causes the error... I don't see why it would do this though, the return is there, just not at the end of the when, case... Is there another way to do these evo's or is that the way?

    The rest of my methods work fine by the way... Cause no errors... Just this one is being a pain.
     
    Okay, let me put it this way:

    Base Essentials works just fine when it comes to evolution. You changed something, and now it doesn't work fine. What caused the problem?

    Note that you haven't even said which version you're using. The "Location" method already exists in recent versions of Essentials, works just fine, and looks like this:

    Code:
        when 24 # Evolves on a certain map
          return poke if $game_map.map_id==level
    You're being rather unhelpful, frankly. If you still don't show me the code you've added, I'm not going to try to help you any further.
     
    The newest version... It's okay, if I remove the code I done for Glaceon and such, that code was made when location wasn't available back when... But evidentally location is there, so I will leave it as that... The error isn't there when that evo method is not there! So all is okay...

    I don't know if you're going to love my next question and problem then...
    I've made it so stats can be edited, Attack, Defense, Speed, SPDef, SPAtk, HP, TotalHP... But, when I use my edited stats in battle, and the Pokémon Levels Up, the stats, reset, but after the game has already tried doing the equasion, but, the new stats don't add up properly and tried to add a minus number... This is all well and broken, and the quick fix is to not edit the stats in the first place... But, my good pal KitsuneKouta had a fix for this problem and then, the stats didn't add anything upon level up, what I mean is it +0's... Then he realised he forgot to fix his fix haha... So, he gave this fix and it causes an error... So, do you have any idea how to make this work?

    Spoiler:
    Spoiler:
    Spoiler:

    Everything you would need is right here, KitsuneKouta and I are having a little trouble, although KK likes learning new things aswell do I, if you don't know this off the top of your head, don't worry about it, I'm sure between KitsuneKouta and myself, we will figure this out... Just thought maybe I should ask you real quick.
     
    Everything I need is not right here. What are the actual changes to the stats? How do you want to use this feature?

    The first "fix" doesn't work because it just sets the stats equal to themselves (from the previous level) rather than the recalculated stats.

    The "fixed fix" doesn't work because the stats @attack and so on haven't been defined first before you try to add something to them. Even if you set them all to 0 before adding stats, you'll still end up with the first problem where the stats never actually change.

    To put it simply, the proposed "fixes" are nonsense and won't work at all. Newly generated Pokémon would end up with stats of 0, which would then never change.

    Please, for once, give me all the information I need. How are you changing the stats? Do you want to add fixed values to each stat in turn, or adding values depending on the current level, or do you want it to be a multiplier?
     
    Oh, sorry I thought you'd only need the script,

    I'm simply using $Trainer.party[0].attack+=5 and so on.
    Well in the long run, I have other ways to train Pokémon, by using specific gyms and such to train a certain stat, the gyms themselves work perfect... I only just began play testing my game, and noticed that this happens with the stats.

    I understand that new Pokémon won't receive stat updates.

    So all in all, I'd like the Pokémon to gain their original stats like they would normally, but during the game have these new ways to gain stats elsewhere, but with these new stats having a non-effect to the Poke's original stat curve...

    Um there are no other scripts used, other than the one's I've shown, the line that is called to edit the stats is $Trainer.party[0].attack+=5... Is that all you need?
     
    Yes, I thought that would be the case.

    The problem is that @attack and so on are rewritten every time the stats are recalculated, so you can't directly change them and hope the change to be permanent. What you can do instead is to set/change other values, and then add them to the calculated ones.

    Add this code:

    Code:
    attr_accessor(:statmod)
    
    def changeStat(stat,value)
      @statmod=[0,0,0,0,0,0] if !@statmod
      @statmod[stat]+=value
    end
    Add this line in def calcStats:

    Code:
        for i in 0..5
          base=bs[i]
          if i==0
            stats[i]=calcHP(base,level,@iv[i],@ev[i])
          else
            stats[i]=calcStat(base,level,@iv[i],@ev[i],pvalues[i-1])
          end
          [COLOR=Red]stats[i]+=@statmod[i] if @statmod[/COLOR]
        end
    Use as follows:

    Code:
    $Trainer.party[0].changeStat(PBStats::ATTACK,5)
    $Trainer.party[0].changeStat(PBStats::SPEED,-3)
    $Trainer.party[0].changeStat(PBStats::HP,(@level/2).floor)
    Something like that.

    It's not perfect (i.e. it only allows triggered additions/subtractions of fixed values to each stat), but it's a start. It's up to you to develop it if you want to. The first thing I'd do, I think, would be to cap the stat boosts to some value (perhaps the level).
     
    Right okay.

    $Trainer.party[0].changeStat(PBStats::HP,(@level/2).floor)
    so this here, would add +half of what is earned at the next level?
    By triggered do you mean when the Pokémon levels up?

    Sorry, I like to know what I'm looking at to learn a little.
     
    That example adds half of the Pokémon's current level to its HP stat. If it was level 50, then that would add 25 points to total HP. Note that this addition would remain 25 even if the Pokémon's level changed, because it's a triggered change. This specific example is probably a bad one to use, but it does show that you can compute values to add to your stats, rather than just adding a fixed value.

    "Triggered" means you make it happen, i.e. you need to put it in an event and that's when the change happens. It won't do anything automatically, and won't be affected by any changing circumstances in the future.

    A Pokémon's stats aren't recalculated until it levels up, so when you change the stat you'd probably want to also add the change to the actual stat as well so that the change applies immediately, like so:

    Code:
    def changeStat(stat,value)
      @statmod=[0,0,0,0,0,0] if !@statmod
      @statmod[stat]+=value
      @totalhp+=value if stat==PBStats::HP
      @attack+=value if stat==PBStats::ATTACK
      @defense+=value if stat==PBStats::DEFENSE
      @speed+=value if stat==PBStats::SPEED
      @spatk+=value if stat==PBStats::SPATK
      @spdef+=value if stat==PBStats::SPDEF
    end
    The other benefit of doing this is that the value won't show up in the changes to stats when the Pokémon next levels up (because both the old and new stats will include the value). This is why I would prefer this over simply using calcStats (which would also consider any new EVs, and you wouldn't want them added until the next level up).
     
    Oh right, so you could also do, @attack/2, and that would + half the attack stat.

    I see you used HP as the totalHP replacement, I'm assuming here because TotalHP isn't an actually "stat" foresay, it would cause an error?

    Question about the contest attributes:
    Are the only thing they are good for, contests and Feebas, or is it possible to make them work in battles too?

    Example battle:

    My Female Butterfree, is battling a Male Cyndaquil, but if say, Butterfree has a higher beauty stat, Cyndaquil had a chance of not attacking saying a message like "was dazed by Butterfree's beauty".

    A bit more info:

    Butterfree Beauty = 180
    Cyndaquil Beauty = 130

    180-130 = 50/10 = 5% chance of infactuation, I guess that's what it would be called.

    I guess it should work with anything

    232-90 = 142/10 = 14% For Player
    140-210 = -130/10 = 13% For AI
    176-175 = 1/10 = 0% For Either

    So I guess, if any Pokémon isn't at least +10 Beauty on the other Pokémon, then no effect should happen...

    The others I had ideas which I could run past you if you wanted, but I'd like to know if it's at all possible in the first place.
     
    Oh right, so you could also do, @attack/2, and that would + half the attack stat.

    I see you used HP as the totalHP replacement, I'm assuming here because TotalHP isn't an actually "stat" foresay, it would cause an error?
    That's right. It would be half the current Attack when the change was applied, of course. It wouldn't scale up if the Attack later increased, i.e. if the Attack was 80 when the change was done, the bonus would forever be exactly 40 points. You'd have to change the code a bit if you wanted it to be a multiplier rather than (or in addition to) a direct addition of numbers.

    HP is a proper stat. You can get EVs and IVs in it, and it increases as you level up (albeit using a slightly different formula to the other stats). The HP stat is the total HP of the Pokémon.

    You wanted per se. ;)


    Question about the contest attributes:
    Are the only thing they are good for, contests and Feebas, or is it possible to make them work in battles too?

    Example battle:

    My Female Butterfree, is battling a Male Cyndaquil, but if say, Butterfree has a higher beauty stat, Cyndaquil had a chance of not attacking saying a message like "was dazed by Butterfree's beauty".

    A bit more info:

    Butterfree Beauty = 180
    Cyndaquil Beauty = 130

    180-130 = 50/10 = 5% chance of infactuation, I guess that's what it would be called.

    I guess it should work with anything

    232-90 = 142/10 = 14% For Player
    140-210 = -130/10 = 13% For AI
    176-175 = 1/10 = 0% For Either

    So I guess, if any Pokémon isn't at least +10 Beauty on the other Pokémon, then no effect should happen...

    The others I had ideas which I could run past you if you wanted, but I'd like to know if it's at all possible in the first place.
    Currently the only contest stat that does anything whatsoever is the beauty stat, which is used to determine Feebas's evolution. There is no way in Essentials of changing any contest stat, not even beauty. It's up to you to make them useful.

    You can do anything you want with these contest stats. There was a question thread in here yesterday asking how to create a move whose base damage depended on the beauty stat. It's certainly possible to use them however you like, even if those uses don't appear in the official games.

    Your example is perfectly doable. It's a lot like the immobilizing part of the move Attract, except instead of "is the attacker Attracted to the target?", it's "is the target a lot more beautiful than the attacker?".

    Personally, I would have made the attacker become infatuated with the more beautiful target, rather than straight up be immobilised, i.e. like the ability Cute Charm. It works more with the existing battle system (namely the infatuation pseudo-status), and is a bit less hax. The ability Oblivious should counter it, and you'd need a way of setting the beauty stats of wild/enemy trainer Pokémon. Personally I'd like to see it work regardless of genders, because I'm liberal like that.

    The actual probabilities of getting whichever effect you decide on is just a matter of mathematics, which you've got a good outline of already.
     
    Ah yes, I guess it be better if it acted more like CuteCharm in the sense of infactuation, but you think I should work it around if the Pokémon is compatible in the first place or just male/female attraction?

    I never new the other stats didn't do anything, I figured they would do nothing in the overworld and battles, but never looked into those ironically enough, I thought bout each one of them giving a perk to a Pokémon.

    How do you junction things to Wild Pokémon and Trainer Pokémon then, where do I look? I thought it would be along the lines of attacker.pokemon.beauty, and battler.pokemon.beauty, but it seems a bit more research into it would be in order.

    By gender regardlessness, do you mean, despite the Pokémon both being Female, it should work haha, or did I read that wrong?

    I guess using Beauty and what have you in battles would make your game unique ;)

    I'll have a look for the move based on beauty thing now then, and see what I can learn, I'd like a lot of the moves, powers, differed by other effects to stop more over powered Pokémon *Cough*Gyarados*Cough* being over used...
     
    Ah yes, I guess it be better if it acted more like CuteCharm in the sense of infactuation, but you think I should work it around if the Pokémon is compatible in the first place or just male/female attraction?
    The move Attract doesn't care about whether the two Pokémon are in the same egg group, just that they are opposite genders. That's how the official games works. I really don't want to offer my own opinion here (other than "try not to be too different so that it keeps making sense"), as it's your thing.


    I never new the other stats didn't do anything, I figured they would do nothing in the overworld and battles, but never looked into those ironically enough, I thought bout each one of them giving a perk to a Pokémon.

    How do you junction things to Wild Pokémon and Trainer Pokémon then, where do I look? I thought it would be along the lines of attacker.pokemon.beauty, and battler.pokemon.beauty, but it seems a bit more research into it would be in order.
    They would do a lot in contests, but Essentials doesn't have contests so they have no use.

    Despite your bizarre use of the word "junction", I think you've pretty much got it already. That blue code is how you get the beauty value of the Pokémon in battle, and what you do with it is up to you. I don't imagine you would need to change these values during battle (unless an opponent uses a move that makes contact while holding an Ugly Stick item), but that's easy to do anyway.

    You've also got Cool, Smart, Tough and Cute to work with. If you're going to use the contest stats, you should make sure the player can see them, either by putting them in the Pokémon Summary pages (preferable), or making a Pokégear app to show them like the PokéNav's Condition app. They shouldn't be invisible to the player. You might say that Hidden Power's type and power are invisible, but that's just one move and is its gimmick.

    As a random comment, I would happen to note that every move is defined as being one of the five contest stats (I personally chose the contest stats of the Gen 5 moves just because they needed to be defined, but I think they fit).


    By gender regardlessness, do you mean, despite the Pokémon both being Female, it should work haha, or did I read that wrong?

    I guess using Beauty and what have you in battles would make your game unique ;)

    I'll have a look for the move based on beauty thing now then, and see what I can learn, I'd like a lot of the moves, powers, differed by other effects to stop more over powered Pokémon *Cough*Gyarados*Cough* being over used...
    "Gender regardless" mean, as you suggest, allowing one female Pokémon to be attracted to another female Pokémon, or male to genderless, or genderless to genderless, or any other combination. That's just my personal opinion, though; in actuality, you should probably make it work in the same way Attract does (i.e. opposite gender couples only), so that the user understands what's going on to some extent.

    Using contest stats in regular battles may be unique, but you'd better make sure the player knows what's going on. Again, make sure they can see the stats, and explain in-game that they're important (and preferably give a vague description of what each stat does).

    You should be extremely careful about introducing new elements just to try to balance things. They will always have a large pile of unforeseen repercussions, and can easily make other Pokémon even more overpowered than Gyarados apparently currently is.
     
    The move Attract doesn't care about whether the two Pokémon are in the same egg group, just that they are opposite genders. That's how the official games works. I really don't want to offer my own opinion here (other than "try not to be too different so that it keeps making sense"), as it's your thing.
    Oh yeah I get it... Oh no, I like realism (funny concept being as this is pure fantasy gaming haha), but in the animé, some Pokémon hit like once as the opponent hits with like 3 attacks before the trainer decides to attack... And sometimes Pokémon get infactuated with random Pokémon like Magnemite did with Pikachu in the episode that Pikachu got ill in season 1... That's all I'm trying to replicate, everything is already known by any Pokémon Animé viewer, it's just not in the games... Like my new evolution method for example.

    They would do a lot in contests, but Essentials doesn't have contests so they have no use.
    I may look into these contest and write in the Wiki if I get this working, I've already got my own type of contests in game, I don't think I've made these public yet, but it should be the same sort of thing with the contests.

    Despite your bizarre use of the word "junction", I think you've pretty much got it already. That blue code is how you get the beauty value of the Pokémon in battle, and what you do with it is up to you. I don't imagine you would need to change these values during battle (unless an opponent uses a move that makes contact while holding an Ugly Stick item), but that's easy to do anyway.
    I have no idea why I used junction here haha... Yeah I figured that's how it would work because beauty isn't defined within the battle, then I looked at the other post you noted me to look at, and viola, it was right there haha, I should check other threads really, sometimes I do, sometimes I don't.

    You've also got Cool, Smart, Tough and Cute to work with. If you're going to use the contest stats, you should make sure the player can see them, either by putting them in the Pokémon Summary pages (preferable), or making a Pokégear app to show them like the PokéNav's Condition app. They shouldn't be invisible to the player. You might say that Hidden Power's type and power are invisible, but that's just one move and is its gimmick.
    This would be the biggest problem I would face, I don't know how to move pictures around and add text, I have actually stated this on another post before, but I've tried adding Happiness to the summary, I just have literally no clue how to do it, I would most deffinitly need help with this, in fact, I would probably need this to be done for me :(

    As a random comment, I would happen to note that every move is defined as being one of the five contest stats (I personally chose the contest stats of the Gen 5 moves just because they needed to be defined, but I think they fit).
    Oh, I haven't followed what gen the moves are since HG/SS invented more, I haven't actually played BW, and I don't think I will either, they will make Pokémon a 3d game before I buy and play any of the new releases, I like your Essentials better than them.

    "Gender regardless" mean, as you suggest, allowing one female Pokémon to be attracted to another female Pokémon, or male to genderless, or genderless to genderless, or any other combination. That's just my personal opinion, though; in actuality, you should probably make it work in the same way Attract does (i.e. opposite gender couples only), so that the user understands what's going on to some extent.
    Yeah I made little tutorials on every new thing I have implemented to keep the player up-to-date with new additions with stats and stuff... Only things I won't be releasing public are encounters and evolutions, I'm hoping the community will come together and fill in the gaps... I believe my game will be like the top 10 ever completed, which I will be impressed with, besides minor errors.

    Using contest stats in regular battles may be unique, but you'd better make sure the player knows what's going on. Again, make sure they can see the stats, and explain in-game that they're important (and preferably give a vague description of what each stat does).
    I'm thinking along the lines of a summary page, or infact a new page completely, about contest stats and what they do... But I would need deffinate help like I said before... I will need to find someone for that though, I'm useless here.

    You should be extremely careful about introducing new elements just to try to balance things. They will always have a large pile of unforeseen repercussions, and can easily make other Pokémon even more overpowered than Gyarados apparently currently is.
    I understand this, and other than the fact players becomming agetated with getting infactuated, I can't see the problem with this... This would also require more training and planning in your movesets, I can't stress how many people I know who have Pokémon with overpowered movepools that it actually drills me in... I like status attacks just as much as powerful attacks, I can win most battles with a Riachu, with Thunderbolt, Thunder, Charm (I think Pichu learns this move, or one like it) and Mega Punch... But most people have, Thunder, Thunderbolt, Thundershock and a TM, I've noticed mostly, Dig?! What repercussions can you seee with this? I'll make sure to take note.
     
    I understand this, and other than the fact players becomming agetated with getting infactuated, I can't see the problem with this... This would also require more training and planning in your movesets, I can't stress how many people I know who have Pokémon with overpowered movepools that it actually drills me in... I like status attacks just as much as powerful attacks, I can win most battles with a Riachu, with Thunderbolt, Thunder, Charm (I think Pichu learns this move, or one like it) and Mega Punch... But most people have, Thunder, Thunderbolt, Thundershock and a TM, I've noticed mostly, Dig?! What repercussions can you seee with this? I'll make sure to take note.
    My main thought is that this beauty idea of yours won't actually change anything. Any genre-savvy player will grind beauty, which results in either no change to the game at all, or a slight advantage to the player for having really high beauty. Their choice of moves won't be affected at all. That's because the beauty thing is a separate feature to moves, and one won't affect the other (except maybe some players opting not to use Attract as their superior beauty-dependent attraction will do the same thing).

    if you made the contest stats more related to the moves themselves, that would help. For example, having a high Smart means all Smart moves have a higher secondary effect chance, or high Beauty means all Beauty moves have some chance of infatuating the foe when used, or high Tough means all Tough moves do more damage, or high Cool means all damaging Cool moves may cause flinching, or high Cute means all Cute moves may lower the opponent's Defence. There are many possibilities. That would change what moves are used for, and may persuade people to use different moves to take advantage of their contest stat effects.

    Of course, as I said before, that could easily allow for overpowered movesets, but that would be negated somewhat by people being unfamiliar with the system, and it being less popular than the official games, so it wouldn't be picked apart in search of "the best way" quite so much.

    You might also want to limit the total number of contest stat points, in the same way as EVs are limited to 512. This would prevent maxing all the stats, and make the players think about what kind of distribution they want.



    You could do something completely different instead. For example, implement that rumour which states that TM-taught moves are weaker than they would be if learned naturally. Maybe people would think twice about throwing Thunderbolt onto everything if its power would only be 70 (rather than 95). Or, more directly, just change the TM compatibilities so that Dig, etc. aren't available to as many species. Or, even more directly, change which TMs are in your game (or even have none!).
     
    I was actually going down the road with, cute making defence fall and stuff, I didn't think what Smart would do actually, so that's a good point.

    I like the sound of having limited TM's though, reducing the power if the TM was taught, as opposed to naturally learning it, that's a good idea, TMPower-25% might be a good equasion to use, so the more powerful the move, the weaker it becomes, in sense that a 40 attack would become 30 and a 120 attack would become 90, still pretty powerful, but less than if they were attacked by someone with the exact same move... Hmm I like that... This I may work on soon enough, maybe for a new update of my game... Or for the next region.

    I'm not too sure how EV's work at the moment, so I will have to look into that, but I guess if I gave it a 256 contest stat instead of 512, it could again make moves with that specific stat a little more powered, this could help with younger Pokémon, I.E. First evolution, beat a 2nd or even a 3rd evo, thus allowing the better use of your favourite Pokémon.

    I'm working on the moves combined with stats at the moment, but I think I may look into the effect it gives as opposed to anything else first, I like the idea of cute allowing defence-1, and beauty infactuating.
     
    Back
    Top