Help - Search - Members - Calendar
Full Version: Please Kill Me.
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
RandSummers
I've spent the last... seven hours (longer than it felt actually) trying to get this damn script to work but for the life of me it doesnt.

I can get it to lower my life (but it always lowers the same number 7 of my 75HP) regardless of what number's I put in there.

I wanted one regen life skill... just the one... just 5% per round for 10 rounds. That's it... but it cant happen. :|

I don't understand what is wrong.

So someone, please either take this handy power drill I carry with me for just this occasion and insert it slowly into my brain rendering me profoundly dead... or a little help would be greatly appreciated.

I know it sounds anal but varying levels of damage is actually kinda important for what I am doing.

Please Help Me.
Please Dont Drill My Brain. confused.gif

But I trust you guys to do whatever it is you need to do to make the hurting stop.
Helios
Explain what you did. The code you used, and where you put them.
Kread-EX
This is a very confusing thread and if it concerns a script, it should be to RGSS2 Script Support, so moved.

Just give us the erroneous part, or we can't help you.
RandSummers
Thanks Kread.

I used KGC_SlipDamageExtension script.

Which looks like this:


Script
CODE
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ �—† Slip Damage - KGC_SlipDamageExtension �—† VX �—†
#_/ �—‡  Last Update: 03/29/2008
#_/ �—† Written by TOMY    
#_/ �—† Translation by Mr. Anonymous                  
#_/ �—† KGC Site:                                                  
#_/ �—†  [url="http://ytomy.sakura.ne.jp/"]http://ytomy.sakura.ne.jp/[/url]                                  
#_/ �—† Translator's Blog:                                            
#_/ �—†  [url="http://mraprojects.wordpress.com"]http://mraprojects.wordpress.com[/url]    
#_/-----------------------------------------------------------------------------
#_/  This script allows you to make states with "slip damage" or continual
#_/   damage/recovery outside of battle. This effect is accompanied by a screen
#_/   flash to indictate everytime the actor recieves damage/recovery.
#_/  Recall the "Poisoned" state in Pokemon.
#_/=============================================================================
#_/                         �—† Instructions For Usage �—†
#_/  To make use of this function, you must insert the <slip> tag into the
#_/   "Notes" box located in the States section of the database.
#_/  
#_/                Format: <slip [HP/MP] Modifier Rate (%), Steps>
#_/   Where HP/MP: Designate HP or MP damage/recovery.
#_/   Where Modifier: Use [ - ] or damage or [ + ] for recovery.
#_/   Where Rate: The desired amount of damage/recovery.
#_/   Where %: [Optional] You may insert % after rate for Max HP or Max MP.
#_/   Where Steps: The amount of steps it takes for the effect to kick in.
#_/
#_/   Ex: <slip HP -5%, 5>
#_/    For every 5 steps, 5 percent of the actor's max hp is lost.
#_/  
#_/   Ex: <slip MP +20, 10>
#_/    For every 10 steps, 20 MP is recovered.
#_/
#_/   Ex: <slip MP -10%>
#_/    After every turn in battle, 10 percent of MP is lost.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                            �˜… Customization �˜…                                 #
#==============================================================================#

module KGC
module SlipDamageExtension
  #                     �—† Damage Indictation Flash �—†
  #  This allows you to change the color of the flash that happens when the
  #   actor loses or gains health due to the Slip Damage state.
  DAMAGE_FLASH_COLOR    = Color.new(255, 0, 0, 64)
  #  This allows you to change the duration (in frames) the flash remains
  #   on-screen.
  DAMAGE_FLASH_DURATION = 4
end
end

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

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

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tag used for "Notes" in database.     #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #

#  Whatever word(s) are after the separator ( | ) in the following lines are
#   what are used to determine what is searched for in the "Notes" section of a
#   skill to see if it is an Steal skill.
#  Default Slip Damage State tag is <slip>

module KGC::SlipDamageExtension
  # Regular exp​ression Module
  module Regexp
    # State Module
    module State
      # Slip Damage tag string
      SLIP_DAMAGE = /<(?:SLIP|slip)\s*([HM]P)?\s*([\-\+]?\d+)([%�…])?
        (?:\s*,\s*([\-\+]?\d+))?>/ix
    end
  end
end

#==============================================================================
# �–� RPG::State
#==============================================================================

class RPG::State
  #--------------------------------------------------------------------------
  # �—‹ �€Œ�‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚��‹
張�€�の�‚��ƒ��ƒƒ�‚��ƒ��”Ÿ�ˆ�
  #--------------------------------------------------------------------------
  def create_slip_damage_extension_cache
    @__slip_damage = false
    @__slip_damage_hp_rate  = 0
    @__slip_damage_hp_value = 0
    @__slip_damage_hp_map   = 0
    @__slip_damage_mp_rate  = 0
    @__slip_damage_mp_value = 0
    @__slip_damage_mp_map   = 0

    self.note.split(/[\r\n]+/).each { |line|
      case line
      when KGC::SlipDamageExtension::Regexp::State::SLIP_DAMAGE
        # �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�
        @__slip_damage = true
        analyse_slip_damage($~)
      end
    }

    # �ƒ‡�ƒ•�‚��ƒ��ƒˆの�‚��ƒ��ƒƒ�ƒ—�ƒ
€�ƒ��ƒ��‚��‡��‚’設�š
    unless @__slip_damage
      @__slip_damage_hp_rate = 10
      @__slip_damage_hp_map = 1
    end
  end
  #--------------------------------------------------------------------------
  # �—‹ �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�の解�ž�
  #--------------------------------------------------------------------------
  def analyse_slip_damage(match)
    # �‚��‚��ƒ—�ˆ��š
    if match[1] == nil
      type = :hp
    else
      if match[1] =~ /MP/i
        type = :mp
      else
        type = :hp
      end
    end
    # �ƒ€�ƒ��ƒ��‚��‡��–�—
    n = match[2].to_i
    # 即�€� or �‰��ˆ�ˆ��š
    is_rate = (match[3] != nil)
    # �ƒž�ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚��–�—
    map_n = (match[4] != nil ? match[4].to_i : 0)

    # �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚��€��Š
�—
    case type
    when :hp
      if is_rate
        @__slip_damage_hp_rate -= n
      else
        @__slip_damage_hp_value -= n
      end
      @__slip_damage_hp_map -= map_n
    when :mp
      if is_rate
        @__slip_damage_mp_rate -= n
      else
        @__slip_damage_mp_value -= n
      end
      @__slip_damage_mp_map -= map_n
    end
  end
  #--------------------------------------------------------------------------
  # �—� �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�
  #--------------------------------------------------------------------------
  unless $@
    alias slip_damage_KGC_SlipDamageExtension slip_damage
  end
  def slip_damage
    create_slip_damage_extension_cache if @__slip_damage == nil
    return (@__slip_damage || slip_damage_KGC_SlipDamageExtension)
  end
  #--------------------------------------------------------------------------
  # �—‹ HP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (�‰��ˆ)
  #--------------------------------------------------------------------------
  def slip_damage_hp_rate
    create_slip_damage_extension_cache if @__slip_damage_hp_rate == nil
    return @__slip_damage_hp_rate
  end
  #--------------------------------------------------------------------------
  # �—‹ HP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (即�€�)
  #--------------------------------------------------------------------------
  def slip_damage_hp_value
    create_slip_damage_extension_cache if @__slip_damage_hp_value == nil
    return @__slip_damage_hp_value
  end
  #--------------------------------------------------------------------------
  # �—‹ HP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (�ƒž�ƒƒ�ƒ—)
  #--------------------------------------------------------------------------
  def slip_damage_hp_map
    create_slip_damage_extension_cache if @__slip_damage_hp_map == nil
    return @__slip_damage_hp_map
  end
  #--------------------------------------------------------------------------
  # �—‹ MP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (�‰��ˆ)
  #--------------------------------------------------------------------------
  def slip_damage_mp_rate
    create_slip_damage_extension_cache if @__slip_damage_mp_rate == nil
    return @__slip_damage_mp_rate
  end
  #--------------------------------------------------------------------------
  # �—‹ MP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (即�€�)
  #--------------------------------------------------------------------------
  def slip_damage_mp_value
    create_slip_damage_extension_cache if @__slip_damage_mp_value == nil
    return @__slip_damage_mp_value
  end
  #--------------------------------------------------------------------------
  # �—‹ MP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚� (�ƒž�ƒƒ�ƒ—)
  #--------------------------------------------------------------------------
  def slip_damage_mp_map
    create_slip_damage_extension_cache if @__slip_damage_mp_map == nil
    return @__slip_damage_mp_map
  end
end

#�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜
�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†
�˜…�˜†�˜…�˜†�˜…�˜†�
˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�
˜…�˜†�˜…

#==============================================================================
# �–� Game_Battler
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # �—� �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�の�Š��
œ適�”�
  #--------------------------------------------------------------------------
  def slip_damage_effect
    return unless slip_damage?

    slip_damage_effect_hp
    slip_damage_effect_mp
  end
  #--------------------------------------------------------------------------
  # �—‹ HP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�の�Š��
œ適�”�
  #--------------------------------------------------------------------------
  def slip_damage_effect_hp
    return if dead?

    n = 0
    self.states.each { |state|
      next unless state.slip_damage
      n += self.maxhp * state.slip_damage_hp_rate / 100
      n += state.slip_damage_hp_value
    }
    return if n == 0

    @hp_damage = [n, self.hp - 1].min
    self.hp -= @hp_damage
  end
  #--------------------------------------------------------------------------
  # �—‹ MP �‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��‚�の�Š��
œ適�”�
  #--------------------------------------------------------------------------
  def slip_damage_effect_mp
    return if dead?

    n = 0
    self.states.each { |state|
      next unless state.slip_damage
      n += self.maxmp * state.slip_damage_mp_rate / 100
      n += state.slip_damage_mp_value
    }
    return if n == 0

    @mp_damage = [n, self.mp - 1].min
    self.mp -= @mp_damage
  end
  #--------------------------------------------------------------------------
  # �—‹ 歩�Œ�™‚の�‚��ƒ��ƒƒ�ƒ—�ƒ€�ƒ��ƒ��
�の�Š��žœ適�”�
  #--------------------------------------------------------------------------
  def slip_damage_effect_on_walk
    last_hp = self.hp
    last_mp = self.mp
    self.states.each { |state|
      next unless state.slip_damage
      self.hp -= state.slip_damage_hp_map
      self.mp -= state.slip_damage_mp_map
    }
    # �ƒ€�ƒ��ƒ��‚��‚’�—�‘�Ÿ場�ˆは�ƒ•
ƒ��ƒƒ�‚��ƒ�
    if self.hp < last_hp || self.mp < last_mp
      $game_map.screen.start_flash(
        KGC::SlipDamageExtension::DAMAGE_FLASH_COLOR,
        KGC::SlipDamageExtension::DAMAGE_FLASH_DURATION)
    end
  end
  #--------------------------------------------------------------------------
  # �—‹ 歩�Œ�™‚の�‡��‹•�›ž復の�Ÿ�Œ
  #--------------------------------------------------------------------------
  def do_auto_recovery_on_walk
    return if dead?

    if auto_hp_recover
      self.hp += 1
    end
  end
end

#�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜
�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†
�˜…�˜†�˜…�˜†�˜…�˜†�
˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�˜…�˜†�
˜…�˜†�˜…

#==============================================================================
# �–� Game_Party
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # �—� �ƒ—�ƒ��‚��ƒ��ƒ��Œ 1 歩�‹•�„�Ÿときの�‡��†
  #--------------------------------------------------------------------------
  def on_player_walk
    for actor in members
      if actor.slip_damage?
        actor.slip_damage_effect_on_walk
      end
      actor.do_auto_recovery_on_walk
    end
  end
end


I did what it said in the instructions. I wanted to make a "bleeding" state that meant that the player took 5% HP damage and was not cured after combat so I tried the following combinations

<slip HP -5%>
<slip HP, -5%>
<slip HP, 5%, 5>

Nothing happened.
So I tried:

<slip HP 5%>
<slip HP 5%, 1>

Still nothing happened.

Oddly...

<slip HP 10, -10> results in 10 HP being taken each step.
<slip HP X, Y>

Where X is any positive number heals me Y (but only a flat number never a %)

I'm sorry this seems so confusing, I'm just as confused as you.

In the write up it says I should be able to just put something like

<slip HP -5%, 1>

And they should take 5% HP each turn/step right?

I swear on my mothers grave I have not fiddled, touched, or in any other way done anything to the script so I have NO IDEA what is going on.


(I've seen the pro's here put the code in spoiler tags but I seemed to have failed at even that simple task, sorry guys.) happy.gif
Kread-EX
For positive values, you need to put a + before the number.
Helios
The author actually made a mistake in description. He fixed it on 2009/09/13 as shown on his update log... so you just happened to stumble upon his legacy wink.gif

Anyway,

<slip HP X, Y>

The X means HP change per turn in battle (Add % for percentage), the Y means HP change per step on the map (note % have no effect here), same for MP. And + is not required, positive value will always heal.
RandSummers
Thanks so much guys. I'll give it a whirl and let you know if everything is up and running... but that is going to have to be after I walk the dogs. happy.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.