LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

EVENTALIST
EVENTALIST
#1 default Wiggles Dynamic Healing System (RMXP)
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Wiggles Dynamic Healing System
Version: 1.0
Author: Mr Wiggles
Date: April 23, 2011

Version History



  • Version 1.0 4/23/11 - Original Release


Planned Future Versions

  • Nothing that i know of.


Description


This script is a lot like the "Cure" menu in Metal Gear Solid 3: Snake Eater. It allows wounds to be administered by enemies while in combat and then the player has to use the correct items to heal them.

Features

  • Look at the configuration module script bellow.


Screenshots
[You must be registered and logged in to see this image.]

Instructions
Follow the instructions in the Configuration Module. Paste all scripts in order above main and bellow any add on scripts in your script database.

script


Configuration module:
Code:

#==============================================================================
#                    ** Wiggles Dynamic Healing Config **
#==============================================================================
# By: Mr Wiggles
# Version: 1.0
# 4/23/11
#==============================================================================
#                              Instructions
#                      -------------------------------
# You can inflict a wound by useing a scrip command in an event that says:
#  $game_system.inflict_wound(actor_id, wound_id, damage = 100)
# actor_id : Actor's id
# wound_id : Wound id to inflict
# damage  : Amount of damage to inflict (needs to be > 0)
#------------------------------------------------------------------------------
# If your using XAS 3.7 or lower you may have problems with the wound window
# because XAS wont update $game_system for some reason.
#==============================================================================
#                              ** CONFIG **
#==============================================================================
module WDHS_Config # Make your edits bellow this point.
#==============================================================================
# These are the items that can be used in the "cure" menu.
MEDICAL_ITEMS = [1, 2, 3, 4, 5]
#------------------------------------------------------------------------------
# Name of the wound.
def self.wound_name(id)
  case id
  when 0 then return "Bruse"
  when 1 then return "Deep Cut"
  when 2 then return "Burn"
  else  #      -------------------
    return "No Name: #{id}." # This is required
  end
end
#------------------------------------------------------------------------------
# Discription of the wound.
def self.wound_discription(id)
  case id
  when 0#                  -------------------
    return "Slightly black with surounding blue color."
  when 1#                  -------------------
    # Use this exsample if you run out of room for your wound's description.
    return "Very deep cut that seems to nearly show bone. Will need stiches, " +
          "a bandage, and disinfectant."
  when 2#                  -------------------
    return "Standard first degree with minor redness."
  else  #                  -------------------
    return "No Discription for wound #{id}." # This is required
  end
end
#------------------------------------------------------------------------------
# Wound Effects.
def self.wound_effects(id, ad)
  case id
  # Each wound is defiend in an array like so...
  # [[cost, chance], nil, [cost, chance], [cost, chance]]
  # cost  : percentage of the damage inflicted that prevents player from
  #            reaching full health untill healed.
  # chance : chance of reciveing wound.
  # The location of the effects in the array are relitive to the actro id.
  when 0#                  -------------------
    eff = [25, 50] # because this is just the effects out of the array the
                  # effects are for every actor.
  when 1#                  -------------------
    eff = [[32, 40], nil, [12, 70], nil] # If the effects are "nil" then the
                                        # wounds do not affect that actor.
  when 2#                  -------------------
    eff = [nil, [50, 80], [50, 80], [20, 60]]
  end  #                  -------------------
  # This is required
  return eff[ad].is_a?(Integer) ? eff : eff[ad]
end
#------------------------------------------------------------------------------
# These are the items that are required to heal the wound. You can not have
# any repeated items: i.e. [2, 3, 2, 4, 3] or [1, 1]
def self.wound_healing(id)
  case id
  when 0 then return [1]      # Ice
  when 1 then return [2, 3, 4] # Stitches, Bandage, Disinfectant
  when 2 then return [3, 5]    # Bandage, Ointment
  else # defualt healing items.
    return [] # An empty array means un healable.
              # (will heal over time if WOUND_HEALING is enabled.)
  end
end
#------------------------------------------------------------------------------
# Player can use wrong items at the cost of losing them when healing.
PENTAL = true
#------------------------------------------------------------------------------
# This is the skill's effects on the actor.
def self.skill_effects(skill_id)
  case skill_id
  # This is a conditional branch based on the skill id. In this example
  # skill 1 in the database will inflict wound 2 from the "wounds" def above.
  when 1 then return 1
  when 7 then return 2 # Skill "Fire" in the database.
  else # default effect
  return 0
  end
end
#------------------------------------------------------------------------------
def self.attack_effects(enemy_id)
  case enemy_id
  # This is  set up the same as above but your using the enemy's id instead
  # of a skill id.
  when 1 then return 1 # Enemy "Basilisk" in the database.
  else # default effects
  return 0
  end
end
#------------------------------------------------------------------------------
# Actors will heal their wounds over time
WOUND_HEALING  = true
# Actors will gain health back over time.
SELF_HEALING    = true
# Heal durning battle. (Only applies when in Scene_Battle)
BATTLE_HEALING  = false
# Healing speed, higher the number the slower they heal. (in seconds)
HEAL_SPEED      = 5 # This number should be >= 1
#------------------------------------------------------------------------------
# Show wound inflicted when inflicted?
USE_WINDOW      = true
# Time that window is shown for. (in frames)
WINDOW_TIME    = 60
# Loctaion of window. (1-Top R, 2-Lower R, 3-Top L, 4-Lower L, 5-Center)
WINDOW_LOCATION = 5
#------------------------------------------------------------------------------
# Bar color for Skill Points..
SP_BAR_COLOR = Color.new(  0,  0, 100)
# Bar color for Health Points.
HP_BAR_COLOR = Color.new( 80,  80,  80)
# This is the color of the bar that shows wounds.
PV_BAR_COLOR = Color.new(100,  20,  20)
#------------------------------------------------------------------------------
# Sound to use in the cure menu when wound was healed completely.
HEALED_SE = "105-Heal01"
# Sound to use in the cure menu when wrong item was used.
WRONG_SE  = "057-Wrong01"
# Sound to use in the cure menu when right item was used.
RIGHT_SE  = ""
# Note: If a SE doesn't play, the file was not found, it could be that you
#      spelled the name incorrectly. If a SE is set to "" the defualt sound
#      wil be played.
#==============================================================================
#                            ** END CONFIG **
#==============================================================================
end
Effects
Code:

#==============================================================================
#                      ** Wiggles Dynamic Healing **
#==============================================================================
# By: Mr Wiggles
# Version: 1.0
# 4/23/11
#==============================================================================
#                              Instructions
#                      -------------------------------
# Make any edits that change the script to the module not to the script itself.
#==============================================================================
# ** Game Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects
  #--------------------------------------------------------------------------
  alias :wdhs_att_eff :attack_effect
  def attack_effect(attacker)
    effective = wdhs_att_eff(attacker)
    unless self.is_a?(Game_Enemy)
      self.wdhs_inflict(self.damage, attacker.id, "normal")
    end
    return effective
  end
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #--------------------------------------------------------------------------
  alias :wdhs_skil_eff :skill_effect
  def skill_effect(user, skill)
    effective = wdhs_skil_eff(user, skill)
    unless self.is_a?(Game_Enemy)
      self.wdhs_inflict(self.damage, skill.id, "skill")
    end
    return effective
  end
end

#==============================================================================
# ** Game System
#==============================================================================
class Game_System
  attr_accessor :wdhsi_window
  #--------------------------------------------------------------------------
  # Update
  #--------------------------------------------------------------------------
  alias :wdhs_up :update
  def update
    wdhs_up
    # infliction window
    if WDHS_Config::USE_WINDOW
      if $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Battle)
        @wdhsi_window = Window_WHDS_Infliction.new if @wdhsi_window.nil?
        @wdhsi_window.update
      elsif !@wdhsi_window.nil?
        @wdhsi_window.dispose
        @wdhsi_window = nil
      end
    end
    # update actors
    if WDHS_Config::HEAL_SPEED < 1
      print("Healing speed can not be lower then 1 second.")
      $scene = nil
      return
    end
    @wdhs_upwait = WDHS_Config::HEAL_SPEED * 40 if @wdhs_upwait.nil?
    @wdhs_upwait -= 1
    return if @wdhs_upwait > 0
    @wdhs_upwait = WDHS_Config::HEAL_SPEED * 40
    $game_party.actors.each{|actor| actor.update_wdhs}
  end
  #--------------------------------------------------------------------------
  # WDHS Inflict Wound
  #--------------------------------------------------------------------------
  def inflict_wound(actor_id, wound_id = 0, damage = 100)
    actor = $game_actors[actor_id]
    return if actor.nil?
    actor.hp = actor.hp - damage > 0 ? actor.hp - damage : 0
    actor.wdhs_wounds.unshift([wound_id, damage, damage])
    @wdhsi_window.need_show.push(wound_id)
  end
end

#==============================================================================
# ** Scene Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Menu Call
  #--------------------------------------------------------------------------
  alias :wdhs_menu_call :call_menu
  def call_menu
    wdhs_menu_call
    $game_system.update
  end
  #--------------------------------------------------------------------------
  # * Save Call
  #--------------------------------------------------------------------------
  alias :wdhs_save_call :call_save
  def call_save
    wdhs_save_call
    $game_system.update
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  attr_accessor :wdhs_wounds
  attr_reader  :heal_prevent
  #--------------------------------------------------------------------------
  # Initialization
  #--------------------------------------------------------------------------
  alias :wdhs_actor_init :initialize
  def initialize(actor_id)
    @wdhs_wounds  = []
    @heal_prevent = 0
    wdhs_actor_init(actor_id)
  end
  #--------------------------------------------------------------------------
  # Update WHDS
  #--------------------------------------------------------------------------
  def update_wdhs
    # clear wounds if dead
    if self.hp <= 0
      @wdhs_wounds  = []
      @heal_prevent = 0
    end
    return if $scene.is_a?(Scene_Battle) and !WDHS_Config::BATTLE_HEALING
    # self healing HP
    if WDHS_Config::SELF_HEALING and @hp < maxhp and @hp != 0
      @hp += 1 if @hp < (maxhp - @heal_prevent)
      @hp = maxhp if @hp > maxhp
    end
    # self healing Wounds
    if WDHS_Config::WOUND_HEALING
      for wound in @wdhs_wounds
        wound[1] -= 1
        if wound[1] <= 0
          @wdhs_wounds.delete(wound)
          next
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # Heal Wound
  #--------------------------------------------------------------------------
  def wdhs_heal(wound_id, value)
    wound = @wdhs_wounds[wound_id]
    return if wound.nil?
    wound[1] -= value
    @wdhs_wounds.delete(wound) if wound[1] <= 0
  end
  #--------------------------------------------------------------------------
  # Heal Prevent WDHS
  #--------------------------------------------------------------------------
  def heal_prevent
    # max health prevent
    value = 0
    @wdhs_wounds.each{|wound| value += wound[1]}
    return value
  end
  #--------------------------------------------------------------------------
  # Inflict WDHS
  #--------------------------------------------------------------------------
  def wdhs_inflict(damage, id, type)
    return if damage == "Miss" or damage.to_i.zero?
    # get wound info
    effect_id = type == "normal" ? WDHS_Config.attack_effects(id) :
      WDHS_Config.skill_effects(id)
    effect = WDHS_Config.wound_effects(effect_id, self.id - 1)
    # if character recives wound
    return if effect.nil?
    if effect[1] > rand(100)
      damage = damage * (effect[1] / 100.to_f).abs
      self.wdhs_wounds.unshift([effect_id, damage.floor, damage.floor])
      $game_system.wdhsi_window.need_show.push(effect_id)
    end
  end
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  alias :wdhs_max_hp :maxhp
  def maxhp(true_value = false)
    return true_value ? wdhs_max_hp : wdhs_max_hp - heal_prevent
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
  def wdhs_effect?
    return @spriteset.effect?
  end
end

#==============================================================================
# ** Window WHDS Infliction
#==============================================================================
class Window_WHDS_Infliction < Window_Base
  attr_accessor :need_show
  #--------------------------------------------------------------------------
  # Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    case WDHS_Config::WINDOW_LOCATION
    when 1 # Top Right
      self.x = 0; self.y = 0
    when 2 # Lower Right
      self.x = 0; self.y = 480 - height
    when 3 # Top Left
      self.x = 640 - width; self.y = 0
    when 4 # Lower Left
      self.x = 640 - width; self.y = 480 - height
    when 5 # Center
      self.x = 320 - (width / 2); self.y =  240 - (height / 2)
    end
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = 18
    self.visible  = false
    self.opacity  = 180
    self.z = 1
    @display_time = 0
    @need_show    = []
  end
  #--------------------------------------------------------------------------
  # Set Text
  #--------------------------------------------------------------------------
  def set_text(text)
    self.width    = 160
    self.contents.clear
    self.contents.font.color = normal_color
    @display_time = WDHS_Config::WINDOW_TIME + 20
    self.contents.draw_text(0, 0, self.width - 30, 32, text + " - Inflicted", 0)
    self.visible = true
  end
  #--------------------------------------------------------------------------
  # Update
  #--------------------------------------------------------------------------
  def update
    super
    # close window
    if self.visible
      @display_time -= 1 if @display_time > 0
      if @display_time < 20
        self.width -= 4
      elsif @display_time.zero?
        self.visible  = false
        self.width    = 240
      end
    end
    # if display array is empty
    if @need_show.empty?
      @display_wait = 8
      return
    end
    # wait time to display effects
    return if $scene.is_a?(Scene_Battle) and $scene.wdhs_effect?
    if @display_wait.zero?
      text = WDHS_Config.wound_name(@need_show[0])
      @need_show.delete_at(0)
      @display_wait = 20
      set_text(text)
    end
    @display_wait -= 1 if @display_wait > 0
  end
end

#==============================================================================
# ** Window Base
#==============================================================================
class Window_Base < Window
  alias :wdhs_draw_hp :draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      hp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      hp_x = x + width - 48
      flag = false
    end
    bwidth = hp_x - x
    bwidth += $game_temp.in_battle ? 50 : 100
    # Draw Bar
    bar = Bitmap.new(bwidth, 32)
    bar.fill_rect(Rect.new(0, 0, bwidth, 10), Color.new(0, 0, 0))
    per = actor.hp / actor.maxhp(true).to_f
    hp_size = (bwidth - 2) * per
    bar.fill_rect(Rect.new(1, 1,  hp_size, 8), WDHS_Config::HP_BAR_COLOR)
    per = actor.heal_prevent / actor.maxhp(true).to_f
    vp_size = (bwidth - 2) * per
    bar.fill_rect(Rect.new(1 + hp_size, 1, vp_size, 8), WDHS_Config::PV_BAR_COLOR)
    self.contents.blt(x, y, bar, Rect.new(0, 0, bwidth, 10))
    # Draw "HP" text string
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Draw HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp(true) / 4 ? crisis_color : normal_color
    self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp(true).to_s)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #--------------------------------------------------------------------------
  alias :wdhs_draw_sp :draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    # Calculate if there is draw space for MaxSP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    bwidth = sp_x - x
    bwidth += $game_temp.in_battle ? 50 : 100
    # Draw Bar
    bar = Bitmap.new(bwidth, 32)
    bar.fill_rect(Rect.new(0, 0, bwidth, 10), Color.new(0, 0, 0))
    per = actor.sp / actor.maxsp.to_f
    bar.fill_rect(Rect.new(1, 1, (bwidth - 2) * per , 8), WDHS_Config::SP_BAR_COLOR)
    self.contents.blt(x, y, bar, Rect.new(0, 0, bwidth, 10))
    # Draw "SP" text string
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    # Draw SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
end
Cure Scene
Code:

#==============================================================================
#                  ** Wiggles Dynamic Healing Cure Scene **
#==============================================================================
# By: Mr Wiggles
# Version: 1.0
# 4/23/11
#==============================================================================
#                              Instructions
#                      -------------------------------
# Call this script with by using:
#  $scene = WDH_Cure.new
#==============================================================================
class WDH_Cure
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize(index = 0)
    @actor_index = index
    @actor = $game_party.actors{@actor_index}
  end
  #--------------------------------------------------------------------------
  # * Main
  #--------------------------------------------------------------------------
  def main
    # Create actor window
    @actor_window = Window_Wound_Actor.new(@actor_index)
    # Create wound list
    @wounds_window        = Window_Wounds.new(@actor_index)
    @wounds_window.active = false
    @wounds_window.index  = -1
    # Create item lsit
    @item_window        = Window_Wound_Item.new
    @item_window.active = false
    @item_window.index  = -1
    # Create item descriptiong window
    @item_desc_window = Window_Item_Desc.new
    # Create and set help
    @help_window              = Window_Wound_Help.new
    @wounds_window.help_window = @help_window
    @wounds_window.update_help
    # Create and set headers
    @header_windows = [Window_WHeader.new(320, "Wounds"),
      Window_WHeader.new(320, "Healing Items")]
    @wounds_window.header_window = @header_windows[0]
    @item_window.header_window  = @header_windows[1]
    # Set number of wounds
    @old_number = @wounds_window.num_wounds
    # Main loop
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    # Dispose Windows
    @actor_window.dispose
    @wounds_window.dispose
    @item_window.dispose
    @help_window.dispose
    @item_desc_window.dispose
    @header_windows.each{|window| window.dispose}
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    @help_window.update
    @actor_window.update
    item = @item_window.item
    @item_desc_window.set_text(item.nil? ? "" : item.description)
    # update item command
    if @item_window.active
      @item_window.update
      update_item_command
      return
    end
    # Update wound command
    if @wounds_window.active
      @wounds_window.update
      update_wound_command
      return
    end
    # Update actor window
    if @actor_window.active
      update_actor_commands
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Actor Commands
  #--------------------------------------------------------------------------
  def update_actor_commands
    # If B button was pressed
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    # If Right button was pressed
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = WDH_Cure.new(@actor_index)
      return
    end
    # If Left button was pressed
    if Input.trigger?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = WDH_Cure.new(@actor_index)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @wounds_window.wound.nil?
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @actor_window.active  = false
      @wounds_window.index  = 0
      @wounds_window.active = true
    end
  end
  #--------------------------------------------------------------------------
  # * Update Actor Commands
  #--------------------------------------------------------------------------
  def update_wound_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @wounds_window.active = false
      @wounds_window.index  = -1
      @actor_window.active  = true
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @wounds_window.active = false
      @item_window.index    = 0
      @item_window.set_info(@wounds_window.index, @actor_index)
      @item_window.active  = true
    end
  end
  #--------------------------------------------------------------------------
  # * Update Actor Commands
  #--------------------------------------------------------------------------
  def update_item_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @item_window.active  = false
      @item_window.index    = -1
      @item_window.clear_window
      @wounds_window.active = true
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @item_window.can_use?
        # get info
        actor = $game_party.actors[@actor_index]
        wound = @item_window.wound
        # add item used into wound array
        wound[3].push(@item_window.item.id)
        # get correct items
        items = WDHS_Config.wound_healing(wound[0])
        # remove item
        if items.include?(@item_window.item.id) or WDHS_Config::PENTAL
          $game_party.lose_item(@item_window.item.id, 1)
        end
        # refresh item window to show udpates
        @item_window.refresh
        # if item was wrong
        if items.nil? or !items.include?(@item_window.item.id)
          se_name = WDHS_Config::WRONG_SE
          if se_name != ""
            Audio.se_play("Audio/SE/" + se_name, 100, 100) rescue nil
          else
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        # heal wound with item
        else
          heal_points = ((wound[2] + 2) / items.size).round
          actor.wdhs_heal(@wounds_window.index, heal_points)
        end
        # refresh wound window to show udpates
        @wounds_window.refresh
        # if wound was fully healed
        if @wounds_window.num_wounds != @old_number
          se_name = WDHS_Config::HEALED_SE
          if se_name != ""
            Audio.se_play("Audio/SE/" + se_name, 100, 100) rescue nil
          else
            $game_system.se_play($data_system.decision_se)
          end
          # adjust wound window control
          @old_number = @wounds_window.num_wounds
          @item_window.active  = false
          @item_window.index    = -1
          @wounds_window.active = true
          # adjust window index
          @item_window.clear_window
          index = @wounds_window.index
          @wounds_window.index = index - 1 if index > 0
          @wounds_window.index = -1 if @old_number.zero?
          # adjust actor window control
          if @wounds_window.index == -1
            @wounds_window.active = false
            @actor_window.active  = true
          end
        # if wound was not fully healed but correct item
        else
          se_name = WDHS_Config::RIGHT_SE
          if se_name != ""
            Audio.se_play("Audio/SE/" + se_name, 100, 100) rescue nil
          else
            $game_system.se_play($data_system.decision_se)
          end
        end
      # player can't use item
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
  end
end

#==============================================================================
# ** Window Wound Actor
#==============================================================================
class Window_Wound_Actor < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    super(0, 0, 320, 240)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z        = 1
    @actor        = $game_party.actors[actor_id]
    return if @actor.nil?
    @old_info    = [@actor.hp, @actor.heal_prevent]
    @active      = true
    refresh
  end
  #--------------------------------------------------------------------------
  # * Active
  #--------------------------------------------------------------------------
  def active=(bool)
    @active = bool
  end
  def active
    return @active
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Battler
    unless @actor.battler_name.nil?
      bitmap = RPG::Cache.battler(@actor.battler_name, @actor.battler_hue)
      x = (self.width  / 2) - (bitmap.width  / 2) + 25
      y = (self.height / 2) - (bitmap.height / 2) - 30
      self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    end
    # Character info
    draw_actor_name(@actor, 4, 0)
    draw_actor_graphic(@actor, 40, 112)
    draw_actor_hp(@actor, 4, 180, self.width - 40)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    return if @actor.nil?
    return if @actor.hp == @old_info[0] and @actor.heal_prevent == @old_info[1]
    @old_info = [@actor.hp, @actor.heal_prevent]
    refresh
  end
end

#==============================================================================
# ** Window Wounds
#==============================================================================
class Window_Wounds < Window_Selectable
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    super(320, 0, 320, 188)
    @actor = $game_party.actors[actor_id]
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Acquiring wound description
  #--------------------------------------------------------------------------
  def wound
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Return Number of Wounds
  #--------------------------------------------------------------------------
  def num_wounds
    return @data.size
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @help_window.refresh(self.index) unless @help_window.nil?
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for wound in @actor.wdhs_wounds
      #[wound_id, damage, damage]
      id, current_dam, start_dam = wound
      wound_info = [id, WDHS_Config.wound_name(id),
        WDHS_Config.wound_healing(id), current_dam, start_dam]
      @data.push(wound_info)
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    wound = @data[index]
    x = 4; y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x, y, 204, 32, wound[1])
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.index, @actor)
  end
end

#==============================================================================
# ** Window Wound Help
#==============================================================================
class Window_Wound_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 240, 320, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(wound_id, actor)
    if wound_id != @wound_id or @actor != actor
      @wound_id, @actor = wound_id, actor
      refresh(@wound_id)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(wound_id)
    @wound_id = wound_id if wound_id != @wound_id
    self.contents.clear
    @wound = @actor.wdhs_wounds[@wound_id]
    return if @wound.nil? or @actor.nil?
    self.contents.font.size = 21
    # Draw Description
    descr  = WDHS_Config.wound_discription(@wound[0])
    format_string(4, 0, descr, self.width - 40)
    # Draw Bar
    per = 0
    if @actor.heal_prevent > 0 and !@wound[1].nil?
      per = @wound[1] / @actor.heal_prevent.to_f
    end
    x, y, bwidth = 4, self.height - 40, self.width - 40
    bar = Bitmap.new(bwidth, 32)
    bar.fill_rect(Rect.new(0, 0, bwidth, 10), Color.new(0, 0, 0))
    bar.fill_rect(Rect.new(1, 1, (bwidth - 2) * per , 8),
      WDHS_Config::PV_BAR_COLOR)
    self.contents.blt(x, y, bar, Rect.new(0, 0, bwidth, 10))
    # Draw Percentage
    self.contents.font.size = 17
    self.contents.draw_text(4, self.height - 70, self.width - 30, 32,
      "Acounting for %#{(per * 100).floor} HP Prevention.", 1)
  end
  #--------------------------------------------------------------------------
  # * Format String
  #--------------------------------------------------------------------------
  def format_string(x, y, string, max_width = 100)
    temp_word_array = string.scan (/./)
    position = line_break = 0
    lines = []
    blank_width = []
    new_string = [lines, blank_width]
    for i in 0...temp_word_array.size
      character = temp_word_array[i]
      if character == " " or i == temp_word_array.size - 1
        i += 1 if i == temp_word_array.size - 1
        if self.contents.text_size(string[line_break,
            i-line_break]).width <= max_width
          position = i
        else
          line = temp_word_array[line_break, position-line_break]
          new_string[0].push(line)
          line_blank = max_width - self.contents.text_size(string[
            line_break, position - line_break]).width
          new_string[1].push(line_blank.to_f / (line.size.to_f - 1.0))
          line_break = position + 1
          position = i
        end
      end
    end
    new_string[0].push(temp_word_array[line_break,
      temp_word_array.size - line_break])
    draw_formated_string(x, y, max_width, new_string[0])
  end
  #--------------------------------------------------------------------------
  # * Draw New String
  #--------------------------------------------------------------------------
  def draw_formated_string(x = 0, y = 0, max_width = 100, lines = nil)
    return if lines.nil?
    for line in 0...lines[0].size
      self.contents.draw_text(x, y + (line * self.contents.font.size),
        max_width, 32, lines[line].to_s)
    end
  end
end

#==============================================================================
# ** Window WHeader
#==============================================================================
class Window_WHeader < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(width, header = "")
    super(0, 0, width, 52)
    self.contents = Bitmap.new(width - 32, height - 32)
    set_text(header, 1)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, -8, self.width - 40, 32, text, align)
      @text = text
      @align = align
    end
  end
end

#==============================================================================
# ** Window Wound Item
#==============================================================================
class Window_Wound_Item < Window_Selectable
  attr_accessor :wound
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(320, 188, 320, 244)
    @wound = nil
    refresh
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Can Use Check
  #--------------------------------------------------------------------------
  def can_use?
    return (!@wound[3].include?(self.item.id) and
      $game_party.item_number(self.item.id) > 0)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    return if @wound.nil?
    WDHS_Config::MEDICAL_ITEMS.each{|id| @data.push($data_items[id])}
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Set Info
  #--------------------------------------------------------------------------
  def set_info(wound_id = nil, actor_id = nil)
    @actor = $game_party.actors[actor_id]
    return if @actor.nil?
    @wound = @actor.wdhs_wounds[wound_id]
    return if @wound.nil?
    @wound[3] = [0] if @wound[3].nil?
    refresh
  end
  #--------------------------------------------------------------------------
  # * Clear Window
  #--------------------------------------------------------------------------
  def clear_window
    @wound = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item.id)
    if @wound[3].include?(item.id)
      if WDHS_Config.wound_healing(@wound[0]).include?(item.id)
        self.contents.font.color = Color.new(185, 215, 255, 150)
      else
        self.contents.font.color = Color.new(255,  64,  0, 150)
      end
    elsif number.zero?
      self.contents.font.color = disabled_color
    else
      self.contents.font.color = normal_color
    end
    x = 4; y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# ** Window Item Desc
#==============================================================================
class Window_Item_Desc < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 428, 640, 52)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 300
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, -8, self.width - 40, 32, text)
      @text = text
    end
  end
end

#==============================================================================
# ** Window Base
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  # * Set Header Window
  #--------------------------------------------------------------------------
  def header_window=(window)
    @header_window = window
    @header_window.x = self.x
    self.height -= @header_window.height
    self.y += @header_window.height
    @header_window.y = self.y - @header_window.height
  end
end

[You must be registered and logged in to see this link.]

Support


Post and problems you may encounter here, or suggestions for an update.

Known Compatibility Issues
None that i know of.

Restrictions
Do not post this any place with out my permission.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#2 default Re: Wiggles Dynamic Healing System (RMXP)
Loading

Legault123

Legault123
Active Member
Active Member
Active Member
profile
Great work! this is awesome, congratulations, keep the great work Smile
Active Member
Show Signature
Active Member
C.O.R.N.
C.O.R.N.
#3 default Re: Wiggles Dynamic Healing System (RMXP)
Loading

BluE

BluE
C.O.R.N.
C.O.R.N.
C.O.R.N.
profile
never played Metal gear solid but this looks totally ingenious.
C.O.R.N.
Show Signature


Want a real challenge? Try [You must be registered and logged in to see this link.]

If you read this message, please PM me. this is a test. And I'm serious, this isnt just some lousy time wasting paragraph that I wrote just to fill in my signature. It's here for a reason. PM ME.
C.O.R.N.
http://51s-seedy-masteroogway.blogspot.com
Administrator
Administrator
#4 default Re: Wiggles Dynamic Healing System (RMXP)
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
are you for real!? alien

this is some next level healing with character depth!
this will definitely be in Bloodlines, no doubt this will be perfect for Outbreak. The way you split the scripts is another nice touch, makes it easier to use. I like the window/frame layout ~ nice and neat!

thanks for sharing and giving me code envy ^,^

Administrator
Show Signature


Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]




G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this image.]


shhh.... [You must be registered and logged in to see this link.]



[You must be registered and logged in to see this link.]
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#5 default Re: Wiggles Dynamic Healing System (RMXP)
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Thanks for the nice feed back guys, i did how ever forget to mention that with some scripts that call the "actor.maxhp" will need to make a minor edit to "actor.maxhp(true)" that call is usually for HUDs so it not a huge deal wont make the game crash or anything just the HUD will show the max hp of the actor with the heal prevent subtracted from it.
EVENTALIST
Show Signature
EVENTALIST

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled