Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Different Poison Does Different Damage

Shiro

Member

As we know, poison does 10% of the user's MaxHP every turn.

But say I want to do...

Light poison - 5%
Poison - 10%
Heavy Poison - 20%

Is there anyway I can configure the amount of damage poison does for round?
 

Shiro

Member

While that information is very important, I'm afraid I wasn't as clear as I thought :( So I apologize.

What I want is a way to do this...

State 1 - 5% damage
State 2 - 10% damage
State 3 - 20% damage

Different states do different poison damage. Again, apologies for not being clear. And apologies if you did answer my question correctly but I just don't get it for some reason. :(
 
This should be a quickie

A Bit more powerful than what you asked

Code:
module Poison_Setup
  #--------------------------------------------------------------------------
  # * Posion Damage Formulas
  #   - syntax: state_id => string
  #   - Note: see Game_Battler 1 for variables for (stat) based damage
  #--------------------------------------------------------------------------
  Formula = {
  }
  #--------------------------------------------------------------------------
  # * Default Formula (10% Max Hp)
  #--------------------------------------------------------------------------
  Formula.default = 'self.maxhp / 10'
  #--------------------------------------------------------------------------
  # * Variance
  #   - syntax: state_id => variance
  #--------------------------------------------------------------------------
  Variance = {
  }
  #--------------------------------------------------------------------------
  # * Default Variance
  #--------------------------------------------------------------------------
  Variance.default = 15
end

class Game_Battler
  #--------------------------------------------------------------------------
  # * Application of Slip Damage Effects
  #--------------------------------------------------------------------------
  def slip_damage_effect
    # Declare State ID a local variable
    state_id = 0
    # Run Through and if slip damage break
    @states.each {|state_id| break if $data_states[state_id].slip_damage}
    # Set damage
    self.damage = eval(Poison_Setup::Formula[state_id]).to_i
    # Dispersion
    if self.damage.abs > 0
      variance = Poison_Setup::Variance[state_id].to_i
      amp = [self.damage.abs * variance / 100, 1].max
      self.damage += rand(amp+1) + rand(amp+1) - amp
    end
    # Subtract damage from HP
    self.hp -= self.damage
    # End Method
    return true
  end
end

But It only does this for the highest rated poison status effect if you want it for every poison status that would be a bit more complicated (multiple damage displaying at once).

Untested but it should work, let me know if you have any trouble
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top