The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: cozziekuns on June 23, 2011, 11:36:13 PM

Title: Show Slip Damage
Post by: cozziekuns on June 23, 2011, 11:36:13 PM
Show Slip Damage
Version: 1.3a
Author: cozziekuns
Date: June 23, 2011

Version History



Planned Future Versions


Description


A system designed to show the amount of slip damage dealt to both actors and enemies. Originally found in my Tales of Icarus Script Package.

Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi31.tinypic.com%2Fxf4104.png&hash=8e3d186d8f4790c44f69271ee78b7dda5c269e96)

Sorry kids, the battle system doesn't come with the script.

Instructions

To install this script, open up your script editor and copy/paste this script to an open slot below ? Materials but above ? Main. Remember to save.

Script


Code: [Select]
#===============================================================================

# Cozziekuns Show Slip Damage
# Last Date Updated: 7/22/2011
#
# A system designed to show the amount of slip damage dealt to both actors and
# enemies.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 06/13/10 - Created Script.
# o 07/13/10 - After 1 whole month, updated with an error that Modern Algebra
#              came across.
# o 06/23/11 - Wow its really been a whole year. Updated because I saw how flimsy
#              my code was in a script request topic.
# o 07/22/11 - Updated with Mr G&W's Bugfix.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Compatibility with most popup scripts and other battle systems. (Though it's
#   usually already built into those type of scripts.)
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozShowSlipDamage"] = true

module COZZIEKUNS
  module SHOW_SLIP_DAMAGE
    SLIP_DAMAGE_STRING = " damage due to" # Text you want after "Actor took xxxx".
    WAIT = 90 # How many frames you want the slip damage message to stay on the screen.
  end
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :slip_damage_message
  #--------------------------------------------------------------------------
  # * Application of Slip Damage Effects
  #--------------------------------------------------------------------------
  alias coz_sd_gb_slip_damage_effect slip_damage_effect
    def slip_damage_effect
    coz_sd_gb_slip_damage_effect
    array = " "
    if slip_damage? and @hp > 0
      for state in states
        array += " and " if (array != " " and state.slip_damage)
        array += state.name if state.slip_damage
      end
      @slip_damage_message = "#{self.name} took #{self.hp_damage}" +
      COZZIEKUNS::SHOW_SLIP_DAMAGE::SLIP_DAMAGE_STRING + array + "."
    end
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * End Turn
  #--------------------------------------------------------------------------
  def turn_end
    $game_troop.turn_ending = true
    $game_party.slip_damage_effect
    for i in 0...$game_party.members.size
      for state in $game_party.members[i].states
        if state.slip_damage
          unless $game_party.members[i].dead?
            $game_troop.screen.start_shake(5, 5, 10)
            @message_window.replace_instant_text($game_party.members[i].slip_damage_message)
            Sound.play_actor_damage
            wait(COZZIEKUNS::SHOW_SLIP_DAMAGE::WAIT)
    break
          end
        end
      end
    end
    $game_troop.slip_damage_effect
    for i in 0...$game_troop.members.size
      for state in $game_troop.members[i].states
        if state.slip_damage
          unless $game_troop.members[i].dead?
            $game_troop.members[i].blink = true
            @message_window.replace_instant_text($game_troop.members[i].slip_damage_message)
            Sound.play_enemy_damage
            wait(COZZIEKUNS::SHOW_SLIP_DAMAGE::WAIT)
            $game_troop.members[i].slip_damage_message = nil
    break
          end
        end
      end
    end
    $game_party.do_auto_recovery
    $game_troop.preemptive = false
    $game_troop.surprise = false
    process_battle_event
    $game_troop.turn_ending = false
    start_party_command_selection
  end
end

Credit



Thanks


Support


Just post down below.

Known Compatibility Issues

Probably won't work with any custom battle systems, but most have this built in anyways.
Title: Re: Show Slip Damage
Post by: strike on June 24, 2011, 01:08:58 AM
Slip damage?
Title: Re: Show Slip Damage
Post by: cozziekuns on June 24, 2011, 01:09:58 AM
Damage from states like Poison and Burn.
Title: Re: Show Slip Damage
Post by: pacdiggity on June 24, 2011, 07:59:32 AM
You're very welcome.

PAC'd. I would've written my own but it was early in the morning and I was running late.
Actually, I think I might now.
Title: Re: Show Slip Damage
Post by: Mr G W on July 14, 2011, 01:51:42 PM
Ive noticed that if you have multiple states.

For example if you have 2 states.

It will say: Took damage from Poison and .

3 states

Took damage from Poison and and .

If you have multiple Slip Damage states it will show them in separate textboxes (the screen shakes twice too):

Took damage from Poison and Burn.
Took damage from Poison and Burn.


If you have multiple slip damage states and other state it will show something like this.

Took damage from Poison and Burn and .
Title: Re: Show Slip Damage
Post by: cozziekuns on July 14, 2011, 03:57:20 PM
Thanks and fixed.
Title: Re: Show Slip Damage
Post by: Mr G W on July 22, 2011, 02:46:11 PM
The glitch with the "Took damage from Poison and and and and ." is still there but it can be fixed by replacing this line (line 60 or so)

Code: [Select]
        array += " and " if array != " "

with this

Code: [Select]
        array += " and " if (array != " " and state.slip_damage)


Title: Re: Show Slip Damage
Post by: cozziekuns on July 22, 2011, 04:14:20 PM
Funny.. It works on my end even without that fix. Oh well, better safe then sorry. Thanks Mr. GW!
Title: Re: Show Slip Damage
Post by: Mr G W on July 23, 2011, 11:02:30 AM
Thats odd, it showed me that when i had other non slip damage buffs. Well guess its all good now. This script will be very useful for me.