I need helping Editing a script

Started by ojp2010, February 18, 2010, 05:23:50 pm

Previous topic - Next topic

ojp2010

February 18, 2010, 05:23:50 pm Last Edit: February 18, 2010, 05:25:51 pm by ojp2010
I am using Mog XAS system and I need help moving the HUD icons to the right side of the screen. Removing the exp bar and Lvl icons.

Here is the HUD script

*********************

#_______________________________________________________________________________
# MOG XAS Hud V2.6          
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Apresenta o status do herói no mapa.
# (HP,SP,Condição,Exp,level) em imagens.
#_______________________________________________________________________________
# Imagens necessarias.
#
# Nome_do_Personagem + _Face.png
# HP_Meter.png
# SP_Meter.png
# HP_Tx.png
# SP_Tx.png
# LV_Tx.png
# Bar_Meter.png
# Exp_Back.png
# Exp_Meter.png
#
#_______________________________________________________________________________
module XAS_HUD
   #Posição das janelas
   XASHUD_X = 0  
   XASHUD_Y = 370
   #ID da switch que desativa a janela do Status.
   DISABLE_STATUS_HUD_SWITCH = 5
   #Mostrar ícones dos status
   ICON_STATES = true
   #Deixar o HUD opaco caso o herói estiver em cima do HUD.
   FADE = true
end
$mog_rgss_xas_hud = true
###############
# Window_Base #
###############
class Window_Base < Window  
def draw_maphp2(actor, x, y)
   actor = $game_party.actors[0]    
   self.contents.font.size = 18  
   back = RPG::Cache.picture("BAR_Meter")    
   cw = back.width  
   ch = back.height
   src_rect = Rect.new(0, 0, cw, ch)    
   self.contents.blt(x + 62, y - ch + 28, 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 + 62, y - ch + 28, 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 + 76, 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 + 75, y - 2, 48, 32, actor.hp.to_s, 2)    
end  
def draw_mapsp2(actor, x, y)
   actor = $game_party.actors[0]    
   self.contents.font.size = 18  
   back = RPG::Cache.picture("BAR_Meter")    
   cw = back.width  
   ch = back.height
   src_rect = Rect.new(0, 0, cw, ch)    
   self.contents.blt(x + 62, y - ch + 28, 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 + 62, y - ch + 28, 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 + 35, y - ch + 30, text, src_rect)
   self.contents.font.color = Color.new(0,0,0,255)
   self.contents.draw_text(x + 76, y - 1, 48, 32, actor.sp.to_s, 2)
   self.contents.font.color = Color.new(255,255,255,255)
   self.contents.draw_text(x + 75, y - 2, 48, 32, actor.sp.to_s, 2)    
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)
if XAS_HUD::ICON_STATES == false  
   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)
else
sta = []
for i in actor.states
   sta.push($data_states.name)
   for s in 0...sta.size
     if s < 4
     bitmap = RPG::Cache.icon(sta)
     self.contents.blt(x + (25 * s), y + 4, bitmap, Rect.new(0, 0, 32, 32))
     end
   end
end  
end  





#
end
def draw_actor_levelmap(actor, x, y)
   bitmap2 = RPG::Cache.picture("Exp_Back")
   cw = bitmap2.width
   ch = bitmap2.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 10 , y - ch + 30, bitmap2, src_rect)
 
   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 + 10 , y - ch + 30, bitmap, src_rect)
   text = RPG::Cache.picture("LV_Tx")    
   cw = text.width  
   ch = text.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 0, y - ch + 30, text, src_rect)  
   self.contents.font.size = 18  
   self.contents.font.color = Color.new(0,0,0,255)
   self.contents.draw_text(x + 30, y - 4, 24, 32, actor.level.to_s, 1)
   self.contents.font.color = Color.new(255,255,255,255)    
   self.contents.draw_text(x + 31, y - 5, 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_HUD < Window_Base
def initialize
   super(0, 0, 270, 125)
   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
   @actor = $game_party.actors[0]
   if @actor != nil
   @old_hp = @actor.hp
   @old_sp = @actor.sp
   @old_level = @actor.level
   @old_state = @actor.states.to_s
   @old_exp = @actor.exp
   refresh
   end
end  
def refresh
 self.contents.clear
   draw_maphp2(@actor, 5, 35)
   draw_mapsp2(@actor, -35, 55)
   draw_heroface(@actor, 0, 60)
   draw_actor_statemap(@actor, 140, 62, 70)
   draw_actor_levelmap(@actor, 45, 10)  
   @old_hp = @actor.hp
   @old_sp = @actor.sp
   @old_level = @actor.level
   @old_state = @actor.states.to_s
   @old_exp = @actor.exp    
end
def update
   if XAS_HUD::FADE == true
   x = ($game_player.real_x - $game_map.display_x) / 4
   y = ($game_player.real_y - $game_map.display_y) / 4
   hud_size_x = 180
   hud_size_y = 100
   oc_range_x = hud_size_x + XAS_HUD::XASHUD_X
   oc_range_y = hud_size_y + XAS_HUD::XASHUD_Y
     if x < oc_range_x and x > XAS_HUD::XASHUD_X - 5 and
        y > XAS_HUD::XASHUD_Y and y < oc_range_y
     self.contents_opacity -= 10 if  self.contents_opacity > 120
     else
     self.contents_opacity += 10 if  self.contents_opacity < 255
     end
  end
  if @actor != nil  
  if @old_hp != @actor.hp or
     @old_sp != @actor.sp or
     @old_level != @actor.level or
     @old_state != @actor.states.to_s or
     @old_exp != @actor.exp      
  refresh
  end
  end
end
end
###############
# Game_Player #
###############
class Game_Player < Game_Character
   attr_accessor :wref
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog11_main main
def main
   @sthero = Window_HUD.new
   @sthero.x = XAS_HUD::XASHUD_X
   @sthero.y = XAS_HUD::XASHUD_Y
   if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
   @sthero.visible = true  
   else
   @sthero.visible = false  
   end    
   mog11_main
   @sthero.dispose
end
alias mog11_update update
def update
   if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
   @sthero.visible = true  
   else
   @sthero.visible = false  
   end      
   @sthero.update
   mog11_update
end    
end  


****

Trainer Zydragon

I would ASSUME that you change XASHUD_Y to 0 rather than 370
Thats on a quick scan of the script and that may solve your screen side problem.
Ill let one of the other members sort the bar removal, and I'll have a look at it later properly