Description:
This is a script that creates a HUD same with that of the light novel and anime Sword Art Online.
Terms of Use:
- You are free to use the script on any non-commercial projects.
- Credits to SoulPour777 for the script.
- Preserve this script header.
Important Rule:
- You are not allowed to claim this script as your own.
– if you are going to use this on your project, it is a rule to include the scripter’s name in the game.
Version History:
** Version 1 – Has only the safe bar.
** Version 2 – Created the different bars
Instructions of Using:
- Place the script below Materials above Main.
- Place the graphics on the Systems folder.
** if there are suggestions or errors about the script, please don’t forget to mail the author at the given web url above.
If by any chance the link would soon be broken and you are reading this 10 years from now (possibly), then you can just download the file here in Save Point.
Script:
Content Hidden
Code:
=begin
#==============================================================================
# RGSS3 - Sword Art Online Heads Up Display
# ** Author: SoulPour777
# Web URL: http://www.infinitytears.wordpress.com
#------------------------------------------------------------------------------
# Description: This is a script that creates a HUD same with that of the
# light novel and anime Sword Art Online.
Terms of Use:
- You are free to use the script on any non-commercial projects.
- Credits to SoulPour777 for the script.
- Preserve this script header.
Important Rule:
- You are not allowed to claim this script as your own.
- if you are going to use this on your project, it is a rule to include
the scripter's name in the game.
Version History:
** Version 1 - Has only the safe bar.
** Version 2 - Created the different bars
Instructions of Using:
- Place the script below Materials above Main.
- Place the graphics on the Systems folder.
** if there are suggestions or errors about the script, please don't
forget to mail the author at the given web url above.
Known Compatibility Issues:
- None.
#==============================================================================
=end
# ---------------------------------------------------------------------------- #
# This module contains all variables needed to display the hud and its traits.
# ---------------------------------------------------------------------------- #
module SOULPOUR777
#------------------------------------
SAFE_BAR = "sao_hud_life_bar.png" #safe bar image
#------------------------------------
DANGER_BAR = "sao_hud_life_danger_bar.png" #danger bar image
#------------------------------------
HUD_BACK = "sao_hud_back.png" #back image of the hud
#------------------------------------
NEAR_DEATH = "sao_hud_near_death" #near death image
#------------------------------------
SAO_HUD_Z = 150 # sao_hud.z
#------------------------------------
BAR_Z = 149 #bar z
#------------------------------------
OLD_VALUES = 0
HUD_RECOGNIZED_NUMBER = 0
RANGE_A = 126
RANGE_B = 335
RANGE_C = 27
RANGE_D = 43
#------------------------------------
end
# ---------------------------------------------------------------------------- #
# This module holds the state traits for the HUD. It displays:
# Green - The character is safe.
# Orange - The character is dying.
# Red - The character is in the verge of death.
# ---------------------------------------------------------------------------- #
module SAO_HUD
include SOULPOUR777
# ---------------------------------------------------------------------------- #
# Creates the actual hud.
# ---------------------------------------------------------------------------- #
def soulpour_make_sao_hud
@SOULPOUR_SAO_HUD = Sprite.new(nil)
@SOULPOUR_SAO_HUD.z = SAO_HUD_Z
@SOULPOUR_SAO_HUD.bitmap =Bitmap.new("Graphics/System/" + HUD_BACK)
@SAO_HUD_SOULPOUR_BAR = Sprite.new(nil)
@SAO_HUD_SOULPOUR_BAR.z = BAR_Z
@SAO_HUD_SOULPOUR_BAR.bitmap = Bitmap.new("Graphics/System/" + SAFE_BAR)
@old_name = ""
@old_hp = OLD_VALUES
@old_max_hp = OLD_VALUES
@old_level = OLD_VALUES
end
# ---------------------------------------------------------------------------- #
# Dispose HUD
# Disposes the hud when the HUD is deactivated.
# ---------------------------------------------------------------------------- #
def sao_hud_soulpour_dispose_hud
@SOULPOUR_SAO_HUD.dispose
@SAO_HUD_SOULPOUR_BAR.dispose
end
# ---------------------------------------------------------------------------- #
# Update Hud
# This method updates the hud, meaning when the actor ($leader) is damaged or
# healed, the hud updates itself to show the accurate hud graphic.
# ---------------------------------------------------------------------------- #
def sao_hud_soulpour_update
@SOULPOUR_SAO_HUD.bitmap.clear
@SOULPOUR_SAO_HUD.bitmap = Bitmap.new("Graphics/System/" + HUD_BACK)
@SOULPOUR_SAO_HUD.bitmap.draw_text(45, 22, 80, 30, $game_party.members[0].name)
@SOULPOUR_SAO_HUD.bitmap.font.size = 16
@SOULPOUR_SAO_HUD.bitmap.draw_text(241, 45, 70, 20, $game_party.members[0].hp.to_s + "/" +$game_party.members[0].mhp.to_s, 1)
@SOULPOUR_SAO_HUD.bitmap.draw_text(311, 45, 30, 20, "Lv " + $game_party.members[0].level.to_s, 1)
#when the character is still safe:
@SAO_HUD_SOULPOUR_BAR.bitmap = Bitmap.new("Graphics/System/" + SAFE_BAR) if $game_party.members[0].hp >= $game_party.members[0].mhp / 2
#when the character is in danger:
@SAO_HUD_SOULPOUR_BAR.bitmap = Bitmap.new("Graphics/System/" + DANGER_BAR) if $game_party.members[0].hp <= 150
#when the character is in the verge of death:
@SAO_HUD_SOULPOUR_BAR.bitmap = Bitmap.new("Graphics/System/" + NEAR_DEATH) if $game_party.members[0].hp <= 100
for x in RANGE_A..RANGE_B
for y in RANGE_C..RANGE_D
if y>-3*x/2+313*$game_party.members[0].hp/$game_party.members[0].mhp+218
@SAO_HUD_SOULPOUR_BAR.bitmap.set_pixel(x,y,Color.new(0,0,0,0))
end
end
end
@old_level = $game_party.members[HUD_RECOGNIZED_NUMBER].level
@old_hp = $game_party.members[HUD_RECOGNIZED_NUMBER].hp
@old_max_hp = $game_party.members[HUD_RECOGNIZED_NUMBER].mhp
@old_name = $game_party.members[HUD_RECOGNIZED_NUMBER].name
end
end
# ---------------------------------------------------------------------------- #
# Spriteset Map
# ---------------------------------------------------------------------------- #
class Spriteset_Map
include SAO_HUD
alias initialize_HUD initialize
def initialize
soulpour_make_sao_hud
initialize_HUD
end
# ---------------------------------------------------------------------------- #
# Dispose
# ---------------------------------------------------------------------------- #
alias sao_hud_soulpour_dispose dispose
def dispose
sao_hud_soulpour_dispose_hud
sao_hud_soulpour_dispose
end
# ---------------------------------------------------------------------------- #
# Update
# ---------------------------------------------------------------------------- #
alias update_HUD update
def update
sao_hud_soulpour_update if @old_name != $game_party.members[0].name or @old_hp != $game_party.members[0].hp or @old_max_hp != $game_party.members[0].mhp or @old_level != $game_party.members[0].level
update_HUD
end
end
# ---------------------------------------------------------------------------- #
$soulpour777_rgss3_sao_hud = true
# ---------------------------------------------------------------------------- #
You will need this Graphics on your Graphics folder.
Attachments:
Full script and graphics also attached.
Huhubugin, Bubuuin, Daranasin, Ating tuklasin, Diwa't isip bubuhayin
Mula sa wala, Mundo ay nilikha, Nililok na mukha, Sa siklab ay nagsimula,
Tinanglaw ang palad, Likhang binigyang malay, Sa init, Hugis ang binagay!
Apoy! Mula sa wala, Mundo ay nilikha
Tinanglaw ang palad, Sa apoy hugis ang binagay