• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Akari, Red, Kris, May - which Pokémon protagonist is your favorite? Let us know by voting in our semifinal favorite protagonist poll!
  • 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.

[Question] Implementing Low HP warning sound

  • 1
    Posts
    6
    Years
    • Seen Jan 22, 2022
    So I'm fairly poor at this it would seem.

    At the moment the version of essentials I'm working from did not trigger a sound when a Pokemon gets below 25% HP.

    I did some digging and some research, but didn't get to where I wanted to be. I was looking through PokeBattle_ActualScene, and saw this:

    • hpzone=2 if self.hp<=(@battler.totalhp/4).floor

    and was trying to utilize this in tandem with pbSEPlay("[NameHere]"). Taking into consideration it only plays when HP crosses that threshold, i.e. when the current HP is above 25% and the new HP is below 25%. I tried playing around with the variables @currenthp, @endhp newhp, oldhp. However I can't figure out a way to reference current HP and end HP to the battler's total HP.

    In short this should be fairly simple, but I'm a simple person and can't figure out how exactly to get this to work the way it should. Any help would be appreciated, thanks!
     
    Back
    Top