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.

a tweak for Yeyinde's script...

i was using Yeyinde's MULTIPLE POISONS script to make a regen/resurge effect for my game. the problem is that when i use it the effect regenerates hp and sp at the same time, instead one regenerating hp and one regenerating sp.

here's the script
Code:
#==============================================================================

#  ** Multiple Poisons

#------------------------------------------------------------------------------

#  Scripted by: Yeyinde

#  Version 1.1.0

#  February 1 & 2, 2007

#==============================================================================

 

#--------------------------------------------------------------------------

# * Initialize Constants

#--------------------------------------------------------------------------

 

SP_POISONS = [13] # Add the state ids of SP draining poisons here

BATTLE_DAMAGE = {12 => -10} # Format: state_id => damage_division

BATTLE_DAMAGE.default = 10 # Do not change

MAP_DAMAGE = {} # Format: state_id => damage_division

MAP_DAMAGE.default = 100 # Do not change

 

# Damage correction (To prevent /0 errors)

# DO NOT EDIT!

BATTLE_DAMAGE.each do |state_id, damage|

  BATTLE_DAMAGE[state_id] = BATTLE_DAMAGE.default if damage == 0

end

MAP_DAMAGE.each do |state_id, damage|

  MAP_DAMAGE[state_id] = MAP_DAMAGE.default if damage == 0

end

 

#==============================================================================

# ** Game_Battler

#------------------------------------------------------------------------------

#  This class deals with battlers. It's used as a superclass for the Game_Actor

#  and Game_Enemy classes.

#==============================================================================

 

class Game_Battler

  #--------------------------------------------------------------------------

  # * Application of Slip Damage Effects - Overwrite

  #--------------------------------------------------------------------------

  def slip_damage_effect

    # Set damage

    self.damage = -10

    sp_damage = -10

    # Branch per state held

    @states.each do |i|

      # If the state has slip damage

      if $data_states[i].slip_damage

        # Add to damage

        if SP_POISONS.include?(i)

          sp_damage += self.maxsp / BATTLE_DAMAGE[i]

        else

          self.damage += self.maxhp / BATTLE_DAMAGE[i]

        end

      end

    end

    # Dispersion

    if self.damage.abs > 0

      amp = [self.damage * 15 / 100, 1].max

      self.damage += rand(amp+1) + rand(amp+1) - amp

    end

    if sp_damage.abs > 0

      amp = [sp_damage * 15 / 100, 1].max

      sp_damage += rand(amp+1) + rand(amp+1) - amp

    end

    # Subtract damage from HP and SP

    self.hp -= self.damage

    self.sp -= sp_damage

    # End Method

    return true

  end

end

 

 

#==============================================================================

# ** Game_Party

#------------------------------------------------------------------------------

#  This class handles the party. It includes information on amount of gold

#  and items. Refer to "$game_party" for the instance of this class.

#==============================================================================

 

class Game_Party

  #--------------------------------------------------------------------------

  # * Slip Damage Check (for map) - Overwrite

  #--------------------------------------------------------------------------

  def check_map_slip_damage

    # Branch per actor

    @actors.each do |actor|

      # If actor has more than 0 HP and has a slip damage state

      if actor.hp > 0 and actor.slip_damage?

        # Set damage

        damage = 0

        sp_damage = 0

        # Branch per state held

        actor.states.each do |i|

          # If the state has slip damage

          if $data_states[i].slip_damage

            # Add to damage

            if SP_POISONS.include?(i)

              sp_damage += actor.maxsp / MAP_DAMAGE[i]

            else

              damage += actor.maxhp / MAP_DAMAGE[i]

            end

          end

        end

        # Take damage

        if damage > 0

          actor.hp -= [damage, 1].max

        elsif damage < 0

          actor.hp -= [damage, -1].min

        end

        # Take SP damage

        if sp_damage > 0

          actor.sp -= [sp_damage, 1].max

        elsif sp_damage < 0

          actor.sp -= [sp_damage, -1].min

        end

        # If the actor has no more HP

        if actor.hp == 0

          # Play the actor collapse SE

          $game_system.se_play($data_system.actor_collapse_se)

        end

        # Flash the screen to indicate damage

        if damage > 0 or sp_damage > 0

          $game_screen.start_flash(Color.new(255,0,0,128), 4)

        elsif damage < 0 or sp_damage < 0

          $game_screen.start_flash(Color.new(0,255,0,128), 4)

        end

        # Go to game over if the party is all dead

        $game_temp.gameover = $game_party.all_dead?

      end

    end

  end

end

is there a fix for this?
 

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