Cerca nel Forum
Showing results for tags 'Pop-Ups Battaglia'.
Trovato 1 risultato
-
Nome Script: Pop-Ups Battaglia Versione: N/D Autore/i: Jet Informazioni: Come si può vedere dallo screen, lo script aggiunge dei pop-ups quando si colpisce un mostro, si recuperano HP etc... Istruzioni: Inserite lo script sotto Material. Potete tradurre i testi cambiare il font modificando le righe in questione all'interno dello script. Script: #=============================================================================== # Battle Pop-Ups # By Jet10985 (Jet) #=============================================================================== # This script will create and show pop-ups for multiple battle events such as # hp/mp/tp loss and being inflicted with states. # This script has: 25 customization options. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Game_Actor: level_up, gain_exp # Game_Battler: add_state # Sprite_Battler: initialize, update, dispose, start_new_effect #=============================================================================== module Jet module BattlePopUps # This is the name of the font you want to use for pop-ups. POPUP_FONT = "Verdana" # The text and color shown when a character is knocked out (dies). KNOCKOUT_TEXT = "Knockout" KNOCKOUT_COLOR = Color.new(255, 167, 0) # The text and color shown when a character takes damage. # The actual damage is appended to the end. HURT_TEXT = "Damage +" HURT_COLOR = Color.new(255, 0, 0) HURT_TEXT_MP = "Mana -" HURT_COLOR_MP = Color.new(225, 30, 255) HURT_TEXT_TP = "TP -" HURT_COLOR_TP = Color.new(225, 30, 35) # The text and color shown when a character heals health. # The actual health is appended to the end. HEAL_TEXT = "Heal +" HEAL_COLOR = Color.new(0, 255, 0) HEAL_TEXT_MP = "Mana +" HEAL_COLOR_MP = Color.new(35, 200, 255) HEAL_TEXT_TP = "TP +" HEAL_COLOR_TP = Color.new(35, 35, 255) # The text and color shown when a character gains exp. # The actual exp is appended to the end. EXP_PLUS_TEXT = "EXP +" EXP_PLUS_COLOR = Color.new(167, 167, 0) # The text and color shown when an attack is critical. CRITICAL_TEXT = "Critical" CRITICAL_COLOR = Color.new(255, 106, 43) # The text and color shown when an attack misses. MISSED_TEXT = "Miss" MISS_COLOR = Color.new(45, 78, 99) # The text and color shown when an attack is evaded. EVADED_TEXT = "Evaded" EVADE_COLOR = Color.new(156, 187, 255) # The text, color, and animation shown when a character levels up. # For no animation, use 0. LEVEL_TEXT = "Level Up" LEVEL_COLOR = Color.new(167, 255, 52) # These are the colors used for displaying when a state is added. # It follows this format: state_id => Color.new(r, g, STATE_ADDED_COLORS = { 2 => Color.new(128, 0, 255), 3 => Color.new(128, 0, 255), 4 => Color.new(128, 0, 255) } # This is the default state added color. STATE_ADDED_COLORS.default = Color.new(128, 0, 255) end end #=============================================================================== # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO. #=============================================================================== ($imported ||= {})[:jet] ||= {} $imported[:jet][:BattlePopUps] = true class Game_Actor alias jet4921_level_up level_up def level_up(*args, &block) jet4921_level_up(*args, &block) unless self.exp >= next_level_exp and next_level_exp > 0 make_popup(Jet::BattlePopUps::LEVEL_TEXT, Jet::BattlePopUps::LEVEL_COLOR) end end alias jet1029_gain_exp gain_exp def gain_exp(exp) make_popup(Jet::BattlePopUps::EXP_PLUS_TEXT + exp.to_s, Jet::BattlePopUps::EXP_PLUS_COLOR) jet1029_gain_exp(exp) end end class Game_Battler alias jet8573_add_state add_state def add_state(sid) before = state?(sid) jet8573_add_state(sid) return if before == state?(sid) if sid == death_state_id make_popup(Jet::BattlePopUps::KNOCKOUT_TEXT, Jet::BattlePopUps::KNOCKOUT_COLOR) else make_popup("+#{$data_states[sid].name}", Jet::BattlePopUps::STATE_ADDED_COLORS[sid]) end end def make_popup(text, color) return unless SceneManager.scene_is?(Scene_Battle) f = self.battle_sprite; return if f.nil? f.popups.unshift(Sprite_JetPopup.new(text.to_s, color, f)) if !f.nil? end def battle_sprite return nil unless SceneManager.scene_is?(Scene_Battle) SceneManager.scene.spriteset.battler_sprites.each {|a| return a if a.battler == self } return nil end end class Scene_Battle attr_reader :spriteset end class Sprite_JetPopup < Sprite_Base def initialize(text, color, obj) super(nil) @text = text @color = color @character = obj self.visible = false @y_prog = 0 form_self end def form_self samp = Bitmap.new(1, 1) self.bitmap = Bitmap.new(samp.text_size(@text).width, 24) self.bitmap.font.color = @color self.bitmap.font.name = Jet::BattlePopUps::POPUP_FONT self.bitmap.draw_text(0, 0, self.bitmap.width, 24, @text) self.x = @character.x - (self.bitmap.width / 2) self.x += (@character.src_rect.width / 2) if @character.battler.actor? self.y = @character.battler.enemy? ? @character.y : (@character.y + @character.src_rect.height) self.y += @character.src_rect.height if @character.battler.actor? samp.dispose end def update super self.x = @character.x - (self.bitmap.width / 2) if $imported[:jet][:AnimatedBattlers] self.x += (@character.src_rect.width / 2) if @character.battler.actor? end self.y = @character.y - 16 - @y_prog if $imported[:jet][:AnimatedBattlers] self.y += @character.src_rect.height if @character.battler.actor? end @y_prog += 1 self.opacity -= 2.125 if self.opacity <= 0 self.dispose end end end class Sprite_Battler attr_accessor :popups alias jet4758_initialize initialize def initialize(*args, &block) @popups = [] @updating_sprites = [] @popup_wait = 0 jet4758_initialize(*args, &block) end alias jet7467_update update def update(*args, &block) jet7467_update(*args, &block) if @popup_wait == 0 if [email protected]? @updating_sprites.push(@popups.pop) @popup_wait = 30 end else @popup_wait -= 1 end @updating_sprites.each {|a| a.visible = true if !a.visible a.update @updating_sprites.delete(a) if a.disposed? } end alias jet5483_dispose dispose def dispose(*args, &block) (@updating_sprites + @popups).each {|a| a.dispose } jet5483_dispose(*args, &block) end alias jet3745_setup_new_effect setup_new_effect def setup_new_effect(*args, &block) jet3745_setup_new_effect(*args, &block) do_sprite_popups end def make_popup(text, color) @popups.unshift(Sprite_JetPopup.new(text.to_s, color, self)) end def do_sprite_popups return if @battler.nil? if @battler_struct.nil? @battler_struct = Struct.new(:hp, :mp, :tp).new(0, 0, 0) @battler_struct.hp = @battler.hp @battler_struct.mp = @battler.mp @battler_struct.tp = @battler.tp end check_success_popup check_hp_popup check_mp_popup check_tp_popup end def check_success_popup if @battler.result.success if @battler.result.critical make_popup(Jet::BattlePopUps::CRITICAL_TEXT, Jet::BattlePopUps::CRITICAL_COLOR) elsif @battler.result.missed make_popup(Jet::BattlePopUps::MISSED_TEXT, Jet::BattlePopUps::MISS_COLOR) elsif @battler.result.evaded make_popup(Jet::BattlePopUps::EVADED_TEXT, Jet::BattlePopUps::EVADE_COLOR) end @battler.result.clear_hit_flags end end def check_hp_popup if @battler_struct.hp != @battler.hp f = @battler_struct.hp - @battler.hp if f > 0 make_popup(Jet::BattlePopUps::HURT_TEXT + f.to_s, Jet::BattlePopUps::HURT_COLOR) elsif f < 0 make_popup(Jet::BattlePopUps::HEAL_TEXT + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR) end @battler_struct.hp = @battler.hp end end def check_mp_popup if @battler_struct.mp != @battler.mp f = @battler_struct.mp - @battler.mp if f > 0 make_popup(Jet::BattlePopUps::HURT_TEXT_MP + f.to_s, Jet::BattlePopUps::HURT_COLOR_MP) elsif f < 0 make_popup(Jet::BattlePopUps::HEAL_TEXT_MP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_MP) end @battler_struct.mp = @battler.mp end end def check_tp_popup if @battler_struct.tp != @battler.tp f = (@battler_struct.tp - @battler.tp).round if f > 0 make_popup(Jet::BattlePopUps::HURT_TEXT_TP + f.to_s, Jet::BattlePopUps::HURT_COLOR_TP) elsif f < 0 make_popup(Jet::BattlePopUps::HEAL_TEXT_TP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_TP) end @battler_struct.tp = @battler.tp end end end