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

How To Alter a Pokemon's Total HP

39
Posts
13
Years
  • Can someone please tell me how to alter a pokemon's total hp without altering it's base stats. I tried to incorporate a function in an item to increase a pokemon's totalhp, but to no avail. Is there any other way like using a scripted switch? I appreciate all help.

    Sincerely,
    HankMan.

    P.S
    Here is the item script that I used.
    if isConst?(attacker.species,PBSpecies,:REGICE) && isConst?(attacker.item,PBItems,:BIGASSICECRYSTAL)
    totalhp=2500
    end
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Can someone please tell me how to alter a pokemon's total hp without altering it's base stats. I tried to incorporate a function in an item to increase a pokemon's totalhp, but to no avail. Is there any other way like using a scripted switch? I appreciate all help.

    Sincerely,
    HankMan.

    P.S
    Here is the item script that I used.
    if isConst?(attacker.species,PBSpecies,:REGICE) && isConst?(attacker.item,PBItems,:BIGASSICECRYSTAL)
    totalhp=2500
    end

    forgot to add attacker to total hp...

    Code:
        if isConst?(attacker.species,PBSpecies,:REGICE) && isConst?(attacker.item,PBItems,:BIGASSICECRYSTAL)
          attacker.totalhp=2500
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Try this:

    In PokeBattle_Pokemon, create the following new def:

    Code:
    def totalhp[COLOR=Black]
      [/COLOR][COLOR=Black]return 2500 if isConst?(self.species,PBSpecies,:REGICE) && isConst?(self.item,PBItems,:BIGASSICECRYSTAL)[/COLOR]
      return @totalhp
    end
    This is the entirety of the item's effect. This mostly works; the rest of the changes are for coping with the spontaneous change in HP.

    In the def heal in the same script section, change @hp=@totalhp to @hp=self.totalhp.

    In the def calcStats, change the following chunk of code:

    Code:
        diff=[COLOR=Red]self.[/COLOR]totalhp-@hp
        @totalhp=stats[0]
        if @hp>0
          @hp=[COLOR=Red]self.[/COLOR]totalhp-diff
          @hp=1 if @hp<=0
          @hp=[COLOR=Red]self.[/COLOR]totalhp if @hp>[COLOR=Red]self.[/COLOR]totalhp
        end
    You will also need to recalculate the Pokémon's current HP whenever its item is gained or lost. There's more involved here than above, but it's an exercise I leave to you.

    Tip: The easiest way around it is to simply set the Pokémon's current HP to full when it gains or loses its item (rather than fiddling around with proportions of HP before and after the give/loss). This isn't the same as healing it, mind you - healing also restores PP and removes status problems. Make sure this HP restoration only occurs for this particular Pokémon/item combination. There will be a number of places in the scripts you'll need to change for this (basically whenever a Pokémon could gain or lose its item, usually in the Party screen, storage or in battle), but it'll be the same change each time.


    EDIT: Don't use Ho-oh's method, it's wrong.
     
    39
    Posts
    13
    Years
  • Alright, thank you Maruno. But does it work the same way if I change isConst?(self.item,PBItems,:BIGASSICECRYSTAL) with $game_switches[35]
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    It should do, yes.

    Given your scenario, though, replacing the phrase with a game switch is a really bad idea, because it'd be so much more work to make sure it's TRUE/FALSE at the right time (i.e. when item X is being held by a Pokémon of species Y).

    If you wanted to make it map-dependent, though (i.e. huge HP only when on map 42 where it's encountered), then using a game switch is just as easy as checking the held item - simply call the switch s:$game_map.map_id==42 to have it be TRUE/FALSE at the right time.
     
    189
    Posts
    14
    Years
    • Seen Nov 23, 2023
    Hey Maruno, do you think it would be possible to do something similar to this in a battle? See, they way things are now, you could fell pretty much any Pokemon in one hit with the right combination of moves and types etc. I think it would be pretty cool to have "boss" Pokemon, with unnaturally high HP for the duration of the battle. Could be applied to legendaries or the evil team or whatever. Not that I intend to implement such a feature any time soon, I'm not developing at the moment. Just out of curiosity.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Of course. You'd do it in the same way I've already mentioned. Have the changes depend on the species and a particular Global Switch, and then turn the Switch on just before the battle and off just after it. Depending on your plans, particularly if you have multiple boss Pokémon, you may need more complicated options (i.e. combinations of species/switches/whatever).
     
    39
    Posts
    13
    Years
  • Hmmm... It seems like that switch method does not work for me. This is the full script:
    def totalhp
    return 700 if isConst?(self.species,PBSpecies,:REGICE) && $game_switches[37]
    return @totalhp
    end

    I also changed the things in heal and CalcStats. Am I missing anything? I also used a script name for the switch 37.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I would guess your problem is in the switch name (because the rest is fine, and works for me). Call it "Dave" and toggle it manually, see if that works. Then work from there.

    As I've said, you'll also need to recalculate the Pokémon's current HP whenever the max HP changes. How you do this depends very much on exactly how/when you want to change the max HP.
     
    39
    Posts
    13
    Years
  • Changing the switch name, the totalhp of the boss pokemon still wasn't 700. Before changing, the switch had this name: s:$game_map.map_id==39. Are there any other solutions, or should I just give it a second forme with altered base stats?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I've had it working for me, doing exactly what I said (without fancy switch names; I used the original example of a species + held item). If it's still not working for you, I would suggest you start again.

    You may not have changed all the required @totalhp to self.totalhp. It's the difference between using the calculated value it would normally have, and running the def which forces the boss value. Also, make sure the new def is within the class PokeBattle_Pokemon, i.e. anywhere before the final end of the script section.

    If you used an alternate form for the boss fight, you would still need to change the form at the appropriate points. This is probably more complicated than flip the switch on/off around the boss battle, and having an alternate form introduces many other problems anyway. The major problem is that a base stat can only go up to 255, which results in an absolute maximum HP of 714 (for a Level 100 Pokémon with perfect IVs/EVs in the HP stat) - this is highly impractical, and impossible if you wanted a higher HP.

    To summarise, start again and do the following:
    In PokeBattle_Pokemon, create the following new def:

    Code:
    def totalhp[COLOR=Black]
      [/COLOR][COLOR=Black]return 700 if isConst?(self.species,PBSpecies,:REGICE) && $game_switches[37][/COLOR]
      return @totalhp
    end
    In the def heal in the same script section, change @hp=@totalhp to @hp=self.totalhp.

    In the def calcStats, change the following chunk of code:

    Code:
        diff=[COLOR=Red]self.[/COLOR]totalhp-@hp
        @totalhp=stats[0]
        if @hp>0
          @hp=[COLOR=Red]self.[/COLOR]totalhp-diff
          @hp=1 if @hp<=0
          @hp=[COLOR=Red]self.[/COLOR]totalhp if @hp>[COLOR=Red]self.[/COLOR]totalhp
        end
    While Global Switch 37 is ON, all Regice will have 700 total HP.
    I have just tried doing exactly this (I toggled the switch myself rather than naming it something clever), and it works for me (albeit with the aforementioned issue of the current HP value, which as I said is something for you to fix yourself).
     
    39
    Posts
    13
    Years
  • i.e. anywhere before the final end of the script section.
    How To Alter a Pokemon's Total HP

    ... I sometimes hate being 13 years old... But thank you for putting up with this dumbass, Maruno. Really appreciate it. But other than that, with your help, this fangame of mine's going real good. I'll post it in the beginner's section when I feel it's long enough. You have my greatest thanks, and my deepest apologies.

    ~HankMan

    After a few hours of racking my brain, I found out how to fight a Regice with 700 hp at FULL hp.

    Le code:
    def totalhp
    return 700 if isConst?(self.species,PBSpecies,:REGICE) && $game_switches[37]
    return @totalhp
    end

    def hp
    return 700 if isConst?(self.species,PBSpecies,:REGICE) && $game_switches[37]
    return @hp
    end

    How To Alter a Pokemon's Total HP
     
    Last edited:
    Back
    Top