- NostalGeekMembre
- Nombre de messages : 107
Distinction : aucune
Date d'inscription : 02/03/2008
Sript barre vie sur la map, help please!! [Résolu]
Mer 19 Mar 2008 - 20:04
Bonjour à tous!
J'aurais besoin de votreaide pour une modif de script.
Voilà j'aimerai changer le script de la barre de vie sur la map
Pour ne pas afficher la barre d'exp(je sais le faire) et afficher la barre MP QUE pour une certaine classe.
Pouvez-vous m'aider svp
merci d'avance!
@+
J'aurais besoin de votreaide pour une modif de script.
Voilà j'aimerai changer le script de la barre de vie sur la map
- Spoiler:
- #=============================================================
# *** Silent's HUD
# ** Version - 1.1 RMVX
# * Fecha - 28/01/08 DD/MM/YY Version 1.1 -> 07/02/08
#----------------------------------------------------------------------------#
# * Descripcion - Simple HUD que muestra el HP, mp, EXP y nombre del jugador
# principal en el mapa, ideal para ARPGs
#
# * Placer le script au dessus du script Main.
#
# * lalala
#
# >*< 0; Haut gauche 1; Haut droite 2; Bas gauche 3; Bas droite
#============================================================================#
LUGAR = 0 # Position des barres >*<
HUD_BAR_HP = true # Montrer barre HP
HUD_BAR_MP = true # Montrer Barre MP
HUD_BAR_EP = true # Montrer barre EXP
ON_OFF_SWITCH = 10 # Numéros interrupteur
#============================================================================#
# ** Window_HUD
# - Ventana donde se muestra la info en el mapa
#============================================================================#
class Window_HUD < Window_Base
#--------------------------------------------------------------------------#
# * Metodo Initialize
#--------------------------------------------------------------------------#
def initialize
super(0, 0, 280, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------#
# * Refresh
#--------------------------------------------------------------------------#
def refresh
actor = $game_actors[1]
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 110-2, 22, $game_actors[1].name, 2)
draw_hud_actor_hp(actor, 30, 20) if HUD_BAR_HP == true
draw_hud_actor_mp(actor, 30, 50) if HUD_BAR_MP == true
draw_hud_actor_exp(actor, 30, 80) if HUD_BAR_EP == true
end
end
#============================================================================#
# ** Scene_Map alias
# - alias a Scene_Map con metodos del HUD
#============================================================================#
class Scene_Map
alias hud_main main
alias hud_update update
alias hud_terminate terminate
#--------------------------------------------------------------------------#
# * Metodo Principal
#--------------------------------------------------------------------------#
def main
@lalalah = $game_actors[1].hp
@lalalas = $game_actors[1].mp
@lalalae = $game_actors[1].exp
@hud = Window_HUD.new
case LUGAR
when 0
@hud.y = 0
@hud.x = 0
when 1
@hud.y = 280
@hud.x = 0
when 2
@hud.y = 0
@hud.x = 340
when 3
@hud.y = 280
@hud.x = 340
end
@hud.visible = false
hud_main
end
#--------------------------------------------------------------------------#
# * Update
#--------------------------------------------------------------------------#
def update
if $game_switches[ON_OFF_SWITCH] == true
@hud.visible = true
$game_map.refresh
else
@hud.visible = false
$game_map.refresh
end
if $game_switches[ON_OFF_SWITCH] == true
if $game_actors[1].hp != @lalalah and HUD_BAR_HP == true
@hud.refresh
@lalalah = $game_actors[1].hp
@hud.update
end
if $game_actors[1].mp != @lalalas and HUD_BAR_MP == true
@hud.refresh
@lalalas = $game_actors[1].mp
@hud.update
end
if $game_actors[1].exp != @lalalae and HUD_BAR_EP == true
@hud.refresh
@lalalae = $game_actors[1].exp
@hud.update
end
end
hud_update
end
#--------------------------------------------------------------------------#
# * Terminate
#--------------------------------------------------------------------------#
def terminate
@hud.dispose
hud_terminate
end
end
#============================================================================#
# ** Adiciones a Window_Base
# - Metodo de dibujado de barra de exp, hp y mp
#============================================================================#
class Window_Base < Window
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de hp
#--------------------------------------------------------------------------#
def draw_hp_bar(actor, x, y)
hpwidth = (actor.hp * 10) / actor.maxhp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, hpwidth, 10, Color.new(155, 50, 50, 100))
end
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de mp
#--------------------------------------------------------------------------#
def draw_mp_bar(actor, x, y)
mpwidth = (actor.mp * 10) / actor.maxmp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, mpwidth, 10, Color.new(50, 50, 155, 100))
end
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de exp
#--------------------------------------------------------------------------#
def draw_exp_bar(actor, x, y)
exp = actor.exp_s.to_i
max_exp = actor.next_exp_s.to_i
expwidth = (exp * 10) / max_exp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, expwidth, 10, Color.new(50, 155, 50, 100))
end
#--------------------------------------------------------------------------#
# * Draw EXP Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_exp(actor, x, y)
self.contents.font.color = Color.new(10, 100, 10)
draw_exp_bar(actor, x, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, 'E')
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 84, y, 12, 32, '/', 1)
self.contents.draw_text(x + 96, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------#
# * Draw HP Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_hp(actor, x, y, width = 144)
self.contents.font.color = Color.new(100, 10, 10)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
draw_hp_bar(actor, hp_x - 36, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, Vocab::hp_a)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, '/', 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------#
# * Draw mp Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_mp(actor, x, y, width = 144)
self.contents.font.color = Color.new(10, 10, 100)
if width - 32 >= 108
mp_x = x + width - 108
flag = true
elsif width - 32 >= 48
mp_x = x + width - 48
flag = false
end
draw_mp_bar(actor, mp_x - 36, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, Vocab::mp_a)
self.contents.font.color = actor.mp == 0 ? knockout_color :
actor.mp <= actor.maxmp / 4 ? crisis_color : normal_color
self.contents.draw_text(mp_x, y, 48, 32, actor.mp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(mp_x + 48, y, 12, 32, '/', 1)
self.contents.draw_text(mp_x + 60, y, 48, 32, actor.maxmp.to_s)
end
end
#----------------------------------------------------------------------------#
end
Pour ne pas afficher la barre d'exp(je sais le faire) et afficher la barre MP QUE pour une certaine classe.
Pouvez-vous m'aider svp
merci d'avance!
@+
Re: Sript barre vie sur la map, help please!! [Résolu]
Mer 19 Mar 2008 - 20:25
tu peux me dire de quelle classe il s'agit et son id dans la base de données ?
- NostalGeekMembre
- Nombre de messages : 107
Distinction : aucune
Date d'inscription : 02/03/2008
Re: Sript barre vie sur la map, help please!! [Résolu]
Mer 19 Mar 2008 - 21:25
pas de problème!
il sagit de la classe mage et son id est 002
il sagit de la classe mage et son id est 002
Re: Sript barre vie sur la map, help please!! [Résolu]
Mer 19 Mar 2008 - 21:46
- Spoiler:
- Code:
#=============================================================
# *** Silent's HUD
# ** Version - 1.1 RMVX
# * Fecha - 28/01/08 DD/MM/YY Version 1.1 -> 07/02/08
#============================================================================#
LUGAR = 0 # Position des barres >*<
HUD_BAR_HP = true # Montrer barre HP
HUD_BAR_MP = true # Montrer Barre MP
HUD_BAR_EP = true # Montrer barre EXP
ON_OFF_SWITCH = 10 # Numéros interrupteur
#============================================================================#
# ** Window_HUD
# - Ventana donde se muestra la info en el mapa
#============================================================================#
class Window_HUD < Window_Base
#--------------------------------------------------------------------------#
# * Metodo Initialize
#--------------------------------------------------------------------------#
def initialize
super(0, 0, 280, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------#
# * Refresh
#--------------------------------------------------------------------------#
def refresh
actor = $game_actors[1]
self.contents.clear
@y_exp = 50
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 110-2, 22, $game_actors[1].name, 2)
draw_hud_actor_hp(actor, 30, 20) if HUD_BAR_HP == true
if HUD_BAR_MP == true and actor.class_id == 2 #si l'id de la classe du hero est 2 alors...
draw_hud_actor_mp(actor, 30, 50)
@y_exp = 80 #si oui on decale la barre d'exp
end
draw_hud_actor_exp(actor, 30, @y_exp) if HUD_BAR_EP == true
end
end
#============================================================================#
# ** Scene_Map alias
# - alias a Scene_Map con metodos del HUD
#============================================================================#
class Scene_Map
alias hud_main main
alias hud_update update
alias hud_terminate terminate
#--------------------------------------------------------------------------#
# * Metodo Principal
#--------------------------------------------------------------------------#
def main
@lalalah = $game_actors[1].hp
@lalalas = $game_actors[1].mp
@lalalae = $game_actors[1].exp
@hud = Window_HUD.new
case LUGAR
when 0
@hud.y = 0
@hud.x = 0
when 1
@hud.y = 280
@hud.x = 0
when 2
@hud.y = 0
@hud.x = 340
when 3
@hud.y = 280
@hud.x = 340
end
@hud.visible = false
hud_main
end
#--------------------------------------------------------------------------#
# * Update
#--------------------------------------------------------------------------#
def update
if $game_switches[ON_OFF_SWITCH] == true
@hud.visible = true
$game_map.refresh
else
@hud.visible = false
$game_map.refresh
end
if $game_switches[ON_OFF_SWITCH] == true
if $game_actors[1].hp != @lalalah and HUD_BAR_HP == true
@hud.refresh
@lalalah = $game_actors[1].hp
@hud.update
end
if $game_actors[1].mp != @lalalas and HUD_BAR_MP == true
@hud.refresh
@lalalas = $game_actors[1].mp
@hud.update
end
if $game_actors[1].exp != @lalalae and HUD_BAR_EP == true
@hud.refresh
@lalalae = $game_actors[1].exp
@hud.update
end
end
hud_update
end
#--------------------------------------------------------------------------#
# * Terminate
#--------------------------------------------------------------------------#
def terminate
@hud.dispose
hud_terminate
end
end
#============================================================================#
# ** Adiciones a Window_Base
# - Metodo de dibujado de barra de exp, hp y mp
#============================================================================#
class Window_Base < Window
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de hp
#--------------------------------------------------------------------------#
def draw_hp_bar(actor, x, y)
hpwidth = (actor.hp * 10) / actor.maxhp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, hpwidth, 10, Color.new(155, 50, 50, 100))
end
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de mp
#--------------------------------------------------------------------------#
def draw_mp_bar(actor, x, y)
mpwidth = (actor.mp * 10) / actor.maxmp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, mpwidth, 10, Color.new(50, 50, 155, 100))
end
#--------------------------------------------------------------------------#
# * Metodo de dibujado de la barra de exp
#--------------------------------------------------------------------------#
def draw_exp_bar(actor, x, y)
exp = actor.exp_s.to_i
max_exp = actor.next_exp_s.to_i
expwidth = (exp * 10) / max_exp * 12 * (1)
self.contents.fill_rect(x + 0, y + 0, 1 * 120 + 4, 14, Color.new(0, 0, 0, 100))
self.contents.fill_rect(x + 1, y + 1, 1 * 120 + 2, 12, Color.new(255, 255, 255))
self.contents.fill_rect(x + 2, y + 2, 1 * 120, 10, Color.new(0, 0, 0, 150))
self.contents.fill_rect(x + 2, y + 2, expwidth, 10, Color.new(50, 155, 50, 100))
end
#--------------------------------------------------------------------------#
# * Draw EXP Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_exp(actor, x, y)
self.contents.font.color = Color.new(10, 100, 10)
draw_exp_bar(actor, x, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, 'E')
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 84, y, 12, 32, '/', 1)
self.contents.draw_text(x + 96, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------#
# * Draw HP Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_hp(actor, x, y, width = 144)
self.contents.font.color = Color.new(100, 10, 10)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
draw_hp_bar(actor, hp_x - 36, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, Vocab::hp_a)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, '/', 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------#
# * Draw mp Editado
#--------------------------------------------------------------------------#
def draw_hud_actor_mp(actor, x, y, width = 144)
self.contents.font.color = Color.new(10, 10, 100)
if width - 32 >= 108
mp_x = x + width - 108
flag = true
elsif width - 32 >= 48
mp_x = x + width - 48
flag = false
end
draw_mp_bar(actor, mp_x - 36, y + 16)
self.contents.draw_text(x - 30, y + 6, 32, 32, Vocab::mp_a)
self.contents.font.color = actor.mp == 0 ? knockout_color :
actor.mp <= actor.maxmp / 4 ? crisis_color : normal_color
self.contents.draw_text(mp_x, y, 48, 32, actor.mp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(mp_x + 48, y, 12, 32, '/', 1)
self.contents.draw_text(mp_x + 60, y, 48, 32, actor.maxmp.to_s)
end
end
#----------------------------------------------------------------------------#
end
- NostalGeekMembre
- Nombre de messages : 107
Distinction : aucune
Date d'inscription : 02/03/2008
Re: Sript barre vie sur la map, help please!! [Résolu]
Mer 19 Mar 2008 - 22:12
merci beaucoup!!
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|