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

[Question] Making Pokemon start with low HP?

31
Posts
5
Years
  • I was thinking of having a Pokemon battle in my game where the player's Pokemon start with low HP due to a problem with their pokeballs in an important battle, and was wondering if that could even be done.

    If it can, could someone point me in the right direction as to how I would script it? I'm not very good at ruby and mostly make simple lines of code/alterations. I would be very grateful.
     
    143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    Hi, this block in "PField_Battles" triggers at the start of each battle:
    Code:
    Events.onStartBattle += proc { |sender|
      # Record current levels of Pokémon in party, to see if they gain a level
      # during battle and may need to evolve afterwards
      $PokemonTemp.evolutionLevels = []
      for i in 0...$Trainer.party.length
        $PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
      end
    }
    Maybe add something along these lines:
    Code:
    Events.onStartBattle += proc { |sender|
      # Record current levels of Pokémon in party, to see if they gain a level
      # during battle and may need to evolve afterwards
      $PokemonTemp.evolutionLevels = []
      for i in 0...$Trainer.party.length
        $PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
        [B]$Trainer.party[i].hp - $Trainer.party[i].hp/2 if $game_switches[XXX][/B]
      end
    }
    This basically halves each of your Pokemon's current health. If you need further help be sure to ask. :)
     
    31
    Posts
    5
    Years
  • Hi, this block in "PField_Battles" triggers at the start of each battle:
    Code:
    Events.onStartBattle += proc { |sender|
      # Record current levels of Pokémon in party, to see if they gain a level
      # during battle and may need to evolve afterwards
      $PokemonTemp.evolutionLevels = []
      for i in 0...$Trainer.party.length
        $PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
      end
    }
    Maybe add something along these lines:
    Code:
    Events.onStartBattle += proc { |sender|
      # Record current levels of Pokémon in party, to see if they gain a level
      # during battle and may need to evolve afterwards
      $PokemonTemp.evolutionLevels = []
      for i in 0...$Trainer.party.length
        $PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
        [B]$Trainer.party[i].hp - $Trainer.party[i].hp/2 if $game_switches[XXX][/B]
      end
    }
    This basically halves each of your Pokemon's current health. If you need further help be sure to ask. :)

    Just to be sure I'm reading it correctly, I'm supposed to reserve a new switch and insert it where the XXX is, right? Just wanna be sure.
     
    143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    Just to be sure I'm reading it correctly, I'm supposed to reserve a new switch and insert it where the XXX is, right? Just wanna be sure.
    Yip, that sounds right :)
     
    31
    Posts
    5
    Years
  • Yip, that sounds right :)

    I've been trying to get it to work. It runs without any errors, but when I have the switch that I have it set to ON, my Pokemon's HP will still be full at the start of the battle. I even made a new switch to make sure it wasn't a reserved switch.

    Events.onStartBattle+=proc {|sender,e|
    $PokemonTemp.evolutionLevels = []
    for i in 0...$Trainer.party.length
    $PokemonTemp.evolutionLevels = $Trainer.party.level
    $Trainer.party.hp - $Trainer.party.hp/2 if $game_switches[127]
    end
    }


    Did I do something wrong when setting a switch to it?
     
    143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    Did I do something wrong when setting a switch to it?
    Nope, it was my mistake. I forgot to finish the calculation. A simple "=" should suffice though. :)
    Code:
    Events.onStartBattle+=proc {|sender,e|
    $PokemonTemp.evolutionLevels = []
    for i in 0...$Trainer.party.length
    $PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
    $Trainer.party[i].hp -[COLOR="Red"]=[/COLOR] $Trainer.party[i].hp/2 if $game_switches[127]
    end
    }
     
    31
    Posts
    5
    Years
  • That's like the one place I didn't try putting the = when trying to fix it before asking, omg. XD well, I'll give this a shot.
     
    Back
    Top