RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Variable state damage

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 71
RMRK Junior
Code: [Select]
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ?            Slip Damage - KGC_SlipDamageExtension            ? VX ?
#_/    ?                   Last Update: 2008/03/29                        ?
#_/    ?                Translation by Mr. Anonymous                      ?
#_/-----------------------------------------------------------------------------
#_/  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 Expression 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
Looking to have a script made that would enable the slip damage of states to vary. Preferably through use of note tags. Here's an example of what I had in mind (and I suppose this could be edited into the existing script which I linked above. Also, that script already contains the <slip> function seen in the example):

Example:
<slip -1600>
<atk_f 100>

Where <atk_f> would make the slip damage be affected by the player's attack stat. I'm not sure if it'd matter, but I'd like the amounts to scale exactly as they do with skills. I would like this to be done also with spirit (<spi_f>) and if possible I'd like it to be able to affect skills as well (in case you want a skill to be influenced by more than 200), but also so that if used with a skill, the default set in the database is over-written with what is in the notebox (so that if you have 100 in the database and <atk_f 200> in the notebox, it'll use 200, rather than 100). I don't know if there needs to be a numerical scale to represent acceptable numbers for use or not, but if so, I'd like the scale to be 0 - 999.

The purpose of this is so that you can make those damage or healing over time abilities that don't always do the same amount per tick. It gets pretty boring seeing your max level curse spell always ticking for 5000 when you feel you should be more powerful than that.

***
Rep:
Level 71
RMRK Junior

***
Rep:
Level 71
RMRK Junior

***
Rep:
Level 71
RMRK Junior

***
Rep:
Level 57
Noun. The act of illuminating.
Contestant - GIAW 9
I can help you I think, but what do you mean with Note Tags?

***
Rep:
Level 71
RMRK Junior
I would've hoped my description would've been good enough to explain it.... lol.... idk, not really sure how to explain it, not sure how it works. I know however that it makes it extremely easy to use the scripts. If you're not sure, maybe Pacman can give some input, he usually does scripts for me, and he knows exactly what I mean when I say "let's use note tags".

It's one of those scripts where it's like "put (command) in the skill/state/item/enemy's notebox within the database"

Example:
<slip -1600>
<atk_f 100>

Where <atk_f> would make the slip damage be affected by the player's attack stat. I'm not sure if it'd matter, but I'd like the amounts to scale exactly as they do with skills. I would like this to be done also with spirit (<spi_f>) and if possible I'd like it to be able to affect skills as well (in case you want a skill to be influenced by more than 200), but also so that if used with a skill, the default set in the database is over-written with what is in the notebox (so that if you have 100 in the database and <atk_f 200> in the notebox, it'll use 200, rather than 100). I don't know if there needs to be a numerical scale to represent acceptable numbers for use or not, but if so, I'd like the scale to be 0 - 999.

***
Rep:
Level 71
RMRK Junior
Bump :D Anyone?

***
Rep:
Level 71
RMRK Junior

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I can help you I think, but what do you mean with Note Tags?

He means a specific code or tag in the applicable notebox in the database that is detected and used by the script. They are found with REGEXPs. What he is looking for would be something like this:
Code: [Select]
class RPG::State
  def damage_variable
    return !self.note[/<atk[_ ]?f:?[ ](\d+)>/i].nil? ? $1.to_i : 0
  end
end
That would return, say, 5 in the tag <atk f: 5>. It would also return 5 if the tag was <atkf 5> or <atk_f: 5>. You would then use the damage_variable method of the state to alter stuff and things as usual.
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
so this would work then?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
No, I was just telling Illumination how notetags work.
it's like a metaphor or something i don't know

***
Rep:
Level 71
RMRK Junior
oh, yeah, I'd really like to get this working, would be extremely helpful for my game.

***
Rep:
Level 71
RMRK Junior

**
Rep:
Level 56
RMRK Junior
Yanfly's Lunatic States Package: Punishment does this. From Yanfly's site:

Quote
Punish Effect No.5: Stat Slip Damage

Best used with close effect. At the end of the turn, the affected battler will take HP slip damage based on the stat of the of one who casted the status effect onto the battler. Battler cannot die from this effect.

<close effect: stat slip damage x%>

The only problem I can see is that the DoT / slip damage wouldn't kill the target, but I imagine that would be an easy fix if you want lethal slip damage.

Edit: I'm pretty sure this is what you'd need to edit:

Code: [Select]
user.perform_damage_effect
user.hp = [user.hp - dmg, 1].max

The .max function tells the game to leave the target at 1 HP if their HP would be reduced below that by the slip damage.
« Last Edit: May 01, 2012, 05:52:43 PM by Kaidan »

***
Rep:
Level 71
RMRK Junior
Thanks, but I'm not looking for an add-on to something else, I'm not planning to use extra scripts simply to get the 1 I want to work.

Also, it looks like that one is for Ace.
« Last Edit: May 02, 2012, 04:49:23 AM by zerothedarklord »

**
Rep:
Level 56
RMRK Junior
Yeah, sorry about that. I should learn to read tags.

***
Rep:
Level 71
RMRK Junior
All good, just really hoping I can get this. I figured out the other thing I really wanted, a way to add chance-on-hit effects to abilities, so now I just need to get this and all will be well!

***
Rep:
Level 71
RMRK Junior

***
Rep:
Level 71
RMRK Junior

***
Rep:
Level 71
RMRK Junior
still really need this..... anyone?

***
Rep:
Level 71
RMRK Junior
just another friendly neighborhood bump :D

***
Rep:
Level 71
RMRK Junior
Was also hoping to see this made with the addition of the ability to make slip damage/healing capable of being critical, something like:

\cancrit[5]

where \cancrit enables it to crit using the character's crit chance, and the number between [ ] is the skill's crit bonus chance. in other words, the character has 20% crit chance, the skill has 5, so it'd have a 25% chance to crit.