Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with HUD script

I got this HUD script and I want to do 2 things:
1. Delete the EXP bar from the script.
2. Delete the "Item02" from the script.


the script:
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('My HUD', 'Icedmetal57', "1.0", '8/1/2006')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('My HUD') == true


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
#=====================================
#Gradient Bars with customizable lengths, thicknesses, types and Colors
#By AcedentProne
#=====================================
def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(153,238,153,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
elsif type == "vertical"
width = thick
height = length
self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
h = height * e1 / e2
for i in 0..width
r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
end
end
end
def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
elsif type == "vertical"
width = thick
height = length
self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
h = height * e1 / e2
for i in 0..width
r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
end
end
end
#--------------------------------------------------------------------------
# * Draw EXP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "Exp")
self.contents.font.color = normal_color
self.contents.draw_text(x + 10, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 100, y, 12, 32, "/", 1)
self.contents.draw_text(x + 112, y, 84, 32, actor.next_exp_s)
end
end


#============================================
# Window_Map
# Originally by Destined, edited by Darklord and Icedmetal57
#============================================
class Window_HUD < Window_Base
def initialize
super(0, 0, 240, 165) #360
$game_party.actors[0].name = Network::Main.name
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 16
self.contents.draw_text(36, 0, 640, 32, $game_party.actors[0].name.to_s)
self.contents.font.color = normal_color
chatc = RPG::Cache.icon("033-Item02")
chat_rect = Rect.new(0, 0, chatc.width, chatc.height)
self.contents.blt(120, 78, chatc, chat_rect) if $game_temp.chat_refresh
draw_normal_barz(36, 27, "horizontal", 150, 10, $game_party.actors[0].hp.to_i, $game_party.actors[0].maxhp.to_i, Color.new (225, 0, 0, 225))
draw_normal_barz(36, 42, "horizontal", 150, 10, $game_party.actors[0].sp.to_i, $game_party.actors[0].maxsp.to_i, Color.new (0,0,255,255))
draw_normal_barz(36, 57, "horizontal", 150, 10, $game_party.actors[0].exp_s.to_i, $game_party.actors[0].next_exp_s.to_i, Color.new (0, 255, 0, 225))
draw_actor_graphic($game_party.actors[0], 15, 63)
draw_actor_level($game_party.actors[0], 128, 0)
draw_actor_hp($game_party.actors[0], 42, 17)
draw_actor_sp($game_party.actors[0], 42, 32)
draw_actor_exp($game_party.actors[0], 42, 47)
end
# def update
# refresh
# end
end

#============================================
# Scene_Map
# Edits the scene Scene_Map
#============================================
class Scene_Map
def initialize_hud
@hud = Window_HUD.new
@hud.opacity = 0 #the opacity for the window. 0=completely transparent, 255=completely visible
@player_hp = $game_party.actors[0].hp
@player_sp = $game_party.actors[0].sp
@player_exp = $game_party.actors[0].exp
@player_gold = $game_party.gold
@player_sprite = $game_party.actors[0].character_name
end
alias old_main main
def main
initialize_hud
old_main
end
def dispose
@hud.dispose
end
alias old_update update
def update
@hud.refresh if @player_hp != $game_party.actors[0].hp or @player_sp != $game_party.actors[0].sp or @player_exp != $game_party.actors[0].exp or @player_gold != $game_party.gold or @player_sprite != $game_party.actors[0].character_name or $game_temp.chat_refresh
old_update
end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
Tnx any way.:-/
 
Code:
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('My HUD', 'Icedmetal57', "1.0", '8/1/2006')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('My HUD') == true


#================================================= =============================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#================================================= =============================

class Window_Base < Window
#=====================================
#Gradient Bars with customizable lengths, thicknesses, types and Colors
#By AcedentProne
#=====================================
def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(153,238,153,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
elsif type == "vertical"
width = thick
height = length
self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
h = height * e1 / e2
for i in 0..width
r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
end
end
end
def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
elsif type == "vertical"
width = thick
height = length
self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
h = height * e1 / e2
for i in 0..width
r = c1.red + (c2.red - c1.red) * (width -i)/width + 0 * i/width
g = c1.green + (c2.green - c1.green) * (width -i)/width + 0 * i/width
b = c1.blue + (c2.blue - c1.blue) * (width -i)/width + 0 * i/width
a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width + 255 * i/width
self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
end
end
end

#============================================
# Window_Map
# Originally by Destined, edited by Darklord and Icedmetal57
#============================================
class Window_HUD < Window_Base
def initialize
super(0, 0, 240, 165) #360
$game_party.actors[0].name = Network::Main.name
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 16
self.contents.draw_text(36, 0, 640, 32, $game_party.actors[0].name.to_s)
self.contents.font.color = normal_color
draw_normal_barz(36, 27, "horizontal", 150, 10, $game_party.actors[0].hp.to_i, $game_party.actors[0].maxhp.to_i, Color.new (225, 0, 0, 225))
draw_normal_barz(36, 42, "horizontal", 150, 10, $game_party.actors[0].sp.to_i, $game_party.actors[0].maxsp.to_i, Color.new (0,0,255,255))
draw_actor_graphic($game_party.actors[0], 15, 63)
draw_actor_level($game_party.actors[0], 128, 0)
draw_actor_hp($game_party.actors[0], 42, 17)
draw_actor_sp($game_party.actors[0], 42, 32)
end
# def update
# refresh
# end
end

#============================================
# Scene_Map
# Edits the scene Scene_Map
#============================================
class Scene_Map
def initialize_hud
@hud = Window_HUD.new
@hud.opacity = 0 #the opacity for the window. 0=completely transparent, 255=completely visible
@player_hp = $game_party.actors[0].hp
@player_sp = $game_party.actors[0].sp
@player_gold = $game_party.gold
@player_sprite = $game_party.actors[0].character_name
end
alias old_main main
def main
initialize_hud
old_main
end
def dispose
@hud.dispose
end
alias old_update update
def update
@hud.refresh if @player_hp != $game_party.actors[0].hp or @player_sp != $game_party.actors[0].sp or @player_gold != $game_party.gold or @player_sprite != $game_party.actors[0].character_name or $game_temp.chat_refresh
old_update
end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

I believe that is what you want. By the way, what is the tag to hide content?
 
Tnx I will tr it right away!:D
EDIT: It's not working.:( it has problem on the last line: end. please help!

Wh you guys making mee BUMP? :( there is a lot good scripters here.. don't tell me you can't handle such a basic script(!) :(
 

Mac

Member

Swordhunter;153043 said:
Wh you guys making mee BUMP? :( there is a lot good scripters here.. don't tell me you can't handle such a basic script(!) :(

Don't say stuff like that cause it annoys and offends the reader, you should have a calm mannerr and be patient and don't snap.

The problem you mentioned is probably cause you don't have the SDK inplemented or cause the code is missing an end.
 
Ok I will explain again:

I have a HUD script. I want to remove the EXP bar from there. I want to remove the Icon of "Item02" to. Baskinein gave me a fixed script. BUT(!) the script giving me an error and the error saing there is something wrong on the last line. The last line is "end".
Please help me.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top