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.
[VXA] Visible Injuries 1.0.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Visible Injuries
Version: 1.0.0
Author: modern algebra
Date: July 18, 2012

Version History


  • <Version 1.0> 2012.07.18 - Original Release

Description


This script allows you to set it so that an enemy's battler will change when the enemy falls below any percentage of HP you choose. This can be used to give the player visual feedback as to the HP status of each enemy.

Features

  • Allows you to give visual feedback as to the HP status of the enemy
  • Can change both the graphic file and its hue
  • Can have multiple stages of injuries
  • Easy configuration through enemy note fields

Screenshots



Instructions

Paste the script into its own slot in the Script Editor, above Main but below Materials.

See the header for additional instructions regarding setting up the script.

Script


Code: [Select]
#==============================================================================
#    Visible Injuries
#    Version: 1.0.0
#    Author: modern algebra (rmrk.net)
#    Date: July 18, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#   
#    This script allows you to set it so that an enemy's battler will change
#   when the enemy falls below any percentage of HP you choose. This can be
#   used to make it so that the battler looks like it gets progressively
#   more injured throughout the battle.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#   
#    Paste this script into its own slot in the Script Editor, above Main but
#   below Materials.
#
#    To set which battlers should be used to reflect injury and at what
#   percentage of health, you use the following code in the enemy's note field:
#
#        \injured_battler[p, "b", h]
#
#    where:  p - an integer between 1 and 100; this is the percentage of HP
#           the enemy must fall below before the battler is changed.
#            b - the filename of the battler
#            h - the hue of the battler. If not included, defaults to 0.
#
#  EXAMPLE:
#
#    If the following is in an Slime's note field:
#
#        \injured_battler[50, "Slime", 128]
#
#    Then when the Slime falls below 50% HP, it will change hue to 128.
#
#    If the following is in a Bandit's note field:
#
#        \injured_battler[70, "Injured Bandit"]
#        \injured_battler[25, "Wounded Bandit"]
#
#    Then when the Bandit falls below 70% HP, the battler graphic will change
#   to "Injured Bandit". When the Bandit falls below 25% HP, the battler
#   graphic will change to "Wounded Bandit".
#==============================================================================

$imported ||= {}
$imported[:"VisibleInjuries 1.0.0"] = true

#==============================================================================
# ** RPG::Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - vi_injured_battlers
#==============================================================================

class RPG::Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Injured Battlers
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def vi_injured_battlers
    if !@vi_injured_battlers
      @vi_injured_battlers = []
      self.note.scan(/\\INJURED_BATTLER\[\s*(\d+)[,;:\s]*\"(.+?)\"[,;:\s]*(\d*)\s*\]/i) { |ary|
        @vi_injured_battlers.push([(ary[0].to_f / 100.0), ary[1], ary[2].to_i])
      }
      @vi_injured_battlers.push([100, battler_name, battler_hue])
      @vi_injured_battlers.sort! {|a, b| a[0] <=> b[0] }
    end
    @vi_injured_battlers
  end
end

#==============================================================================
# ** Game_Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - hp=; refresh; recover_all
#    new method - vi_update_injuries
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change HP
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_vi_chnghp_2kh5 hp=
  def hp=(*args, &block)
    ma_vi_chnghp_2kh5(*args, &block) # Call Original Method
    vi_update_injuries
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_vi_refr_6jz3 refresh
  def refresh(*args, &block)
    ma_vi_refr_6jz3(*args, &block) # Call Original Method
    vi_update_injuries
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recover All
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_vi_recovall_3hk9 recover_all
  def recover_all(*args, &block)
    ma_vi_recovall_3hk9(*args, &block) # Call Original Method
    vi_update_injuries
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Injuries
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def vi_update_injuries
    enemy.vi_injured_battlers.each { |ary|
      if hp_rate <= ary[0]
        @battler_name = ary[1]
        @battler_hue = ary[2]
        break
      end
    }
  end
end

You can also find the script at Pastebin

Credit


  • modern algebra

Support


Please post in this topic at RMRK if you have any questions, suggestions, or other feedback.

Known Compatibility Issues

No currently known compatibility issues. If you find one, please let me know and provide a link to the incompatible script.

Terms of Use


I adopt RMRK's default Terms of Use.
« Last Edit: January 31, 2013, 09:48:18 PM by modern algebra »

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Good script as always, Modern :)


Where do you come up with these ideas for scripts?
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

***
Rep:
Level 77
RMRK Junior
This was in Final Fantasy: Mystic Quest (known in PAL regions as Mystic Quest: Legend and the first turn-based RPG released in a PAL country)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, I've never played that game, but I am sure I probably saw it in some other game somewhere. I sort of recall writing something like it for VX too, but I couldn't find it when I looked.