[Résolu] Problème avec la vie sur la map
Sam 25 Oct 2008 - 11:26
Comme dit dans le titre, j'ai un problème avec le script de vie sur la map (que l'on retrouve dans le menu simpliste de Arayashiki.
http://rpgmakervx.1fr1.net/maps-f41/vie-sur-la-map-t657.htm
J'aimerais savoir si il serait possible de changer le personnage visé par le script.
Car en effet, le script vise le personnage numéro 1 et non le premier personnage de l'équipe...
Le problème c'est que mon personnage numéro n'intervient pas mais que 10 personnages différents peuvent être choisis pour jouer.
Soit un guerrier, une guerrière, un voleur, une vol...
J'ai essayé de remplacé le "1" par Actor_id (et bien d'autres choses) mais ça ne fonctionne pas
Prenez votre temps car je sais que vous êtes très occupé...
Merci d'avance pour vos réponses.
http://rpgmakervx.1fr1.net/maps-f41/vie-sur-la-map-t657.htm
J'aimerais savoir si il serait possible de changer le personnage visé par le script.
Car en effet, le script vise le personnage numéro 1 et non le premier personnage de l'équipe...
Le problème c'est que mon personnage numéro n'intervient pas mais que 10 personnages différents peuvent être choisis pour jouer.
Soit un guerrier, une guerrière, un voleur, une vol...
J'ai essayé de remplacé le "1" par Actor_id (et bien d'autres choses) mais ça ne fonctionne pas
Prenez votre temps car je sais que vous êtes très occupé...
Merci d'avance pour vos réponses.
Re: [Résolu] Problème avec la vie sur la map
Sam 25 Oct 2008 - 12:56
J'ai changé tous les
$game_actors[1]
en
$game_actors[0]
Mais ça ne fonctionne toujours pas...
ça me dit:
LIGNE 164:
$game_actors[1]
en
$game_actors[0]
Mais ça ne fonctionne toujours pas...
ça me dit:
- Spoiler:
Script "Menu Simpliste" line 164: NoMethodError occured.
undefined method 'hp' for nil: NillClass
LIGNE 164:
- Spoiler:
- @lalalah = $game_actors[0].hp
- ArayashikiMembre
- Nombre de messages : 655
Age : 34
Localisation : Trois lettres me demangent. Oserai-je ?
Distinction : FUCKING nouveau dieu du mal. Gros connard en chef.
Date d'inscription : 18/08/2008
Re: [Résolu] Problème avec la vie sur la map
Dim 26 Oct 2008 - 12:14
Merde pourtant il marchait avant que je le reposte dans la section RGSS. Et ça me fait le même problème.
Le souci c'est que je trouve pas la méthode hp
Le souci c'est que je trouve pas la méthode hp
Re: [Résolu] Problème avec la vie sur la map
Dim 26 Oct 2008 - 15:27
c'est normal: hp est une methode de RPG::Actor, si je ne m'abuse...
essaye : p $game_party.members[0]
qui est la meme chose que $game_actors[i]
qui est chargé dans title $data_actors = load_data("Data/Actors.rvdata")
Bon, pour le script: vaut mieux utiliser $game_party.members[id]:
Tu modifies la variable 10 pour changer de hero...
ca renvoie une erreur si il n'y a pas de hero d'id de la variable
essaye : p $game_party.members[0]
qui est la meme chose que $game_actors[i]
qui est chargé dans title $data_actors = load_data("Data/Actors.rvdata")
Bon, pour le script: vaut mieux utiliser $game_party.members[id]:
Tu modifies la variable 10 pour changer de hero...
ca renvoie une erreur si il n'y a pas de hero d'id de la variable
- Code:
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
VAR_N = 10 # Numéro variable id hero
class Window_HUD < Window_Base
def initialize
super(0, 0, 280, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
actor = $game_party.members[$game_variables[VAR_N]]
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 110-2, 22, $game_party.members[$game_variables[VAR_N]].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
class Scene_Map
alias hud_main main
alias hud_update update
alias hud_terminate terminate
def main
$game_switches[ON_OFF_SWITCH] = true
@lalalah = $game_party.members[$game_variables[VAR_N]].hp
@lalalas = $game_party.members[$game_variables[VAR_N]].mp
@lalalae = $game_party.members[$game_variables[VAR_N]].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
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_party.members[$game_variables[VAR_N]].hp != @lalalah and HUD_BAR_HP == true
@hud.refresh
@lalalah = $game_party.members[$game_variables[VAR_N]].hp
@hud.update
end
if $game_party.members[$game_variables[VAR_N]].mp != @lalalas and HUD_BAR_MP == true
@hud.refresh
@lalalas = $game_party.members[$game_variables[VAR_N]].mp
@hud.update
end
if $game_party.members[$game_variables[VAR_N]].exp != @lalalae and HUD_BAR_EP == true
@hud.refresh
@lalalae = $game_party.members[$game_variables[VAR_N]].exp
@hud.update
end
end
hud_update
end
def terminate
@hud.dispose
hud_terminate
end
end
class Window_Base < Window
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
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
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
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
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
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
Re: [Résolu] Problème avec la vie sur la map
Dim 26 Oct 2008 - 16:10
Ok...
En fait sur le menu simpliste j'ai rajouté les équipements, puis les compétences, puis le status...
En fait j'ai supprimé le script car je n'en avait pas besoin mais merci d'avoir réglé le problème.
Désolé du dérangement...
En fait sur le menu simpliste j'ai rajouté les équipements, puis les compétences, puis le status...
En fait j'ai supprimé le script car je n'en avait pas besoin mais merci d'avoir réglé le problème.
Désolé du dérangement...
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|