• 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!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our 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.

How to Lower a Pokemon HP outside of battle by a Bit

Sir_Tman

Overworked game Dev
  • 198
    Posts
    9
    Years
    Right what im trying to do is lower the first pokemon (or all if possible) by a bit every 40 sec or so and I don't mean
    Code:
    poke=pbFirstAblePokemon(1)
    poke.hp=20
    Because it just sets the pokemons health to 20.

    Idealy I want this to be a parrel procces event on a map.
    I know how I want my event set up I just need to know how to lower a pokemons hp by a bit.

    And if its any context im useing the latest version of essentials.
     
    Right what im trying to do is lower the first pokemon (or all if possible) by a bit every 40 sec or so and I don't mean
    Code:
    poke=pbFirstAblePokemon(1)
    poke.hp=20
    Because it just sets the pokemons health to 20.

    Idealy I want this to be a parrel procces event on a map.
    I know how I want my event set up I just need to know how to lower a pokemons hp by a bit.

    And if its any context im useing the latest version of essentials.

    Why not poke.hp-=20? That should reduce it, instead of setting it to a number, no?
     
    Simple, this already exists in the world of Pokémon.
    Code:
    # Poison event on each step taken
    Events.onStepTakenTransferPossible+=proc {|sender,e|
      handled=e[0]
      next if handled[0]
      if $PokemonGlobal.stepcount % 4 == 0 && POISONINFIELD
        flashed=false
        for i in $Trainer.party
          if i.status==PBStatuses::POISON && i.hp>0 && !i.egg? &&
             !isConst?(i.ability,PBAbilities,:POISONHEAL)
            if !flashed
              $game_screen.start_flash(Color.new(255,0,0,128), 4)
              flashed=true
            end
            if i.hp==1 && !POISONFAINTINFIELD
              i.status=0
              Kernel.pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\\1",i.name))
              next
            end
            i.hp-=1
            if i.hp==1 && !POISONFAINTINFIELD
              i.status=0
              Kernel.pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\\1",i.name))
            end
            if i.hp==0
              i.changeHappiness("faint")
              i.status=0
              Kernel.pbMessage(_INTL("{1} fainted...\\1",i.name))
            end
            handled[0]=true if pbAllFainted
            pbCheckAllFainted()
          end
        end
      end
    }
    Copy this and the functions that are used to get this working... Then edit accordingly.
     
    Well I came up with this. A while ago.
    Spoiler:

    Note:The Players position X is for this map because its a connected map and would keep working whilst on the next map.

    But Ideal I've done what I want to do.
    So this questions been answered thanks guys.
     
    Back
    Top