Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Modifying a script HUD's Madajuv

Save-Point

Full Version: Modifying a script HUD's Madajuv
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In his own words, is a "HUD that shows only the HP, based on HUD's game True Crime New York City for PS2."

It worked perfectly for me, but at some point of my game, you will be with other protagonists. So I want to change the design of the HUD. Would condition the displayed image to a variable or Switchs? I'll need at least 5 different then preferably a variable to save Switchs ...

Here the code of the script:
Code:
#=================================================================
# Mostrador de HP do True Crime NYC 2.0
# Autor: Madajuv
#=================================================================
# Cria um mostrador de vida semelhante ao do True Crime NYC
# Uma silhueta do jogador que vai esvaziando conforme perde a
# o hp, posicionado no canto da tela.
#=================================================================
module MADA
  # Switch que ativa o mostrador de HP
  HP_SWITCH = 1
  # Coordenada X do mostrador de HP
  HP_NYC_X = 430
  # Coordenada Y do mostrador de HP
  HP_NYC_Y = 270
  # Nome da imagem de fundo(estática)da silhueta:
  HP_NYC_B = "Silhueta_2 e"
  # Nome da imagem de frente(que diminui)da silhueta:
  HP_NYC_F = "Blood_2 e"
end
#---------------------------------------------------------------
# FIM DA EDIÇÃO
#===============================================================
class Game_System
  attr_accessor :mudou_hp
  alias mada_hp_nyc_initialize initialize
  def initialize
    mada_hp_nyc_initialize
    @mudou_hp = false
  end
end

class Game_Battler
  alias mada_hp_nyc_attack_effect attack_effect
  def attack_effect(attacker)
    mada_hp_nyc_attack_effect(attacker)  
    $game_system.mudou_hp = true
  end
  alias mada_hp_nyc_skill_effect skill_effect
  def skill_effect(user, skill)
    mada_hp_nyc_skill_effect(user, skill)
    $game_system.mudou_hp = true  
  end  
  alias mada_hp_nyc_item_effect item_effect
  def item_effect(item)
    mada_hp_nyc_item_effect(item)
    $game_system.mudou_hp = true  
  end
  alias mada_hp_nyc_slip_damage_effect slip_damage_effect
  def slip_damage_effect
    $game_system.mudou_hp = true  
    mada_hp_nyc_slip_damage_effect
  end
end

class Game_Party
  alias mada_hp_nyc_check_map_slip_damage check_map_slip_damage  
  def check_map_slip_damage
    for actor in @actors
      if actor.hp > 0 and actor.slip_damage?
        $game_system.mudou_hp = true
      end
    end
  mada_hp_nyc_check_map_slip_damage  
  end
end

class Window_Base < Window  
  def draw_hp(actor, x, y)
    back = RPG::Cache.picture(MADA::HP_NYC_B)    
    cw = back.width  
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)    
    self.contents.blt(x + 65, y, back, src_rect)
    meter = RPG::Cache.picture(MADA::HP_NYC_F)    
    cw = meter.width
    ch = meter.height * actor.hp / actor.maxhp
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x + 65, y, meter, src_rect)
  end
end

class Window_HP_NYC < Window_Base
  def initialize
    super(0, 0, 310, 500)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end  
  def refresh
    self.contents.clear
    actor = $game_party.actors[0]
    draw_hp(actor, 35, 35)
  end
end

class Interpreter
  alias mada_hp_nyc_command_311 command_311
  def command_311
    mada_hp_nyc_command_311
    $game_system.mudou_hp = true    
  end    
  alias mada_hp_nyc_command_314 command_314
  def command_314
    mada_hp_nyc_command_314
    $game_system.mudou_hp = true    
  end    
end    

class Scene_Map
  alias mada_hp_nyc_main main
  def main
    @HP_NYC = Window_HP_NYC.new
    @HP_NYC.x = MADA::HP_NYC_X
    @HP_NYC.y = MADA::HP_NYC_Y
    if $game_switches[MADA::HP_SWITCH] == true
      @HP_NYC.visible = true
    else
      @HP_NYC.visible = false
    end    
    mada_hp_nyc_main
    @HP_NYC.dispose
  end
  alias mada_hp_nyc_update update
  def update
    mada_hp_nyc_update
    if $game_switches[MADA::HP_SWITCH] == true
      @HP_NYC.visible = true
    else
      @HP_NYC.visible = false
    end
    if $game_system.mudou_hp
      @HP_NYC.refresh
      $game_system.mudou_hp = false
    end
  end
end


Here the link to the demo: http://www.mediafire.com/file/onyycfydjk1/NYC HP.rar



Here the link to the page of Madajuv: http://gamersdegaragem.yolasite.com/s_tcnycmosthp.php


Thankful.