Help with Multiple Slip Damage Calculations

AveyondFan

Villager
Member
Joined
Sep 19, 2018
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMXP
Oh boy, here I go posting in this forum again!

So I want to make multiple poison-like effects in my game (similar to how in the Aveyond series, there's multiple kinds of damage over time effects [Poison, Toxic Poison, Weevils, Plague]). The issue I've run into is I don't know how to make it so that the slip damage, as it's called, varies between the four (or more. I'm planning on adding a bleed effect that's weaker than Poison). I know where it's calculated, Game_Battler_3 for in battle, though I'm unsure if the same region of code also effects - affects?... English is weird- the slip damage outside of battle. Probably, considering wherever slip damage is mentioned in the scripts, there's no equation for damage other than in Game_Battler_3.

The line of code I'm looking at is around line 319 in Game_Battler_3:
Code:
 #--------------------------------------------------------------------------
  # * Application of Slip Damage Effects
  #--------------------------------------------------------------------------
  def slip_damage_effect
    # Set damage
    self.damage = self.maxhp / 10
    # Dispersion
    if self.damage.abs > 0
      amp = [self.damage.abs * 15 / 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
I kind of know what I need to do to make what I want work: make it so that depending on the state's ID, the equation is different. In short, I need to attach an ID to an equation.
I just don't quite know how to do it, and I might need to edit the other scripts where slip damage is mentioned for it to work, but I'm not sure.
 

DerVVulfman

Resident Werewolf
Veteran
Joined
Jun 26, 2012
Messages
315
Reaction score
155
First Language
English
Primarily Uses
RMXP
You may wanna instead try Yeyinde's Multiple Poisons. Gotta love a guy who's avatar has been a 'Predator' since 2000.

This script allows a game to have different types of poisons. Whether the poison is a minor infection, or a serious disease, this script will suit your need for poisons.

Instructions

Insert the script into a new section above Main. Edit the BATTLE_DAMAGE and MAP_DAMAGE constant Hashes with the following format: {state_id => damage_division} where state_id is the ID of the status in the database(no leading 0s), and damage_division is the number which maxhp will be divided by to get the damage for that state (example: 100 = maxhp / 100, 25 = maxhp / 25)
If you want damage to be taken from the actor's SP, add the state id to the SP_POISONS constant array. (SP_POISONS = [3, 6] would make states 3 and 6 remove from SP)
Code:
#==============================================================================
#  ** Multiple Poisons
#------------------------------------------------------------------------------
#  Scripted by: Yeyinde
#  Version 1.1.0
#  February 1 & 2, 2007
#==============================================================================

#--------------------------------------------------------------------------
# * Initialize Constants
#--------------------------------------------------------------------------

SP_POISONS = [] # Add the state ids of SP draining poisons here
BATTLE_DAMAGE = {} # 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 = 0
    sp_damage = 0
    # 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
 

AveyondFan

Villager
Member
Joined
Sep 19, 2018
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMXP
Yeyinde's Multiple Poisons seems closest to what I'm looking for (don't ever recall finding it when looking for help before I posted the thread). Thanks guys.
 

DerVVulfman

Resident Werewolf
Veteran
Joined
Jun 26, 2012
Messages
315
Reaction score
155
First Language
English
Primarily Uses
RMXP
Hehe... Look at the date of the script. I've had it in my collection for over a decade. But to be honest, I think it got lost over the years. Gotta love what that scripting Yautja did.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,447
Members
137,820
Latest member
georg09byron
Top