Problème script de coeur

Démarré par machino4, 04 Janvier 2008 à 21:58

0 Membres et 1 Invité sur ce sujet

Salut à tous! J'ai mis un script de coeur dans mon jeu amateur et il fonctionne parfaitement. Mais, je ne sais pas comment en ajouter après avoir battu un boss... J'ai essayé de faire "modifier les PV" ou "Modifier le niveau" mais sa ne marche pas... J'utilise RPG Maker Xp  :huh:

Voici le script:
[spoiler]
class Window_Corazones < Window_Base
def initialize
super(-8, -8, 640, 96)
#=== Options ===
corazones = 3
opacidad = 255
opcion =
#=== Options end ==
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.opacity = 0
@hearts = corazones
@opacity = opacidad
@option = opcion
@hr = 0
refresh
end
#----------------------------------------
# - Actualisation
#----------------------------------------
def refresh
self.contents.clear
@n = $game_party.actors[0].hp
@mn = $game_party.actors[0].maxhp
#n is the value, and mn the maxvalue:
@hr = 0
@lh = 0
for i in 0..@hearts-1
self.contents.fill_rect(i*14, 4, 1, 2, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+1, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+2, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+3, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+4, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+5, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+6, 2, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+7, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+8, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+9, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+10, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+11, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+12, 4, 1, 2, Color.new(0, 0, 0, @opacity))
#
self.contents.fill_rect(i*14+1, 4, 1, 2, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+2, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+3, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+4, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+5, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+6, 3, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+7, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+8, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+9, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+10, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+11, 4, 1, 2, Color.new(255, 255, 255, @opacity))
#
#@c = 255
@l = @n*100/@mn
@ho = @l*@hearts
c_color(1)
self.contents.fill_rect(i*14+2, 4, 1, 2, Color.new(@c, 0, 0, @opacity))
c_color(2)
self.contents.fill_rect(i*14+3, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(3)
self.contents.fill_rect(i*14+4, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(4)
self.contents.fill_rect(i*14+5, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(5)
self.contents.fill_rect(i*14+6, 4, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(6)
self.contents.fill_rect(i*14+7, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(7)
self.contents.fill_rect(i*14+8, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(8)
self.contents.fill_rect(i*14+9, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(9)
self.contents.fill_rect(i*14+10, 4, 1, 2, Color.new(@c, 0, 0, @opacity))

@hr += 1
end
if @option == 1
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, $game_party.actors[0].name, 0)
elsif @option == 2
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@n}/#{@mn}", 0)
elsif @option == 3
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@ho/100}/#{@hearts}", 0)
elsif @option == 4
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@l}%", 0)
end
end

def c_color(a)
if @hr <= (@ho/100)-1
@c = 255
else
if @ho/10-@hr*10 >= a and @ho/10-@hr*10 <= 9

@c = 255
else
@c = 0
end
end
end

def corazones(corazones)
@hearts = corazones
end
end

[/spoiler]

Quelqu'un peux m' aider?
Visitez Super Smash Bros. Powa !! http://ssbpowa.comli.com/

Brawl is the best game ever!

The legend of Zelda: Ganon's return creator

Les scripts, tu sais, c'est jamais l'idéal, ça crée pleins de bugs, et généralement on comprend pas ce que signifie le code, donc on ne peut pas y remédier directement. ;)

Je te conseille de programmer en évènement tes coeurs, je te renvoie pour ceci à un excellent tutoriel :

http://forums.zelda-solarus.com/index.php/topic,8881.0.html

Tu as aussi la solution de passer a game maker, coté programmation tu pourras tous faire.  :)

Mais de façon générale je ne suis pas fan des script.
Pour les utiliser correctement il faut connaitre et comprendre l'intégralité des scripts de départ, et je doute que beaucoup de gens ai se niveaux de connaissance.   :P
Je t' lily.

Regex / Les ravages de linux
CitationDites, dans un CV, faut mettre si on préfère vim ou emacs ?
Dis papa comment on fait les bébé
[/table

Citation de: mooglwy le 06 Janvier 2008 à 15:31
Tu as aussi la solution de passer a game maker, coté programmation tu pourras tous faire.  :)

Han la vilaine réponse facile mooglwy...

Citation de: mooglwy le 06 Janvier 2008 à 15:31
Mais de façon générale je ne suis pas fan des script.
Pour les utiliser correctement il faut connaitre et comprendre l'intégralité des scripts de départ, et je doute que beaucoup de gens ai se niveaux de connaissance.   :P

Non pas forcément...pour utiliser correctement un script il faut just connaitre convenablement les notions que l'on utilise dans ce script, c'est tout...c'est comme si je te disais "pour coder comme il faut en C, il faut connaitre le C par coeur"...bah non, pour coder un Hello World, pas besoin de toussa. Tu vois ce que je veux dire ?

Nan mais ce que je voulais dire, c'est surtout par rapport a ceux que retire un script ou un morceau teste si ou le modifie sans savoir a quoi ça sert c'est tout.  :)

Pis c'est pas pareil, c'est une architecture les scripts en question. Sans avoir la maitrise complète, une petite idée sur la globalité est un minimum dont on ne peut se passer pour tirer pleinement partie des scripts, après c'est sur compilation avec makefile et pointeur c'est pas super utile pour le hello world.  :P

Je pensais surtout au gens qui nous choppe un script je sais pas ou qui le colle et qui parle même pas le ruby, y a un minimum quand même les gars.  :)

Mais je vois ou tu veux en venir, on va dire que je n'était pas assez nuancer dans mes propos.  :P
Je t' lily.

Regex / Les ravages de linux
CitationDites, dans un CV, faut mettre si on préfère vim ou emacs ?
Dis papa comment on fait les bébé
[/table