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

[Scripting Question] [v20.1] Boss Battle features (HP modify)

9
Posts
4
Years
    • Seen Apr 18, 2024
    Hi! I need some help about programming a BossBattle function.

    I know GolisopodUser made a script about it, but it's for version 18 and also has too many things that don't interest me (like boosts, totems...). I need something much simpler.

    So what I really need is a wild battle, with a few small presets, nothing more.

    I've done that simple little thing, but it works (only cannot run + disable pokeballs):

    Code:
    class BossBattle
      def self.start(pkmn)
        setBattleRule("cannotRun")
        setBattleRule("disablePokeBalls")
        WildBattle.start(pkmn)
      end
    end

    And then I call it like this with an event (for exemple, simulating the Lake of Rage):

    Code:
    Pokemon.play_cry(:GYARADOS)
    pkmn = Pokemon.new(:GYARADOS, 30)
    pkmn.shiny = true
    BossBattle.start(pkmn)

    So, it's just a slightly modified pokemon, and then I call WildBattle.Start() with some little BattleRules.

    The QUESTION is, is there any possibility to modify the HP of the boss intrinsically? (duplicate it, for example)

    Something like this:

    Code:
    pkmn.hp *= 2
    # or pkmn.totalhp *= 2

    Or something similar that allows me to modify the Boss hp? (obviously in v20.1)

    If possible, without using switches (completely unnecessarily), since in the future I would like to do more stuff, like changing the UI for Boss Battles...

    Thank you very much for the help!
     
    1,407
    Posts
    10
    Years
    • Seen yesterday
    Not without changing how stat calculations work. You cant just increase HP to a number you want, HP is calculated as part of the calc_stats formula. So you'd have to add some sort of criteria to that formula that doubles the total, but only if the specific Pokemon is flagged as a boss, and then make it so after capture the Pokemon is unflagged as a boss and have its HP recalculated so it returns to its normal amount.

    This is essentially how Dynamax HP works and is calculated in the ZUD plugin, except obviously it checks for a Dynamax flag instead of a boss flag.
     
    9
    Posts
    4
    Years
    • Seen Apr 18, 2024
    Thanks you so much! Lucidious89

    It worked! I don't need it to go back to normal HP as they won't be catchable.

    I have simply overwritten:
    Code:
    class Pokemon
      def calc_stats(hp_boss = 0)
        # [ ... ]
        @hp = @totalhp *= hp_boss if (hp_boss != 0)
      end
    end

    And then, set the event:
    Code:
    Pokemon.play_cry(:GYARADOS)
    pkmn = Pokemon.new(:GYARADOS, 30)
    pkmn.shiny = true
    pkmn.calc_stats(3) # x3 HP, for exemple
    BossBattle.start(pkmn)

    Probably not the best way, but it seems to work :D

    Thanks you again, Lucidious89
     
    Back
    Top