Inscrit le: 18 Mar 2007, 01:00 Messages: 285 Points d'aide: 0/60
Créations :
Voir ses créations
|
Suite : - Code: Tout sélectionner
#-------------------------------------------------------------- # Sprite Character #-------------------------------------------------------------- class Sprite_Character < Sprite_Base alias vlad_abs_spchar_update update def initialize(viewport, character = nil) super(viewport) @character = character @balloon_duration = 0 @_damage_duration = 0 update end def update super if @_damage_duration > 0 @_damage_duration -=1 @_damage_sprite.x = self.x if @_damage_duration <= 0 dispose_damage end end if @character != nil and @character.damage != nil damage(@character.damage, @character.critical) @character.damage = nil @character.critical = false end vlad_abs_spchar_update end def damage(value, critical) dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Georgia" bitmap.font.size = 22 bitmap.font.italic = true if value.is_a?(Numeric) and value <= 0 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(1, 13, 160, 36, "Fallo", 1) bitmap.font.color.set(255, 245, 155) bitmap.draw_text(0, 12, 160, 36, "Fallo", 1) else bitmap.font.color.set(0, 0, 0) bitmap.draw_text(1, 13, 160, 36, damage_string, 1) bitmap.font.color.set(255, 255, 255) bitmap.draw_text(0, 12, 160, 36, damage_string, 1) end if critical bitmap.font.color.set(0, 0, 0) bitmap.draw_text(1, 6, 160, 20, "Crítico", 1) bitmap.font.color.set(255, 245, 155) bitmap.draw_text(0, 5, 160, 20, "Crítico", 1) end @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 - 40 @_damage_sprite.z += 99999 @_damage_duration = 30 end def show_text(string, size=16, color=0) dispose_damage damage_string = string if string.is_a?(Array) array = true else array = false end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Georgia" bitmap.font.size = size bitmap.font.italic = true if array for i in 0..string.size next if damage_string[i] == nil bitmap.font.color.set(96, 96-20, 0) if color == 0 bitmap.font.color.set(0, 0, 0) if color != 0 bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1) bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1) bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1) bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1) bitmap.font.color.set(255, 245, 155) if color == 0 bitmap.font.color.set(144, 199, 150) if color == 1 bitmap.font.color.set(197, 147, 190)if color == 2 bitmap.font.color.set(138, 204, 198)if color == 3 bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1) end else bitmap.font.color.set(96, 96-20, 0) if color == 0 bitmap.font.color.set(0, 0, 0) if color != 0 bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1) bitmap.font.color.set(255, 245, 155) if color == 0 bitmap.font.color.set(144, 199, 150) if color == 1 bitmap.font.color.set(197, 147, 190)if color == 2 bitmap.font.color.set(138, 204, 198)if color == 3 bitmap.draw_text(0, 12, 160, 36, damage_string, 1) end @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 @_damage_sprite.z = 3000 @_damage_duration = 30 end def dispose_damage if @_damage_sprite != nil @_damage_sprite.dispose @_damage_sprite = nil end end end #-------------------------------------------------------------- # Window Skill #-------------------------------------------------------------- class Scene_Skill alias vlad_abs_sskill_initialize initialize alias vlad_abs_sskill_update update def initialize(actor_index = 0, equip_index = 0) @memory = Window_Command.new(150, ["Memorize"]) @memory.active = false @memory.visible = false @memory.x = (544 - @memory.width) / 2 @memory.y = (416 - @memory.height) / 2 @memory.z = 1500 vlad_abs_sskill_initialize end def update update_skill @memory.update if @memory.active return update_memory if @memory.active vlad_abs_sskill_update end def update_skill for key in Skill_Button.keys if Input.trigger?(key) Sound.play_decision Skill_Button[key] = @skill_window.skill.id @memory.active = @memory.visible = true @skill_window.active = false end end end def update_memory if Input.trigger?(Input::C) Sound.play_decision @memory.active = @memory.visible = false @skill_window.active = true end end def Skill_Button return Skill_Button end end
#-------------------------------------------------------------- # FINISH #--------------------------------------------------------------
Ce script est additionnel, mais permet d'afficher sa barre de vie en haut à gauche de l'écran. - Code: Tout sélectionner
#============================================================================= # Window Hud # Traduit par nova pour RPG NATION # http://rpgnation.free.fr #=============================================================================
class Window_Hud < Window_Base def initialize super(0,0,128,96) self.opacity = 0 # self.visible = false refresh end def refresh self.contents.clear actor = $game_actors[1] draw_actor_hp(actor, 0, 0, 96) draw_actor_mp(actor, 0, 32, 96) end def update # self.visible = true if $game_switches[1] == true # 1=interrupeteur qui active ou désactive le HUD refresh end end
class Scene_Map alias hud_main main alias hud_update update alias hud_terminate terminate def main @hud = Window_Hud.new hud_main end def update @hud.update hud_update end def terminate @hud.dispose end end
Ensuite, créer un event en insérant le chara du monstre, et insérez 3 commentaires : Commentaires: Enemy 13 Commentaires: Die 1 Commentaires: Follow [optionnel] Le 1er Commentaire indique l'ID de l'ennemi dans la base de données du jeu. En l'occurence, il s'agit la du 13ème ennemi. Le 2ème indique la façon dont il meurt. Le n°1 fera disparaître l'ennemi après l'avoir tué. Le n°2, activera l'interupteur local. Le 3ème est optionnel. "Follow" indique que l'ennemi vous suivra. Pour attaquer, utiliser la touche A. Pour utiliser une capacité, utiliser la touche S. Et voici la démo française : http://www.box.net/shared/mt026zdgck
|
|