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.

[RESOLVED] Placement help with XAS HUD 2 (the one in XAS 3)

Ok, so for my Zelda game, I'm using XAS 3, and I was wondering if I could get some help moving the HUD components to where I want them. I'll post the actual script, and also a screenshot of how it is now, and an edited screen of how I would want it (approx)

Code:
module XAS_HUD
#Posição das janelas
WINDOW_STATUS_X = 0   
WINDOW_STATUS_Y = 370
#ID da switch que desativa a janela do Status.
DISABLE_STATUS_HUD_SWITCH = 5
end
$mogscript["mpstelen"] = true
###############
# Window_Base #
###############
class Window_Base < Window   
def draw_maphp2(actor, x, y)
actor = $game_party.actors[0]    
self.contents.font.size = 20  
back = RPG::Cache.picture("BAR_Meter")    
cw = back.width  
ch = back.height 
src_rect = Rect.new(0, 0, cw, ch)    
self.contents.blt(x + 65, y - ch + 30, back, src_rect)  
meter = RPG::Cache.picture("HP_Meter")    
cw = meter.width  * actor.hp / actor.maxhp
ch = meter.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_Tx")    
cw = text.width  
ch = text.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 111, y - 1, 48, 32, actor.hp.to_s, 2)
lowhp = actor.maxhp * 20 / 100
avhp = actor.maxhp * 50 / 100 
if actor.hp <= lowhp 
self.contents.font.color = Color.new(255,55,55,255)
elsif actor.hp <= avhp 
self.contents.font.color = Color.new(255,255,55,255)
else
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(x + 110, y - 2, 48, 32, actor.hp.to_s, 2)    
end  
def draw_mapsp2(actor, x, y)   
self.contents.font.size = 20  
back = RPG::Cache.picture("BAR_Meter")    
cw = back.width  
ch = back.height 
src_rect = Rect.new(0, 0, cw, ch) 
self.contents.blt(x + 65, y - ch + 30, back, src_rect)  
meter = RPG::Cache.picture("SP_Meter")    
cw = meter.width  * actor.sp / actor.maxsp
ch = meter.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_Tx")    
cw = text.width  
ch = text.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 111, y - 1, 48, 32, actor.sp.to_s, 2)    
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x + 110, y - 2, 48, 32, actor.sp.to_s, 2)    
end
def draw_mexp(actor, x, y)
self.contents.font.size = 16  
actor = $game_party.actors[0]
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture("Exp_Meter")
if actor.level < 99
cw = bitmap.width * rate 
else
cw = bitmap.width
end   
ch = bitmap.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40 , y - ch + 30, bitmap, src_rect)
bitmap2 = RPG::Cache.picture("Exp_Back")
cw = bitmap2.width 
ch = bitmap2.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40 , y - ch + 30, bitmap2, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 55, y + 1, 84, 32, "Exp",0)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 54, y, 84, 32, "Exp",0)
end
def nada
face = RPG::Cache.picture("")
end  
def draw_heroface(actor,x,y) 
face = RPG::Cache.picture(actor.name + "_face") rescue nada
cw = face.width 
ch = face.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)    
end  
def draw_actor_statemap(actor, x, y, width = 100)
self.contents.font.size = 16    
text = make_battler_state_text(actor, width, true)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, width, 32, text)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x, y, width, 32, text)
end
def draw_actor_levelmap(actor, x, y)
self.contents.font.size = 20    
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = Color.new(50,255,250,255)    
self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 30, y, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)    
self.contents.draw_text(x + 31, y + 1, 24, 32, actor.level.to_s, 1)    
end 
end
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#####################
# Window_Status_Map #
#####################
class Window_Sthero < Window_Base
def initialize
super(0, 0, 240, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")    
self.contents.font.bold = true
self.contents.font.name = "Georgia"
self.opacity = 0
refresh
end  
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_maphp2(actor, 35, 35)
draw_mapsp2(actor, - 40, 60)
draw_heroface(actor, 0, 70)
draw_actor_statemap(actor, 130, 60, 70)
draw_actor_levelmap(actor, 80, 10)   
draw_mexp(actor, 90, 10) 
end
end

(Thats all the stuff that I think might have to do with that kinda stuff. There's most likely going to be some stuff that doesn't have to do with that at all...)

Sorry I'm a tad horrible at scripting and pixel numbers and all that. That's kinda why I need your help :wink:

so this is how it looks now:
http://i248.photobucket.com/albums/gg188/kirbylore/hudscreen1.jpg[/img]

and this is the edited image of where I want things moved, and what text I want gone (most of it):
http://i248.photobucket.com/albums/gg188/kirbylore/hudscreen2.jpg[/img]


Here's the HUD pieces I've made, btw:
http://i248.photobucket.com/albums/gg188/kirbylore/HP_Meter.png[/img]
http://i248.photobucket.com/albums/gg18 ... e/Gold.png[/img]
http://i248.photobucket.com/albums/gg18 ... W_Item.png[/img]http://i248.photobucket.com/albums/gg188/kirbylore/Mequip.png[/img]
http://i248.photobucket.com/albums/gg18 ... _Meter.png[/img]

Some of the pieces I just deleted because I didn't want them in there.

If you could help me out, that'd be very fantastic! I don't really have too much time to do this, so if you ARE interested, you have until next monday night at the LATEST you can finish. I'm not asking you to do busy work for me. I'm asking you to help me do something I really don't know how to do. If you want to explain to me how to move everything myself, that'd be equally as excelent ^_^

thanks again!
 
Code:
WINDOW_STATUS_X = 0   
WINDOW_STATUS_Y = 370

Change these values to where you want the HUD to be at. I think the lower the number, the higher up it will go on the Y-Axis. Note that this will only move the HP, SP, and exp bars.

To move the rest of the HUD you'll have to go to this snippet:

Code:
#===============================================================================
# XAS - HUD CONFIG
#===============================================================================
module XAS_HUD
#Posição das janelas dos itens e skills.  
WINDOW_SKILL_X = 550 
WINDOW_SKILL_Y = 370
WINDOW_ITEM_X = 480 
WINDOW_ITEM_Y = 370
WINDOW_EQUIP_X = 525
WINDOW_EQUIP_Y = 320
WINDOW_DASH_X = 50
WINDOW_DASH_Y  = 355
end

and change these according to where you want your HUD to be at. I'm not so sure about moving the other text, though, but to get rid of the "Stock" And "Magic" Text, you'll have to simply erase it.
 
Ok, thanks a lot! That's exactly what I was looking for. :D thanks again!

Oh, and I figured out how to take out those numbers and stuff. Where it has:

Code:
#####################
# Window_Status_Map #
#####################
class Window_Sthero < Window_Base
def initialize
super(0, 0, 240, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")    
self.contents.font.bold = true
self.contents.font.name = "Georgia"
self.opacity = 0
refresh
end 

I took out 'Georgia', and it just erased it. Maybe I'm not too stupid after all :wink:
 

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