- LunriMembre
- Nombre de messages : 675
Age : 33
Distinction : aucune
Date d'inscription : 31/07/2011
[Résolu]Demande modification script ACE "fenêtre d'action de combat"
Dim 20 Mai 2012 - 15:04
Bonjour,
Voila j’utilise le script d’HUD en combat de Moghunter ainsi que le script de Jet modifié par Efeberk pour que l’on voit les battlers en bas.
Je vous les mets avec les paramètres que j’utilise :
Voila j’utilise le script d’HUD en combat de Moghunter ainsi que le script de Jet modifié par Efeberk pour que l’on voit les battlers en bas.
Je vous les mets avec les paramètres que j’utilise :
- Code:
#==============================================================================
# +++ MOG - ADVANCED BATTLE HUD (v1.3) +++
#==============================================================================
# Par Moghunter Traduit par Nozvez
# http://www.atelier-rgss.com/
#==============================================================================
# Système de hud avancé de combat.
#==============================================================================
#==============================================================================
# ● Historique
#==============================================================================
# v 1.3 - Script 100% indépendant du AT System.
# - Correction de la position initiale de la fenêtre de fuite.
# - Correction de la position du curseur sur les alliés lorsque le face
# est désactivé
# v 1.2 - Correction de la priorité des états.
# v 1.1 - Correction du bug initial de la priorité du face.
# v 1.0 - Première version.
#==============================================================================
#==============================================================================
# ■ - FACE ANIME DES PERSONNAGES - (Optionnel)
#==============================================================================
# 1 - Enregistrer les images des faces des personnages dans le dossier :
#
# GRAPHICS/BATTLERS/
#
# 2 - Nommer les images avec le nom des personnages. (EX - Hector.png)
# 3 - La largeur de l'image devra être divisée par 5.
#
#==============================================================================
#==============================================================================
# ■ BATTLE HUD SETTING
#==============================================================================
module MOG_BATTLE_HUD
# Activer les faces des personnages, à désactiver en cas d'utilisation
# d'autres scripts qui utilisent des battlers dans son projet.
BATTLER_FACE_ENABLE = false
#Définition générale de la position du HUD.
HUD_POSITION = [160,325]
#Définition de la position du face
FACE_POSITION = [60,30]
#Définition de la position du nombre de HP.
HP_NUMBER_POSITION = [85,28]
#Définition de la position du mètre HP.
HP_METER_POSITION = [27,37]
#Définition de la position du nombre de MP.
MP_NUMBER_POSITION = [101,46]
#Définition de la position du mètre MP.
MP_METER_POSITION = [43,55]
#Définition de la position du nombre de TP.
# TP_NUMBER_POSITION = [85,64]
#Définition de la position du mètre TP.
# TP_METER_POSITION = [27,73]
#Définition de la position des états
STATES_POSITION = [5,1]
#Définition de la position des commandes de combat.
COMMAND_POSITION = [-140,-40]
#Définition de la position de l'espae du HUD entre les membres du groupe.
MEMBERS_SPACE = [120,0]
#Définition de la priorité du HUD.
BATTLE_HUD_Z = 50
#Définition de la vitesse de l'animation des mètres.
METER_FLOW_SPEED = 0
end
#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
#Définition de la position du curseur sur la cible.
CURSOR_POSITION = [-45, -16]
#Définition de la position du nom de la cible.
CURSOR_NAME_POSITION = [-10, 35]
#Activer l'effet glisse.
CURSOR_SLIDE_EFFECT = false
#Activer l'animation de lévitation.
CURSOR_FLOAT_EFFECT = true
end
if MOG_BATTLE_HUD::BATTLER_FACE_ENABLE #BATTLER_FACE SYSTEM START
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :battler_face
attr_accessor :screen_x
attr_accessor :screen_y
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize setup
def setup(actor_id)
mog_battle_hud_initialize(actor_id)
battler_sprite_setup
end
#--------------------------------------------------------------------------
# ● Battler Sprite Setup
#--------------------------------------------------------------------------
def battler_sprite_setup
@battler_face = [0,0,0]
@battler_name = @name
@screen_x = 0
@screen_y = 0
end
#--------------------------------------------------------------------------
# ● Use Sprite?
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# ● Screen Z
#--------------------------------------------------------------------------
def screen_z
return MOG_BATTLE_HUD::BATTLE_HUD_Z + 4
end
#------------------------------------------------------------------------
# ● Screen X
#------------------------------------------------------------------------
def screen_x
return FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
end
#------------------------------------------------------------------------
# ● Screen Y
#------------------------------------------------------------------------
def screen_y
return FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize(viewport, battler = nil)
battle_hud_setup
mog_battle_hud_initialize(viewport, battler)
end
#--------------------------------------------------------------------------
# ● Battle Hud Setup
#--------------------------------------------------------------------------
def battle_hud_setup
@old_face_index = 0
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_hud_dispose dispose
def dispose
mog_battle_hud_dispose
if @f_im != nil
@f_im.dispose
end
end
#--------------------------------------------------------------------------
# ● Update Bitmap
#--------------------------------------------------------------------------
alias mog_battle_hud_update_bitmap update_bitmap
def update_bitmap
if @battler.is_a?(Game_Actor)
create_actor_battler
update_actor_battler
return
end
mog_battle_hud_update_bitmap
end
#--------------------------------------------------------------------------
# ● Create Actor Battler
#--------------------------------------------------------------------------
def create_actor_battler
return if self.bitmap != nil
@f_im = Cache.battler(@battler.battler_name, 0)
@f_cw = @f_im.width / 5
@f_ch = @f_im.height
self.bitmap = Bitmap.new(@f_cw,@f_ch)
x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
@org_pos = [x,y]
@battler.battler_face = [0,0,0]
@battler_visible = true
@low_hp = @battler.mhp * 30 / 100
self.z = @battler.screen_z + 100
make_face(true)
end
#--------------------------------------------------------------------------
# ● Face Base Setting
#--------------------------------------------------------------------------
def face_base_setting
self.x = @org_pos[0]
self.y = @org_pos[1]
self.z = @battler.screen_z
self.zoom_x = 1
self.zoom_y = 1
self.mirror = false
end
#--------------------------------------------------------------------------
# ● Check Base Face
#--------------------------------------------------------------------------
def check_base_face(reset)
face_base_setting
return if @battler.battler_face[2] > 0
@battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2
@battler.battler_face[0] = 3 if @battler.hp < @low_hp
@battler.battler_face[0] = 4 if @battler.hp == 0
end
#--------------------------------------------------------------------------
# ● Make Face
#--------------------------------------------------------------------------
def make_face(reset = false)
self.bitmap.clear
check_base_face(reset)
src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
self.bitmap.blt(0,0, @f_im, src_rect_back)
@old_face_index = @battler.battler_face[0]
end
#--------------------------------------------------------------------------
# ● Update Actor Battler
#--------------------------------------------------------------------------
def update_actor_battler
return if self.bitmap == nil
update_face_effect
update_face_reset_time
update_face_z
make_face if @old_face_index != @battler.battler_face[0]
end
#--------------------------------------------------------------------------
# ● Update Face Z
#--------------------------------------------------------------------------
def update_face_z
self.z = @battler.screen_z + BATTLE_HUD_Z rescue 100
end
#--------------------------------------------------------------------------
# ● Update Face Reset Time
#--------------------------------------------------------------------------
def update_face_reset_time
return if @battler.battler_face[2] == 0
@battler.battler_face[2] -= 1
if @battler.battler_face[2] == 0 or
(@battler.hp < @low_hp and @battler.battler_face[0] == 0)
make_face(true)
end
end
#--------------------------------------------------------------------------
# ● Update Face Effect
#--------------------------------------------------------------------------
def update_face_effect
return if @battler.battler_face[2] == 0
case @battler.battler_face[1]
when 0
face_damage
when 1..2
face_heal
when 3
face_action
end
end
#--------------------------------------------------------------------------
# ● Face Damage
#--------------------------------------------------------------------------
def face_damage
self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
end
#--------------------------------------------------------------------------
# ● Face Heal
#--------------------------------------------------------------------------
def face_heal
case @battler.battler_face[2]
when 20..40
self.zoom_x += 0.01
self.zoom_y = self.zoom_x
when 0..20
self.zoom_x -= 0.01
self.zoom_y = self.zoom_x
end
end
#--------------------------------------------------------------------------
# ● Face Action
#--------------------------------------------------------------------------
def face_action
case @battler.battler_face[2]
when 25..50
self.zoom_x += 0.01
self.zoom_y = self.zoom_x
self.mirror = true
when 0..25
self.zoom_x -= 0.01
self.zoom_y = self.zoom_x
self.mirror = false
end
self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
alias mog_battle_hud_update_position update_position
def update_position
return if @battle.is_a?(Game_Actor)
mog_battle_hud_update_position
end
#--------------------------------------------------------------------------
# ● Update Collapse
#--------------------------------------------------------------------------
alias mog_battle_hud_update_collapse update_collapse
def update_collapse
return if @battler.is_a?(Game_Actor)
mog_battle_hud_update_collapse
end
#--------------------------------------------------------------------------
# ● Update Instant Collapse
#--------------------------------------------------------------------------
alias mog_battle_hud_update_instant_collapse update_instant_collapse
def update_instant_collapse
return if @battler.is_a?(Game_Actor)
mog_battle_hud_update_instant_collapse
end
end
#==============================================================================
# ■ Battle Manager
#==============================================================================
class << BattleManager
#--------------------------------------------------------------------------
# ● Battle End
#--------------------------------------------------------------------------
alias mog_battle_hud_battle_process_victory process_victory
def process_victory
execute_face_effect
mog_battle_hud_battle_process_victory
end
#--------------------------------------------------------------------------
# ● Prepare
#--------------------------------------------------------------------------
def execute_face_effect
for i in $game_party.members
if i.hp > 0
i.battler_face = [1,2,40]
end
end
end
end
#==============================================================================
# ■ Game Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● Prepare
#--------------------------------------------------------------------------
alias mog_battle_hud_prepare prepare
def prepare
mog_battle_hud_prepare
make_face_action
end
#--------------------------------------------------------------------------
# ● Make Face Action
#--------------------------------------------------------------------------
def make_face_action
return if !subject.is_a?(Game_Actor)
return if @item.object == nil
subject.battler_face = [2,3,50]
end
end
#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● Item Apply
#--------------------------------------------------------------------------
alias mog_battle_hud_item_apply item_apply
def item_apply(user, item)
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_item_apply(user, item)
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Check Face Effect
#--------------------------------------------------------------------------
def check_face_effect(old_hp,old_mp)
if self.hp > old_hp or self.mp > old_mp
self.battler_face = [1,1,40]
elsif self.hp < old_hp
self.battler_face = [3,0,40]
end
end
#--------------------------------------------------------------------------
# ● Added New State
#--------------------------------------------------------------------------
alias mog_battle_hud_add_new_state add_new_state
def add_new_state(state_id)
mog_battle_hud_add_new_state(state_id)
if self.is_a?(Game_Actor)
self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
end
end
#--------------------------------------------------------------------------
# ● Regenerate HP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_hp regenerate_hp
def regenerate_hp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_hp
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Regenerate MP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_mp regenerate_mp
def regenerate_mp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_mp
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Can Check Face Effect
#--------------------------------------------------------------------------
def can_check_face_effect?(old_hp,old_mp)
return false if self.is_a?(Game_Enemy)
return true if old_hp != self.hp
return true if old_mp != self.mp
return false
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Invoke Counter Attack
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
def invoke_counter_attack(target, item)
mog_battle_hud_invoke_counter_attack(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
#--------------------------------------------------------------------------
# ● Invoke Magic Reflection
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
def invoke_magic_reflection(target, item)
mog_battle_hud_invoke_magic_reflection(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
end
end #BATTLER FACE SYSTEM END --------------------------------------------------
#==============================================================================
# ■ Battle_Hud
#==============================================================================
class Battle_Hud
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor,image)
@actor = actor
@x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
@y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
pre_cache(image)
create_layout
create_hp_number
create_hp_meter
create_mp_number
create_mp_meter
# create_tp_number
# create_tp_meter
create_states
end
#--------------------------------------------------------------------------
# ● Pre Cache
#--------------------------------------------------------------------------
def pre_cache(image)
@number = image[0]
@number_cw = @number.width / 10
@number_ch = @number.height / 4
@meter = image[1]
@meter_cw = @meter.width / 3
@meter_ch = @meter.height / 3
@icon = image[2]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = Cache.system("Battle_Hud_Layout")
@layout.z = BATTLE_HUD_Z
@layout.x = @x
@layout.y = @y
end
#--------------------------------------------------------------------------
# ● Create HP Number
#--------------------------------------------------------------------------
def create_hp_number
@hp = @actor.hp
@hp_old = @actor.hp
@hp_ref = @hp_old
@hp_refresh = false
@hp_number = Sprite.new
@hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@hp_number.z = BATTLE_HUD_Z + 51
@hp_number.x = @x + HP_NUMBER_POSITION[0]
@hp_number.y = @y + HP_NUMBER_POSITION[1]
refresh_hp_number
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@hp_meter.z = BATTLE_HUD_Z + 50
@hp_meter.x = @x + HP_METER_POSITION[0]
@hp_meter.y = @y + HP_METER_POSITION[1]
@hp_flow = rand(@meter_cw * 2)
@hp_width_old = @meter_cw * @actor.hp / @actor.mhp
hp_flow_update
end
#--------------------------------------------------------------------------
# ● Hp Flow Update
#--------------------------------------------------------------------------
def hp_flow_update
@hp_meter.bitmap.clear
hp_width = @meter_cw * @actor.hp / @actor.mhp
#execute_damage_flow(hp_width)
hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
@hp_flow += METER_FLOW_SPEED
@hp_flow = 0 if @hp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Execute Damage Flow
#--------------------------------------------------------------------------
def execute_damage_flow(hp_width)
n = (@hp_width_old - hp_width).abs * 3 / 100
damage_flow = [[n, 2].min,0.5].max
@hp_width_old -= damage_flow
@hp_width_old = hp_width if @hp_width_old < hp_width
src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, src_rect_old)
end
#--------------------------------------------------------------------------
# ● Update HP Number
#--------------------------------------------------------------------------
def update_hp_number
@hp_refresh = true
n = 2 * (@actor.hp - @hp_old).abs / 100
hp_ref = [[n, 100].min,1].max
if @hp_old < @actor.hp
@hp += hp_ref
if @hp >= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
elsif @hp_old > @actor.hp
@hp -= hp_ref
if @hp <= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh HP Number
#--------------------------------------------------------------------------
def refresh_hp_number
@hp_number.bitmap.clear
number_value = @hp.abs.to_s.split(//)
hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
@hp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@hp_refresh = false if @hp == @actor.hp
end
#--------------------------------------------------------------------------
# ● Create MP Number
#--------------------------------------------------------------------------
def create_mp_number
@mp = @actor.mp
@mp_old = @actor.mp
@mp_ref = @mp_old
@mp_refresh = false
@mp_number = Sprite.new
@mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@mp_number.z = BATTLE_HUD_Z + 51
@mp_number.x = @x + MP_NUMBER_POSITION[0]
@mp_number.y = @y + MP_NUMBER_POSITION[1]
refresh_mp_number
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@mp_meter.z = BATTLE_HUD_Z + 50
@mp_meter.x = @x + MP_METER_POSITION[0]
@mp_meter.y = @y + MP_METER_POSITION[1]
@mp_flow = rand(@meter_cw * 2)
@mp_width_old = @meter_cw * @actor.mp / @actor.mmp
mp_flow_update
end
#--------------------------------------------------------------------------
# ● Mp Flow Update
#--------------------------------------------------------------------------
def mp_flow_update
@mp_meter.bitmap.clear
mp_width = @meter_cw * @actor.mp / @actor.mmp
src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
@mp_meter.bitmap.blt(0,0, @meter, src_rect)
@mp_flow += METER_FLOW_SPEED
@mp_flow = 0 if @mp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Update MP Number
#--------------------------------------------------------------------------
def update_mp_number
@mp_refresh = true
n = 2 * (@actor.mp - @mp_old).abs / 100
mp_ref = [[n, 100].min,1].max
if @mp_old < @actor.mp
@mp += mp_ref
if @mp >= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
elsif @mp_old > @actor.mp
@mp -= mp_ref
if @mp <= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh MP Number
#--------------------------------------------------------------------------
def refresh_mp_number
@mp_number.bitmap.clear
number_value = @mp.abs.to_s.split(//)
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
@mp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@mp_refresh = false if @mp == @actor.mp
end
#--------------------------------------------------------------------------
# ● Create TP Number
#--------------------------------------------------------------------------
# def create_tp_number
# @tp = @actor.tp
# @tp_old = @actor.tp
# @tp_ref = @tp_old
# @tp_refresh = false
# @tp_number = Sprite.new
# @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
# @tp_number.z = BATTLE_HUD_Z + 51
# @tp_number.x = @x + TP_NUMBER_POSITION[0]
# @tp_number.y = @y + TP_NUMBER_POSITION[1]
# refresh_tp_number
# end
#--------------------------------------------------------------------------
# ● Create TP Meter
#--------------------------------------------------------------------------
# def create_tp_meter
# @tp_meter = Sprite.new
# @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
# @tp_meter.z = BATTLE_HUD_Z + 50
# @tp_meter.x = @x + TP_METER_POSITION[0]
# @tp_meter.y = @y + TP_METER_POSITION[1]
# @tp_flow = rand(@meter_cw * 2)
# @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp
# tp_flow_update
# end
#--------------------------------------------------------------------------
# ● TP Flow Update
#--------------------------------------------------------------------------
# def tp_flow_update
# @tp_meter.bitmap.clear
# tp_width = @meter_cw * @actor.tp / @actor.max_tp
# src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
# @tp_meter.bitmap.blt(0,0, @meter, src_rect)
# @tp_flow += METER_FLOW_SPEED
# @tp_flow = 0 if @tp_flow >= @meter_cw * 2
# end
#--------------------------------------------------------------------------
# ● Update TP Number
#--------------------------------------------------------------------------
# def update_tp_number
# @tp_refresh = true
# n = 2 * (@actor.tp - @tp_old).abs / 100
# tp_ref = [[n, 100].min,1].max
# if @tp_old < @actor.tp
# @tp += tp_ref
# if @tp >= @actor.tp
# @tp_old = @actor.tp
# @tp = @actor.tp
# @tp_ref = 0
# end
# elsif @tp_old > @actor.tp
# @tp -= tp_ref
# if @tp <= @actor.tp
# @tp_old = @actor.tp
# @tp = @actor.tp
# @tp_ref = 0
# end
# end
# end
#--------------------------------------------------------------------------
# ● Refresh TP Number
#--------------------------------------------------------------------------
#def refresh_tp_number
# @tp_number.bitmap.clear
# number_value = @tp.truncate.to_s.split(//)
# center_x = 0
# for r in 0..number_value.size - 1
# number_value_abs = number_value[r].to_i
# src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
# @tp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
# center_x += 1
# end
# @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
# @tp_refresh = false if @tp == @actor.tp
# end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
refresh_states
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@status.x = @x + STATES_POSITION[0]
@status.y = @y + STATES_POSITION[1]
@status_flow = -24
@states_speed = 50
@status.z = BATTLE_HUD_Z + 51
@old_states = @actor.states
flow_states
end
#--------------------------------------------------------------------------
# ● Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor.states.size == 0 and !@status.visible
@states_speed = 0
@status.bitmap.clear
src_rect = Rect.new(@status_flow,0, 24,24)
@status.bitmap.blt(0,0, @actor_status, src_rect)
@status.visible = @actor.states.size == 0 ? false : true
@status_flow += 1
@status_flow = -24 if @status_flow >= @states_size - 24
end
#--------------------------------------------------------------------------
# ● Refresh States
#--------------------------------------------------------------------------
def refresh_states
@old_states = @actor.states
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
@states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(48 * index , 0, @icon, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
@meter.dispose
@number.dispose
@icon.dispose
@layout.bitmap.dispose
@layout.dispose
@hp_number.bitmap.dispose
@hp_number.dispose
@hp_meter.bitmap.dispose
@hp_meter.dispose
@mp_number.bitmap.dispose
@mp_number.dispose
@mp_meter.bitmap.dispose
@mp_meter.dispose
# @tp_number.bitmap.dispose
# @tp_number.dispose
# @tp_meter.bitmap.dispose
# @tp_meter.dispose
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_hp_number if @hp_old != @actor.hp
refresh_hp_number if @hp_refresh
update_mp_number if @mp_old != @actor.mp
refresh_mp_number if @mp_refresh
# update_tp_number if @tp_old != @actor.tp
# refresh_tp_number if @tp_refresh
refresh_states if @old_states != @actor.states
hp_flow_update
# tp_flow_update
mp_flow_update
flow_states
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
create_battle_hud
end
#--------------------------------------------------------------------------
# ● Create Battle Hud
#--------------------------------------------------------------------------
def create_battle_hud
i1 = Cache.system("Battle_Hud_Number")
i2 = Cache.system("Battle_Hud_Meter")
i3 = Cache.system("Iconset")
@hud_images = []
@hud_images.push(i1,i2,i3)
@battle_hud = []
for i in $game_party.members
@battle_hud.push(Battle_Hud.new(i,@hud_images))
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_hud_dispose dispose
def dispose
mog_battle_hud_dispose
dispose_battle_hud
end
#--------------------------------------------------------------------------
# ● Dispose Battle Hud
#--------------------------------------------------------------------------
def dispose_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.dispose }
@battle_hud.clear
@hud_images.each {|sprite| sprite.dispose }
@hud_images.clear
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update update
def update
mog_battle_hud_update
update_battle_hud
end
#--------------------------------------------------------------------------
# ● Update Battle Hud
#--------------------------------------------------------------------------
def update_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.update }
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
include MOG_BATTLE_HUD
attr_accessor :hud_x
attr_accessor :hud_y
#--------------------------------------------------------------------------
# ● HUD X
#--------------------------------------------------------------------------
def hud_x
return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
end
#--------------------------------------------------------------------------
# ● HUD Y
#--------------------------------------------------------------------------
def hud_y
return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Create Party Command Window
#--------------------------------------------------------------------------
alias mog_battle_hud_create_party_command_window create_party_command_window
def create_party_command_window
mog_battle_hud_create_party_command_window
set_party_window_position
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
def set_party_window_position
@party_command_window.viewport = nil
return if $mog_rgss3_at_system != nil
a_index = []
for actor in $game_party.alive_members
a_index = [actor.hud_x, actor.hud_y]
break
end
return if a_index.empty?
@party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
@party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
alias mog_battle_hud_start_party_command_selection start_party_command_selection
def start_party_command_selection
set_party_window_position
mog_battle_hud_start_party_command_selection
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update_basic update_basic
def update_basic
mog_battle_hud_update_basic
update_command_window_visible
end
#--------------------------------------------------------------------------
# ● Update Command Window Visible
#--------------------------------------------------------------------------
def update_command_window_visible
@status_window.visible = @status_window.active ? true : false
@actor_command_window.visible = @actor_command_window.active ? true : false
@skill_window.visible = @skill_window.active ? true : false
@item_window.visible = @item_window.active ? true : false
end
#--------------------------------------------------------------------------
# ● Start Actor Command Selection
#--------------------------------------------------------------------------
alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
def start_actor_command_selection
mog_battle_hud_start_actor_command_selection
@actor_command_window.viewport = nil
@actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
@actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
@party_command_window.x = @actor_command_window.x
@party_command_window.y = @actor_command_window.y
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :battle_cursor
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
@battle_cursor = [0,0,true,""]
mog_battle_cursor_initialize
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
mog_battle_cursor_initialize
create_cursor
end
#--------------------------------------------------------------------------
# ● Create_Cursor
#--------------------------------------------------------------------------
def create_cursor
@cursor = Sprite.new
@cursor.bitmap = Cache.system("Battle_Cursor")
@cursor.z = 999
@cursor.visible = false
@cursor_new_x = -64
@cursor_new_y = -64
@cursor_float_y = 0
@cursor_float_duration = 0
@c_real_y = 0
@cursor_name = Sprite.new
@cursor_name.bitmap = Bitmap.new(120,32)
@cursor_name.z = @cursor.z + 1
@cursor_name.bitmap.font.size = 16
refresh_cursor_name
update_cursor_name
$game_temp.battle_cursor = [@cursor_new_x,@cursor_new_y,false]
end
#--------------------------------------------------------------------------
# ● Refresh Cursor Name
#--------------------------------------------------------------------------
def refresh_cursor_name
return if !(@cursor.x == $game_temp.battle_cursor[0] and
@cursor.y == @c_real_y)
@cursor_name_enemy = $game_temp.battle_cursor[3]
@cursor_name.bitmap.clear
@cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_cursor_dispose dispose
def dispose
mog_battle_cursor_dispose
dispose_cursor
end
#--------------------------------------------------------------------------
# ● Dispose Cursor
#--------------------------------------------------------------------------
def dispose_cursor
@cursor.bitmap.dispose
@cursor.dispose
@cursor_name.bitmap.dispose
@cursor_name.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_cursor_update update
def update
mog_battle_cursor_update
update_battle_cursor
end
#--------------------------------------------------------------------------
# ● Update Battle Cursor
#--------------------------------------------------------------------------
def update_battle_cursor
return if @cursor == nil
@cursor.visible = $game_temp.battle_cursor[2]
update_cursor_name
if !@cursor.visible
@cursor.x = -64
@cursor.y = -64
@cursor.opacity = 0
update_cursor_name
return
end
@cursor.opacity += 15
update_cursor_float_effect
if CURSOR_SLIDE_EFFECT
update_cursor_slide_effect
else
@cursor.x = $game_temp.battle_cursor[0]
@cursor.y = $game_temp.battle_cursor[1]
end
end
#--------------------------------------------------------------------------
# ● Update Cursor Name
#--------------------------------------------------------------------------
def update_cursor_name
refresh_cursor_name if @cursor_name_enemy != $game_temp.battle_cursor[3]
@cursor_name.x = @cursor.x + CURSOR_NAME_POSITION[0]
@cursor_name.y = @cursor.y + CURSOR_NAME_POSITION[1]
@cursor_name.opacity = @cursor.opacity
@cursor_name.visible = @cursor.visible
end
#--------------------------------------------------------------------------
# ● Update Cursor Slide Effect
#--------------------------------------------------------------------------
def update_cursor_slide_effect
@cursor_new_x = $game_temp.battle_cursor[0]
@cursor_new_y = $game_temp.battle_cursor[1]
@cs_x = 5 + ((@cursor.x - @cursor_new_x).abs / 5)
@cs_y = 5 + ((@cursor.y - @cursor_new_y).abs / 5)
if @cursor.x > @cursor_new_x
@cursor.x -= @cs_x
@cursor.x = @cursor_new_x if @cursor.x < @cursor_new_x
elsif @cursor.x < @cursor_new_x
@cursor.x += @cs_x
@cursor.x = @cursor_new_x if @cursor.x > @cursor_new_x
end
@c_real_y = @cursor_new_y + @cursor_float_y
if @cursor.y > @cursor_new_y
@cursor.y -= @cs_y
@cursor.y = @c_real_y if @cursor.y < @c_real_y
elsif @cursor.y < @c_real_y
@cursor.y += @cs_y
@cursor.y = @c_real_y if @cursor.y > @c_real_y
end
end
#--------------------------------------------------------------------------
# ● Update Cursor Float Effect
#--------------------------------------------------------------------------
def update_cursor_float_effect
return if !CURSOR_FLOAT_EFFECT
@cursor_float_duration += 1
case @cursor_float_duration
when 0..20
@cursor_float_y += 1
when 21..40
@cursor_float_y -= 1
else
@cursor_float_y = 0
@cursor_float_duration = 0
end
end
end
#==============================================================================
# ■ Window BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
self.visible = false
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
alias mog_battle_hud_refresh refresh
def refresh
return
mog_battle_hud_refresh
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Create Enemy Window
#--------------------------------------------------------------------------
def create_enemy_window
@enemy_window = Window_BattleEnemy_Cursor.new
@enemy_window.set_handler(:ok, method(:on_enemy_ok))
@enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
end
#--------------------------------------------------------------------------
# ● Create Actor Window
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Window_BattleActor_Cursor.new
@actor_window.set_handler(:ok, method(:on_actor_ok))
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
end
end
#==============================================================================
# ■ Window Selectable Battle_Cursor
#==============================================================================
class Window_Selectable_Battle_Cursor < Window_Base
attr_reader :index
#--------------------------------------------------------------------------
# ● Initialize
#-------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@index = -1
@handler = {}
deactivate
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
return 0
end
#--------------------------------------------------------------------------
# ● Active
#--------------------------------------------------------------------------
def active=(active)
super
end
#--------------------------------------------------------------------------
# ● Index
#--------------------------------------------------------------------------
def index=(index)
@index = index
end
#--------------------------------------------------------------------------
# ● Set Handler
#--------------------------------------------------------------------------
def set_handler(symbol, method)
@handler[symbol] = method
end
#--------------------------------------------------------------------------
# ● Handle?
#--------------------------------------------------------------------------
def handle?(symbol)
@handler.include?(symbol)
end
#--------------------------------------------------------------------------
# ● Call Handler
#--------------------------------------------------------------------------
def call_handler(symbol)
@handler[symbol].call if handle?(symbol)
end
#--------------------------------------------------------------------------
# ● Cursor Movable
#--------------------------------------------------------------------------
def cursor_movable?
active && open? && !@cursor_fix && !@cursor_all && item_max > 0
end
#--------------------------------------------------------------------------
# ● Cursor Down
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
self.index += 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor Right
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
self.index += 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor UP
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
self.index -= 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor Left
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
self.index -= 1
check_index_limit(self.index)
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
process_cursor_move
process_handling
end
#--------------------------------------------------------------------------
# ● Process Cursor Move
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
if @index != last_index
Sound.play_cursor
set_cursor_position(@index)
end
end
#--------------------------------------------------------------------------
# ● Process Handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_ok if ok_enabled? && Input.trigger?(:C)
return process_cancel if cancel_enabled? && Input.trigger?(:B)
end
#--------------------------------------------------------------------------
# ● OK Enabled
#--------------------------------------------------------------------------
def ok_enabled?
handle?(:ok)
end
#--------------------------------------------------------------------------
# ● Cancel Enabled
#--------------------------------------------------------------------------
def cancel_enabled?
handle?(:cancel)
end
#--------------------------------------------------------------------------
# ● Process OK
#--------------------------------------------------------------------------
def process_ok
if current_item_enabled?
Sound.play_ok
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● Call OK Handler
#--------------------------------------------------------------------------
def call_ok_handler
call_handler(:ok)
end
#--------------------------------------------------------------------------
# ● Process Cancel
#--------------------------------------------------------------------------
def process_cancel
Sound.play_cancel
Input.update
deactivate
call_cancel_handler
end
#--------------------------------------------------------------------------
# ● Call Cancel Handler
#--------------------------------------------------------------------------
def call_cancel_handler
call_handler(:cancel)
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
end
#--------------------------------------------------------------------------
# ● Current Item Enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
end
#--------------------------------------------------------------------------
# ● Show
#--------------------------------------------------------------------------
def show
set_cursor_position(self.index)
$game_temp.battle_cursor[2] = true
super
end
#--------------------------------------------------------------------------
# ● Hide
#--------------------------------------------------------------------------
def hide
$game_temp.battle_cursor[2] = false
super
end
#--------------------------------------------------------------------------
# ● Check Index Limit
#--------------------------------------------------------------------------
def check_index_limit(index = self.index)
self.index = index
self.index = 0 if self.index >= item_max
self.index = (item_max - 1) if self.index < 0
end
end
#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy_Cursor < Window_Selectable_Battle_Cursor
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
super(-32, -32, 32, 32)
self.index = 0
self.visible = false
set_cursor_position(self.index)
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_troop.alive_members.size
end
#--------------------------------------------------------------------------
# ● Enemy
#--------------------------------------------------------------------------
def enemy
$game_troop.alive_members[self.index]
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
check_index_limit(index)
return if $game_troop.alive_members[self.index] == nil
$game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0]
$game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1]
$game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name
end
end
#==============================================================================
# ■ Window_BattleActor Cursor
#==============================================================================
class Window_BattleActor_Cursor < Window_Selectable_Battle_Cursor
include MOG_BATTLE_CURSOR
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
super(-32, -32, 32, 32)
self.index = 0
self.visible = true
set_cursor_position(self.index)
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
check_index_limit(index)
return if $game_party.members[self.index] == nil
screen_x = $game_party.members[self.index].screen_x rescue nil
screen_y = $game_party.members[self.index].screen_y rescue nil
if screen_x == nil or screen_y == nil
screen_x = $game_party.members[self.index].hud_x + (HP_NUMBER_POSITION[0] / 3) + 32
screen_y = $game_party.members[self.index].hud_y + (HP_NUMBER_POSITION[1] / 2) + 32
end
$game_temp.battle_cursor[0] = screen_x + CURSOR_POSITION[0]
$game_temp.battle_cursor[1] = screen_y + CURSOR_POSITION[1]
$game_temp.battle_cursor[3] = $game_party.members[self.index].name
end
end
$mog_rgss3_battle_hud = true
- LunriMembre
- Nombre de messages : 675
Age : 33
Distinction : aucune
Date d'inscription : 31/07/2011
Re: [Résolu]Demande modification script ACE "fenêtre d'action de combat"
Dim 20 Mai 2012 - 15:06
Message trop long x)
Mon problème vient du script de Moghunter. La position de la fenêtre des choix d’actions s’adapte en fonction du battler qu’elle concerne. Et avec les réglages disponibles je n’arrive pas à faire ce que je veux.
Explications en images c’est plus simple.
Pour les choix du premier battler elle est bien placée :
Par contre pour le 2eme ca ne va pas :
Du coup je voudrais savoir s’il était possible qu’elle reste toujours au même endroit, à savoir celui sur la première image. Ou 2 eme solution (celle qui me conviendrait le mieux) qu’elle se place comme ça :
(Je n'utiliserais jamais plus de 2 héros en combat)
Voila je vous remercie d'avance pour votre aide !
- Code:
#===============================================================================
# Behind-View Battle System
# By Jet and efeberk
#===============================================================================
# This script will allow you to have battle where all the actor's sprites are
# display on the behind of the characters.
# This script has: 10 customization options.
#===============================================================================
# Overwritten Methods:
# Scene_Battle: show_attack_animation
# Spriteset_Battle: update_actors
#-------------------------------------------------------------------------------
# Aliased methods:
# Spriteset_Battle: create_actors, create_enemies
# Sprite_Character: initialize, update, dispose, start_new_effect
# Scene_Battle: use_item, next_command, prior_command
# Game_Character: screen_x, screen_y
#===============================================================================
module Jet
module Sideview
#===========================================================================
# ENEMY OPTIONS
#===========================================================================
# These are the attack animations for enemies when they use a regular attack.
# It follows this format: enemy_id => animation_id
ENEMY_ATK_ANIMS = {
}
# This is the default enemy attack animation, used when they do not have a
# specific attack animation above.
ENEMY_ATK_ANIMS.default = 1
# This is a list of enemies whose portraits should be flipped in battle.
FLIPPED_ENEMIES = [2, 3, 4, 5, 8, 10, 12, 13, 14, 16, 17, 18, 19]
#===========================================================================
# ACTOR OPTIONS
#===========================================================================
# Should the player sprite have a shadow beneath them?
PLAYER_SHADOW = true
# These are sprite changes depending on state infliction.
# It follows this format: state_id => "sprite_appention"
# This means if the state is inflicted, the sprite will look for a graphic
# that is the same name as the character's sprite, plus the appended option.
# EX: Ralph's sprite's name is $ralph. Ralph gets knocked-out. This means
# state 1 was inflicted, and my below config for 1 was: 1 => "_dead"
# Now, his shown sprite will be $ralph_dead. If the sprite does not exist,
# no change will be made.
# The sprite index will be the same as the actor's.
STATE_SPRITES = {
1 => "_dead",
2 => "_poison",
3 => "_blind"
}
#===========================================================================
# GENERAL_OPTIONS
#===========================================================================
# This is the animation displayed when a skill is about to be used.
SKILL_ANIMATION = 43
# This is the animation displayed when an item is about to be used.
ITEM_ANIMATION = 43
# These are the animations played when a state is inflicted.
# It follows this format: state_id => animation_id
STATE_ANIMATIONS = {
1 => 56,
2 => 50,
3 => 51
}
#===========================================================================
# FIELD OPTIONS
#===========================================================================
# This is where the line-up begins. [x, y]. The higher the x, the further
# right and the higher the y the further down.
FIELD_POS = [220, 340]
# This is how far down, and to the right each player is from the previous
# actor. [x, y]. Same rules as above.
FIELD_SPACING = [125, 0]
end
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
($imported ||= {})[:jet] ||= {}
$imported[:jet][:Sideview] = true
class Game_Character
attr_accessor :step_anime
%w[screen_x screen_y].each {|a|
aStr = %Q{
alias jet6372_#{a} #{a}
def #{a}(*args, &block)
$BTEST ? 0 : jet6372_#{a}(*args, &block)
end
}
module_eval(aStr)
}
end
class Game_Actor
def animation_id=(t)
self.battle_sprite.start_animation($data_animations[t]) rescue nil
end
end
class Game_Battler
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 Spriteset_Battle
alias jet2847_create_enemies create_enemies
def create_enemies(*args, &block)
jet2847_create_enemies(*args, &block)
@enemy_sprites.each {|a|
a.mirror = Jet::Sideview::FLIPPED_ENEMIES.include?(a.battler.enemy.id)
}
end
alias jet3835_create_actors create_actors
def create_actors(*args, &block)
jet3835_create_actors(*args, &block)
@jet_party = $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
$game_party.members.each {|a|
f = Game_Character.new
f.set_graphic(a.character_name, a.character_index)
f.step_anime = true
f.set_direction(8)
n = Sprite_Character.new(@viewport1, f)
n.jet_x = Jet::Sideview::FIELD_POS[0] + a.index * Jet::Sideview::FIELD_SPACING[0]
n.jet_y = Jet::Sideview::FIELD_POS[1] + a.index * Jet::Sideview::FIELD_SPACING[1]
n.battler = a
n.battle_sprite = true
if Jet::Sideview::PLAYER_SHADOW
v = Sprite.new(nil)
v.bitmap = Cache.system("Shadow")
n.shadow_sprite = v
end
@actor_sprites.push(n)
}
end
def update_actors
if @jet_party != $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
create_actors
end
@actor_sprites.each {|a| a.update }
end
end
class Sprite_Character
attr_accessor :battle_sprite, :jet_x, :jet_y, :shadow_sprite, :battler
alias jet4646_initialize initialize
def initialize(*args, &block)
@battle_sprite = false
jet4646_initialize(*args, &block)
end
alias jet3645_update update
def update(*args, &block)
jet3645_update(*args, &block)
if @battle_sprite
@character.step_anime = !@battler.dead?
@character.update
self.x = @jet_x
self.y = @jet_y
if !@battler.nil?
f = @battler.states.dup
f.sort! {|a, b|
a.priority <=> b.priority
}.reverse!
for i in 0...f.size
a = Jet::Sideview::STATE_SPRITES[f[i].id]
next if a.nil?
b = (Cache.character(@character.character_name + a) rescue false)
next unless b
index = @character.character_index
@character.set_graphic(@character.character_name + a, index)
break
end
end
if !@shadow_sprite.nil?
@shadow_sprite.x = self.x - @shadow_sprite.width / 2
@shadow_sprite.y = self.y - 28
@shadow_sprite.visible = self.visible
@shadow_sprite.viewport = self.viewport
@shadow_sprite.z = self.z - 1
end
end
end
alias jet5484_dispose dispose
def dispose(*args, &block)
@shadow_sprite.dispose if !@shadow_sprite.nil?
jet5484_dispose(*args, &block)
end
def move_x(times, amount)
i = 0
until i == times
self.jet_y += amount
i += 1
[Graphics, SceneManager.scene.spriteset].each {|a| a.update }
end
end
def effect?
false
end
end
class Game_Enemy
def atk_animation_id1
return Jet::Sideview::ENEMY_ATK_ANIMS[@enemy_id]
end
def atk_animation_id2
return 0
end
end
class Scene_Battle
attr_reader :spriteset
alias jet2711_use_item use_item
def use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if !@subject.current_action.guard?
@subject.battle_sprite.move_x(11, -4)
end
end
if !@subject.current_action.guard? && !@subject.current_action.attack?
if @subject.current_action.item.is_a?(RPG::Item)
n = $data_animations[Jet::Sideview::ITEM_ANIMATION]
else
n = $data_animations[Jet::Sideview::SKILL_ANIMATION]
end
@subject.battle_sprite.start_animation(n)
wait_for_animation
end
jet2711_use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if !@subject.current_action.guard?
@subject.battle_sprite.move_x(11, 4)
end
end
end
def show_attack_animation(targets)
aid1 = @subject.atk_animation_id1
aid2 = @subject.atk_animation_id2
show_normal_animation(targets, aid1, false)
show_normal_animation(targets, aid2, true)
end
%w[next prior].each {|a|
aStr = %Q{
alias jet3734_#{a}_command #{a}_command
def #{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, 4) if f.is_a?(Game_Actor)
jet3734_#{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, -4) if f.is_a?(Game_Actor)
end
}
module_eval(aStr)
}
end
class Game_Action
def guard?
item == $data_skills[subject.guard_skill_id]
end
end
if $imported[:jet][:BattlePopUps]
class Sprite_Character
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 !@popups.empty?
@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
end
Mon problème vient du script de Moghunter. La position de la fenêtre des choix d’actions s’adapte en fonction du battler qu’elle concerne. Et avec les réglages disponibles je n’arrive pas à faire ce que je veux.
Explications en images c’est plus simple.
Pour les choix du premier battler elle est bien placée :
Par contre pour le 2eme ca ne va pas :
Du coup je voudrais savoir s’il était possible qu’elle reste toujours au même endroit, à savoir celui sur la première image. Ou 2 eme solution (celle qui me conviendrait le mieux) qu’elle se place comme ça :
(Je n'utiliserais jamais plus de 2 héros en combat)
Voila je vous remercie d'avance pour votre aide !
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu]Demande modification script ACE "fenêtre d'action de combat"
Dim 20 Mai 2012 - 17:04
Bonjour test ce script modifié pour voir si ca te convient...
- Code:
#==============================================================================
# +++ MOG - ADVANCED BATTLE HUD (v1.3) +++
#==============================================================================
# Par Moghunter Traduit par Nozvez
# http://www.atelier-rgss.com/
#==============================================================================
# Système de hud avancé de combat.
#==============================================================================
#==============================================================================
# ● Historique
#==============================================================================
# v 1.3 - Script 100% indépendant du AT System.
# - Correction de la position initiale de la fenêtre de fuite.
# - Correction de la position du curseur sur les alliés lorsque le face
# est désactivé
# v 1.2 - Correction de la priorité des états.
# v 1.1 - Correction du bug initial de la priorité du face.
# v 1.0 - Première version.
#==============================================================================
#==============================================================================
# ■ - FACE ANIME DES PERSONNAGES - (Optionnel)
#==============================================================================
# 1 - Enregistrer les images des faces des personnages dans le dossier :
#
# GRAPHICS/BATTLERS/
#
# 2 - Nommer les images avec le nom des personnages. (EX - Hector.png)
# 3 - La largeur de l'image devra être divisée par 5.
#
#==============================================================================
#==============================================================================
# ■ BATTLE HUD SETTING
#==============================================================================
module MOG_BATTLE_HUD
# Activer les faces des personnages, à désactiver en cas d'utilisation
# d'autres scripts qui utilisent des battlers dans son projet.
BATTLER_FACE_ENABLE = false
#Définition générale de la position du HUD.
HUD_POSITION = [160,325]
#Définition de la position du face
FACE_POSITION = [60,30]
#Définition de la position du nombre de HP.
HP_NUMBER_POSITION = [85,28]
#Définition de la position du mètre HP.
HP_METER_POSITION = [27,37]
#Définition de la position du nombre de MP.
MP_NUMBER_POSITION = [101,46]
#Définition de la position du mètre MP.
MP_METER_POSITION = [43,55]
#Définition de la position du nombre de TP.
# TP_NUMBER_POSITION = [85,64]
#Définition de la position du mètre TP.
# TP_METER_POSITION = [27,73]
#Définition de la position des états
STATES_POSITION = [5,1]
#Définition de la position des commandes de combat.
COMMAND_POSITION = [-140,-40]
#Définition de la position de l'espae du HUD entre les membres du groupe.
MEMBERS_SPACE = [120,0]
#Définition de la priorité du HUD.
BATTLE_HUD_Z = 50
#Définition de la vitesse de l'animation des mètres.
METER_FLOW_SPEED = 0
end
#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
#Définition de la position du curseur sur la cible.
CURSOR_POSITION = [-45, -16]
#Définition de la position du nom de la cible.
CURSOR_NAME_POSITION = [-10, 35]
#Activer l'effet glisse.
CURSOR_SLIDE_EFFECT = false
#Activer l'animation de lévitation.
CURSOR_FLOAT_EFFECT = true
end
if MOG_BATTLE_HUD::BATTLER_FACE_ENABLE #BATTLER_FACE SYSTEM START
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :battler_face
attr_accessor :screen_x
attr_accessor :screen_y
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize setup
def setup(actor_id)
mog_battle_hud_initialize(actor_id)
battler_sprite_setup
end
#--------------------------------------------------------------------------
# ● Battler Sprite Setup
#--------------------------------------------------------------------------
def battler_sprite_setup
@battler_face = [0,0,0]
@battler_name = @name
@screen_x = 0
@screen_y = 0
end
#--------------------------------------------------------------------------
# ● Use Sprite?
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# ● Screen Z
#--------------------------------------------------------------------------
def screen_z
return MOG_BATTLE_HUD::BATTLE_HUD_Z + 4
end
#------------------------------------------------------------------------
# ● Screen X
#------------------------------------------------------------------------
def screen_x
return FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)
end
#------------------------------------------------------------------------
# ● Screen Y
#------------------------------------------------------------------------
def screen_y
return FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize(viewport, battler = nil)
battle_hud_setup
mog_battle_hud_initialize(viewport, battler)
end
#--------------------------------------------------------------------------
# ● Battle Hud Setup
#--------------------------------------------------------------------------
def battle_hud_setup
@old_face_index = 0
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_hud_dispose dispose
def dispose
mog_battle_hud_dispose
if @f_im != nil
@f_im.dispose
end
end
#--------------------------------------------------------------------------
# ● Update Bitmap
#--------------------------------------------------------------------------
alias mog_battle_hud_update_bitmap update_bitmap
def update_bitmap
if @battler.is_a?(Game_Actor)
create_actor_battler
update_actor_battler
return
end
mog_battle_hud_update_bitmap
end
#--------------------------------------------------------------------------
# ● Create Actor Battler
#--------------------------------------------------------------------------
def create_actor_battler
return if self.bitmap != nil
@f_im = Cache.battler(@battler.battler_name, 0)
@f_cw = @f_im.width / 5
@f_ch = @f_im.height
self.bitmap = Bitmap.new(@f_cw,@f_ch)
x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)
y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)
@org_pos = [x,y]
@battler.battler_face = [0,0,0]
@battler_visible = true
@low_hp = @battler.mhp * 30 / 100
self.z = @battler.screen_z + 100
make_face(true)
end
#--------------------------------------------------------------------------
# ● Face Base Setting
#--------------------------------------------------------------------------
def face_base_setting
self.x = @org_pos[0]
self.y = @org_pos[1]
self.z = @battler.screen_z
self.zoom_x = 1
self.zoom_y = 1
self.mirror = false
end
#--------------------------------------------------------------------------
# ● Check Base Face
#--------------------------------------------------------------------------
def check_base_face(reset)
face_base_setting
return if @battler.battler_face[2] > 0
@battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2
@battler.battler_face[0] = 3 if @battler.hp < @low_hp
@battler.battler_face[0] = 4 if @battler.hp == 0
end
#--------------------------------------------------------------------------
# ● Make Face
#--------------------------------------------------------------------------
def make_face(reset = false)
self.bitmap.clear
check_base_face(reset)
src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)
self.bitmap.blt(0,0, @f_im, src_rect_back)
@old_face_index = @battler.battler_face[0]
end
#--------------------------------------------------------------------------
# ● Update Actor Battler
#--------------------------------------------------------------------------
def update_actor_battler
return if self.bitmap == nil
update_face_effect
update_face_reset_time
update_face_z
make_face if @old_face_index != @battler.battler_face[0]
end
#--------------------------------------------------------------------------
# ● Update Face Z
#--------------------------------------------------------------------------
def update_face_z
self.z = @battler.screen_z + BATTLE_HUD_Z rescue 100
end
#--------------------------------------------------------------------------
# ● Update Face Reset Time
#--------------------------------------------------------------------------
def update_face_reset_time
return if @battler.battler_face[2] == 0
@battler.battler_face[2] -= 1
if @battler.battler_face[2] == 0 or
(@battler.hp < @low_hp and @battler.battler_face[0] == 0)
make_face(true)
end
end
#--------------------------------------------------------------------------
# ● Update Face Effect
#--------------------------------------------------------------------------
def update_face_effect
return if @battler.battler_face[2] == 0
case @battler.battler_face[1]
when 0
face_damage
when 1..2
face_heal
when 3
face_action
end
end
#--------------------------------------------------------------------------
# ● Face Damage
#--------------------------------------------------------------------------
def face_damage
self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])
end
#--------------------------------------------------------------------------
# ● Face Heal
#--------------------------------------------------------------------------
def face_heal
case @battler.battler_face[2]
when 20..40
self.zoom_x += 0.01
self.zoom_y = self.zoom_x
when 0..20
self.zoom_x -= 0.01
self.zoom_y = self.zoom_x
end
end
#--------------------------------------------------------------------------
# ● Face Action
#--------------------------------------------------------------------------
def face_action
case @battler.battler_face[2]
when 25..50
self.zoom_x += 0.01
self.zoom_y = self.zoom_x
self.mirror = true
when 0..25
self.zoom_x -= 0.01
self.zoom_y = self.zoom_x
self.mirror = false
end
self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x
self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y
end
#--------------------------------------------------------------------------
# ● Update Position
#--------------------------------------------------------------------------
alias mog_battle_hud_update_position update_position
def update_position
return if @battle.is_a?(Game_Actor)
mog_battle_hud_update_position
end
#--------------------------------------------------------------------------
# ● Update Collapse
#--------------------------------------------------------------------------
alias mog_battle_hud_update_collapse update_collapse
def update_collapse
return if @battler.is_a?(Game_Actor)
mog_battle_hud_update_collapse
end
#--------------------------------------------------------------------------
# ● Update Instant Collapse
#--------------------------------------------------------------------------
alias mog_battle_hud_update_instant_collapse update_instant_collapse
def update_instant_collapse
return if @battler.is_a?(Game_Actor)
mog_battle_hud_update_instant_collapse
end
end
#==============================================================================
# ■ Battle Manager
#==============================================================================
class << BattleManager
#--------------------------------------------------------------------------
# ● Battle End
#--------------------------------------------------------------------------
alias mog_battle_hud_battle_process_victory process_victory
def process_victory
execute_face_effect
mog_battle_hud_battle_process_victory
end
#--------------------------------------------------------------------------
# ● Prepare
#--------------------------------------------------------------------------
def execute_face_effect
for i in $game_party.members
if i.hp > 0
i.battler_face = [1,2,40]
end
end
end
end
#==============================================================================
# ■ Game Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● Prepare
#--------------------------------------------------------------------------
alias mog_battle_hud_prepare prepare
def prepare
mog_battle_hud_prepare
make_face_action
end
#--------------------------------------------------------------------------
# ● Make Face Action
#--------------------------------------------------------------------------
def make_face_action
return if !subject.is_a?(Game_Actor)
return if @item.object == nil
subject.battler_face = [2,3,50]
end
end
#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● Item Apply
#--------------------------------------------------------------------------
alias mog_battle_hud_item_apply item_apply
def item_apply(user, item)
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_item_apply(user, item)
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Check Face Effect
#--------------------------------------------------------------------------
def check_face_effect(old_hp,old_mp)
if self.hp > old_hp or self.mp > old_mp
self.battler_face = [1,1,40]
elsif self.hp < old_hp
self.battler_face = [3,0,40]
end
end
#--------------------------------------------------------------------------
# ● Added New State
#--------------------------------------------------------------------------
alias mog_battle_hud_add_new_state add_new_state
def add_new_state(state_id)
mog_battle_hud_add_new_state(state_id)
if self.is_a?(Game_Actor)
self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/
self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/
end
end
#--------------------------------------------------------------------------
# ● Regenerate HP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_hp regenerate_hp
def regenerate_hp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_hp
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Regenerate MP
#--------------------------------------------------------------------------
alias mog_battle_hud_regenerate_mp regenerate_mp
def regenerate_mp
old_hp = self.hp
old_mp = self.mp
mog_battle_hud_regenerate_mp
check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)
end
#--------------------------------------------------------------------------
# ● Can Check Face Effect
#--------------------------------------------------------------------------
def can_check_face_effect?(old_hp,old_mp)
return false if self.is_a?(Game_Enemy)
return true if old_hp != self.hp
return true if old_mp != self.mp
return false
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Invoke Counter Attack
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_counter_attack invoke_counter_attack
def invoke_counter_attack(target, item)
mog_battle_hud_invoke_counter_attack(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
#--------------------------------------------------------------------------
# ● Invoke Magic Reflection
#--------------------------------------------------------------------------
alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection
def invoke_magic_reflection(target, item)
mog_battle_hud_invoke_magic_reflection(target, item)
if target.is_a?(Game_Actor) and target.battler_face[0] != 2
target.battler_face = [2,3,50]
end
end
end
end #BATTLER FACE SYSTEM END --------------------------------------------------
#==============================================================================
# ■ Battle_Hud
#==============================================================================
class Battle_Hud
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(actor,image)
@actor = actor
@x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
@y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)
pre_cache(image)
create_layout
create_hp_number
create_hp_meter
create_mp_number
create_mp_meter
# create_tp_number
# create_tp_meter
create_states
end
#--------------------------------------------------------------------------
# ● Pre Cache
#--------------------------------------------------------------------------
def pre_cache(image)
@number = image[0]
@number_cw = @number.width / 10
@number_ch = @number.height / 4
@meter = image[1]
@meter_cw = @meter.width / 3
@meter_ch = @meter.height / 3
@icon = image[2]
end
#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = Cache.system("Battle_Hud_Layout")
@layout.z = BATTLE_HUD_Z
@layout.x = @x
@layout.y = @y
end
#--------------------------------------------------------------------------
# ● Create HP Number
#--------------------------------------------------------------------------
def create_hp_number
@hp = @actor.hp
@hp_old = @actor.hp
@hp_ref = @hp_old
@hp_refresh = false
@hp_number = Sprite.new
@hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@hp_number.z = BATTLE_HUD_Z + 51
@hp_number.x = @x + HP_NUMBER_POSITION[0]
@hp_number.y = @y + HP_NUMBER_POSITION[1]
refresh_hp_number
end
#--------------------------------------------------------------------------
# ● Create HP Meter
#--------------------------------------------------------------------------
def create_hp_meter
@hp_meter = Sprite.new
@hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@hp_meter.z = BATTLE_HUD_Z + 50
@hp_meter.x = @x + HP_METER_POSITION[0]
@hp_meter.y = @y + HP_METER_POSITION[1]
@hp_flow = rand(@meter_cw * 2)
@hp_width_old = @meter_cw * @actor.hp / @actor.mhp
hp_flow_update
end
#--------------------------------------------------------------------------
# ● Hp Flow Update
#--------------------------------------------------------------------------
def hp_flow_update
@hp_meter.bitmap.clear
hp_width = @meter_cw * @actor.hp / @actor.mhp
#execute_damage_flow(hp_width)
hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)
@hp_flow += METER_FLOW_SPEED
@hp_flow = 0 if @hp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Execute Damage Flow
#--------------------------------------------------------------------------
def execute_damage_flow(hp_width)
n = (@hp_width_old - hp_width).abs * 3 / 100
damage_flow = [[n, 2].min,0.5].max
@hp_width_old -= damage_flow
@hp_width_old = hp_width if @hp_width_old < hp_width
src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)
@hp_meter.bitmap.blt(0,0, @meter, src_rect_old)
end
#--------------------------------------------------------------------------
# ● Update HP Number
#--------------------------------------------------------------------------
def update_hp_number
@hp_refresh = true
n = 2 * (@actor.hp - @hp_old).abs / 100
hp_ref = [[n, 100].min,1].max
if @hp_old < @actor.hp
@hp += hp_ref
if @hp >= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
elsif @hp_old > @actor.hp
@hp -= hp_ref
if @hp <= @actor.hp
@hp_old = @actor.hp
@hp = @actor.hp
@hp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh HP Number
#--------------------------------------------------------------------------
def refresh_hp_number
@hp_number.bitmap.clear
number_value = @hp.abs.to_s.split(//)
hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)
@hp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@hp_refresh = false if @hp == @actor.hp
end
#--------------------------------------------------------------------------
# ● Create MP Number
#--------------------------------------------------------------------------
def create_mp_number
@mp = @actor.mp
@mp_old = @actor.mp
@mp_ref = @mp_old
@mp_refresh = false
@mp_number = Sprite.new
@mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
@mp_number.z = BATTLE_HUD_Z + 51
@mp_number.x = @x + MP_NUMBER_POSITION[0]
@mp_number.y = @y + MP_NUMBER_POSITION[1]
refresh_mp_number
end
#--------------------------------------------------------------------------
# ● Create MP Meter
#--------------------------------------------------------------------------
def create_mp_meter
@mp_meter = Sprite.new
@mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
@mp_meter.z = BATTLE_HUD_Z + 50
@mp_meter.x = @x + MP_METER_POSITION[0]
@mp_meter.y = @y + MP_METER_POSITION[1]
@mp_flow = rand(@meter_cw * 2)
@mp_width_old = @meter_cw * @actor.mp / @actor.mmp
mp_flow_update
end
#--------------------------------------------------------------------------
# ● Mp Flow Update
#--------------------------------------------------------------------------
def mp_flow_update
@mp_meter.bitmap.clear
mp_width = @meter_cw * @actor.mp / @actor.mmp
src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)
@mp_meter.bitmap.blt(0,0, @meter, src_rect)
@mp_flow += METER_FLOW_SPEED
@mp_flow = 0 if @mp_flow >= @meter_cw * 2
end
#--------------------------------------------------------------------------
# ● Update MP Number
#--------------------------------------------------------------------------
def update_mp_number
@mp_refresh = true
n = 2 * (@actor.mp - @mp_old).abs / 100
mp_ref = [[n, 100].min,1].max
if @mp_old < @actor.mp
@mp += mp_ref
if @mp >= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
elsif @mp_old > @actor.mp
@mp -= mp_ref
if @mp <= @actor.mp
@mp_old = @actor.mp
@mp = @actor.mp
@mp_ref = 0
end
end
end
#--------------------------------------------------------------------------
# ● Refresh MP Number
#--------------------------------------------------------------------------
def refresh_mp_number
@mp_number.bitmap.clear
number_value = @mp.abs.to_s.split(//)
center_x = 0
for r in 0..number_value.size - 1
number_value_abs = number_value[r].to_i
src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)
@mp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
center_x += 1
end
@mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
@mp_refresh = false if @mp == @actor.mp
end
#--------------------------------------------------------------------------
# ● Create TP Number
#--------------------------------------------------------------------------
# def create_tp_number
# @tp = @actor.tp
# @tp_old = @actor.tp
# @tp_ref = @tp_old
# @tp_refresh = false
# @tp_number = Sprite.new
# @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)
# @tp_number.z = BATTLE_HUD_Z + 51
# @tp_number.x = @x + TP_NUMBER_POSITION[0]
# @tp_number.y = @y + TP_NUMBER_POSITION[1]
# refresh_tp_number
# end
#--------------------------------------------------------------------------
# ● Create TP Meter
#--------------------------------------------------------------------------
# def create_tp_meter
# @tp_meter = Sprite.new
# @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
# @tp_meter.z = BATTLE_HUD_Z + 50
# @tp_meter.x = @x + TP_METER_POSITION[0]
# @tp_meter.y = @y + TP_METER_POSITION[1]
# @tp_flow = rand(@meter_cw * 2)
# @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp
# tp_flow_update
# end
#--------------------------------------------------------------------------
# ● TP Flow Update
#--------------------------------------------------------------------------
# def tp_flow_update
# @tp_meter.bitmap.clear
# tp_width = @meter_cw * @actor.tp / @actor.max_tp
# src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)
# @tp_meter.bitmap.blt(0,0, @meter, src_rect)
# @tp_flow += METER_FLOW_SPEED
# @tp_flow = 0 if @tp_flow >= @meter_cw * 2
# end
#--------------------------------------------------------------------------
# ● Update TP Number
#--------------------------------------------------------------------------
# def update_tp_number
# @tp_refresh = true
# n = 2 * (@actor.tp - @tp_old).abs / 100
# tp_ref = [[n, 100].min,1].max
# if @tp_old < @actor.tp
# @tp += tp_ref
# if @tp >= @actor.tp
# @tp_old = @actor.tp
# @tp = @actor.tp
# @tp_ref = 0
# end
# elsif @tp_old > @actor.tp
# @tp -= tp_ref
# if @tp <= @actor.tp
# @tp_old = @actor.tp
# @tp = @actor.tp
# @tp_ref = 0
# end
# end
# end
#--------------------------------------------------------------------------
# ● Refresh TP Number
#--------------------------------------------------------------------------
#def refresh_tp_number
# @tp_number.bitmap.clear
# number_value = @tp.truncate.to_s.split(//)
# center_x = 0
# for r in 0..number_value.size - 1
# number_value_abs = number_value[r].to_i
# src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)
# @tp_number.bitmap.blt((@number_cw + 1) * r, 0, @number, src_rect)
# center_x += 1
# end
# @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))
# @tp_refresh = false if @tp == @actor.tp
# end
#--------------------------------------------------------------------------
# ● Create_States
#--------------------------------------------------------------------------
def create_states
refresh_states
@status = Sprite.new
@status.bitmap = Bitmap.new(24,24)
@status.x = @x + STATES_POSITION[0]
@status.y = @y + STATES_POSITION[1]
@status_flow = -24
@states_speed = 50
@status.z = BATTLE_HUD_Z + 51
@old_states = @actor.states
flow_states
end
#--------------------------------------------------------------------------
# ● Flow_Status
#--------------------------------------------------------------------------
def flow_states
return if @actor.states.size == 0 and !@status.visible
@states_speed = 0
@status.bitmap.clear
src_rect = Rect.new(@status_flow,0, 24,24)
@status.bitmap.blt(0,0, @actor_status, src_rect)
@status.visible = @actor.states.size == 0 ? false : true
@status_flow += 1
@status_flow = -24 if @status_flow >= @states_size - 24
end
#--------------------------------------------------------------------------
# ● Refresh States
#--------------------------------------------------------------------------
def refresh_states
@old_states = @actor.states
if @actor_status != nil
@actor_status.dispose
@actor_status = nil
end
@states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24
@actor_status = Bitmap.new(@states_size,24)
index = 0
for i in @actor.states
rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
@actor_status.blt(48 * index , 0, @icon, rect)
index += 1
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
@meter.dispose
@number.dispose
@icon.dispose
@layout.bitmap.dispose
@layout.dispose
@hp_number.bitmap.dispose
@hp_number.dispose
@hp_meter.bitmap.dispose
@hp_meter.dispose
@mp_number.bitmap.dispose
@mp_number.dispose
@mp_meter.bitmap.dispose
@mp_meter.dispose
# @tp_number.bitmap.dispose
# @tp_number.dispose
# @tp_meter.bitmap.dispose
# @tp_meter.dispose
@status.bitmap.dispose
@status.dispose
if @actor_status != nil
@actor_status.dispose
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_hp_number if @hp_old != @actor.hp
refresh_hp_number if @hp_refresh
update_mp_number if @mp_old != @actor.mp
refresh_mp_number if @mp_refresh
# update_tp_number if @tp_old != @actor.tp
# refresh_tp_number if @tp_refresh
refresh_states if @old_states != @actor.states
hp_flow_update
# tp_flow_update
mp_flow_update
flow_states
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
create_battle_hud
end
#--------------------------------------------------------------------------
# ● Create Battle Hud
#--------------------------------------------------------------------------
def create_battle_hud
i1 = Cache.system("Battle_Hud_Number")
i2 = Cache.system("Battle_Hud_Meter")
i3 = Cache.system("Iconset")
@hud_images = []
@hud_images.push(i1,i2,i3)
@battle_hud = []
for i in $game_party.members
@battle_hud.push(Battle_Hud.new(i,@hud_images))
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_hud_dispose dispose
def dispose
mog_battle_hud_dispose
dispose_battle_hud
end
#--------------------------------------------------------------------------
# ● Dispose Battle Hud
#--------------------------------------------------------------------------
def dispose_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.dispose }
@battle_hud.clear
@hud_images.each {|sprite| sprite.dispose }
@hud_images.clear
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update update
def update
mog_battle_hud_update
update_battle_hud
end
#--------------------------------------------------------------------------
# ● Update Battle Hud
#--------------------------------------------------------------------------
def update_battle_hud
return if @battle_hud == nil
@battle_hud.each {|sprite| sprite.update }
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
include MOG_BATTLE_HUD
attr_accessor :hud_x
attr_accessor :hud_y
#--------------------------------------------------------------------------
# ● HUD X ###MODIFIE###
#--------------------------------------------------------------------------
def hud_x
return HUD_POSITION[0] #+ (MEMBERS_SPACE[0] * index)
end
#--------------------------------------------------------------------------
# ● HUD Y ###MODIFIE###
#--------------------------------------------------------------------------
def hud_y
return HUD_POSITION[1] #+ (MEMBERS_SPACE[1] * index)
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Create Party Command Window
#--------------------------------------------------------------------------
alias mog_battle_hud_create_party_command_window create_party_command_window
def create_party_command_window
mog_battle_hud_create_party_command_window
set_party_window_position
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
def set_party_window_position
@party_command_window.viewport = nil
return if $mog_rgss3_at_system != nil
a_index = []
for actor in $game_party.alive_members
a_index = [actor.hud_x, actor.hud_y]
break
end
return if a_index.empty?
@party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]
@party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]
end
#--------------------------------------------------------------------------
# ● Set Party Window Position
#--------------------------------------------------------------------------
alias mog_battle_hud_start_party_command_selection start_party_command_selection
def start_party_command_selection
set_party_window_position
mog_battle_hud_start_party_command_selection
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_hud_update_basic update_basic
def update_basic
mog_battle_hud_update_basic
update_command_window_visible
end
#--------------------------------------------------------------------------
# ● Update Command Window Visible
#--------------------------------------------------------------------------
def update_command_window_visible
@status_window.visible = @status_window.active ? true : false
@actor_command_window.visible = @actor_command_window.active ? true : false
@skill_window.visible = @skill_window.active ? true : false
@item_window.visible = @item_window.active ? true : false
end
#--------------------------------------------------------------------------
# ● Start Actor Command Selection
#--------------------------------------------------------------------------
alias mog_battle_hud_start_actor_command_selection start_actor_command_selection
def start_actor_command_selection
mog_battle_hud_start_actor_command_selection
@actor_command_window.viewport = nil
@actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x
@actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y
@party_command_window.x = @actor_command_window.x
@party_command_window.y = @actor_command_window.y
end
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :battle_cursor
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
@battle_cursor = [0,0,true,""]
mog_battle_cursor_initialize
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
mog_battle_cursor_initialize
create_cursor
end
#--------------------------------------------------------------------------
# ● Create_Cursor
#--------------------------------------------------------------------------
def create_cursor
@cursor = Sprite.new
@cursor.bitmap = Cache.system("Battle_Cursor")
@cursor.z = 999
@cursor.visible = false
@cursor_new_x = -64
@cursor_new_y = -64
@cursor_float_y = 0
@cursor_float_duration = 0
@c_real_y = 0
@cursor_name = Sprite.new
@cursor_name.bitmap = Bitmap.new(120,32)
@cursor_name.z = @cursor.z + 1
@cursor_name.bitmap.font.size = 16
refresh_cursor_name
update_cursor_name
$game_temp.battle_cursor = [@cursor_new_x,@cursor_new_y,false]
end
#--------------------------------------------------------------------------
# ● Refresh Cursor Name
#--------------------------------------------------------------------------
def refresh_cursor_name
return if !(@cursor.x == $game_temp.battle_cursor[0] and
@cursor.y == @c_real_y)
@cursor_name_enemy = $game_temp.battle_cursor[3]
@cursor_name.bitmap.clear
@cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_cursor_dispose dispose
def dispose
mog_battle_cursor_dispose
dispose_cursor
end
#--------------------------------------------------------------------------
# ● Dispose Cursor
#--------------------------------------------------------------------------
def dispose_cursor
@cursor.bitmap.dispose
@cursor.dispose
@cursor_name.bitmap.dispose
@cursor_name.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_cursor_update update
def update
mog_battle_cursor_update
update_battle_cursor
end
#--------------------------------------------------------------------------
# ● Update Battle Cursor
#--------------------------------------------------------------------------
def update_battle_cursor
return if @cursor == nil
@cursor.visible = $game_temp.battle_cursor[2]
update_cursor_name
if !@cursor.visible
@cursor.x = -64
@cursor.y = -64
@cursor.opacity = 0
update_cursor_name
return
end
@cursor.opacity += 15
update_cursor_float_effect
if CURSOR_SLIDE_EFFECT
update_cursor_slide_effect
else
@cursor.x = $game_temp.battle_cursor[0]
@cursor.y = $game_temp.battle_cursor[1]
end
end
#--------------------------------------------------------------------------
# ● Update Cursor Name
#--------------------------------------------------------------------------
def update_cursor_name
refresh_cursor_name if @cursor_name_enemy != $game_temp.battle_cursor[3]
@cursor_name.x = @cursor.x + CURSOR_NAME_POSITION[0]
@cursor_name.y = @cursor.y + CURSOR_NAME_POSITION[1]
@cursor_name.opacity = @cursor.opacity
@cursor_name.visible = @cursor.visible
end
#--------------------------------------------------------------------------
# ● Update Cursor Slide Effect
#--------------------------------------------------------------------------
def update_cursor_slide_effect
@cursor_new_x = $game_temp.battle_cursor[0]
@cursor_new_y = $game_temp.battle_cursor[1]
@cs_x = 5 + ((@cursor.x - @cursor_new_x).abs / 5)
@cs_y = 5 + ((@cursor.y - @cursor_new_y).abs / 5)
if @cursor.x > @cursor_new_x
@cursor.x -= @cs_x
@cursor.x = @cursor_new_x if @cursor.x < @cursor_new_x
elsif @cursor.x < @cursor_new_x
@cursor.x += @cs_x
@cursor.x = @cursor_new_x if @cursor.x > @cursor_new_x
end
@c_real_y = @cursor_new_y + @cursor_float_y
if @cursor.y > @cursor_new_y
@cursor.y -= @cs_y
@cursor.y = @c_real_y if @cursor.y < @c_real_y
elsif @cursor.y < @c_real_y
@cursor.y += @cs_y
@cursor.y = @c_real_y if @cursor.y > @c_real_y
end
end
#--------------------------------------------------------------------------
# ● Update Cursor Float Effect
#--------------------------------------------------------------------------
def update_cursor_float_effect
return if !CURSOR_FLOAT_EFFECT
@cursor_float_duration += 1
case @cursor_float_duration
when 0..20
@cursor_float_y += 1
when 21..40
@cursor_float_y -= 1
else
@cursor_float_y = 0
@cursor_float_duration = 0
end
end
end
#==============================================================================
# ■ Window BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_hud_initialize initialize
def initialize
mog_battle_hud_initialize
self.visible = false
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
alias mog_battle_hud_refresh refresh
def refresh
return
mog_battle_hud_refresh
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Create Enemy Window
#--------------------------------------------------------------------------
def create_enemy_window
@enemy_window = Window_BattleEnemy_Cursor.new
@enemy_window.set_handler(:ok, method(:on_enemy_ok))
@enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
end
#--------------------------------------------------------------------------
# ● Create Actor Window
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Window_BattleActor_Cursor.new
@actor_window.set_handler(:ok, method(:on_actor_ok))
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
end
end
#==============================================================================
# ■ Window Selectable Battle_Cursor
#==============================================================================
class Window_Selectable_Battle_Cursor < Window_Base
attr_reader :index
#--------------------------------------------------------------------------
# ● Initialize
#-------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@index = -1
@handler = {}
deactivate
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
return 0
end
#--------------------------------------------------------------------------
# ● Active
#--------------------------------------------------------------------------
def active=(active)
super
end
#--------------------------------------------------------------------------
# ● Index
#--------------------------------------------------------------------------
def index=(index)
@index = index
end
#--------------------------------------------------------------------------
# ● Set Handler
#--------------------------------------------------------------------------
def set_handler(symbol, method)
@handler[symbol] = method
end
#--------------------------------------------------------------------------
# ● Handle?
#--------------------------------------------------------------------------
def handle?(symbol)
@handler.include?(symbol)
end
#--------------------------------------------------------------------------
# ● Call Handler
#--------------------------------------------------------------------------
def call_handler(symbol)
@handler[symbol].call if handle?(symbol)
end
#--------------------------------------------------------------------------
# ● Cursor Movable
#--------------------------------------------------------------------------
def cursor_movable?
active && open? && !@cursor_fix && !@cursor_all && item_max > 0
end
#--------------------------------------------------------------------------
# ● Cursor Down
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
self.index += 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor Right
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
self.index += 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor UP
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
self.index -= 1
check_index_limit
end
#--------------------------------------------------------------------------
# ● Cursor Left
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
self.index -= 1
check_index_limit(self.index)
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
process_cursor_move
process_handling
end
#--------------------------------------------------------------------------
# ● Process Cursor Move
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
if @index != last_index
Sound.play_cursor
set_cursor_position(@index)
end
end
#--------------------------------------------------------------------------
# ● Process Handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_ok if ok_enabled? && Input.trigger?(:C)
return process_cancel if cancel_enabled? && Input.trigger?(:B)
end
#--------------------------------------------------------------------------
# ● OK Enabled
#--------------------------------------------------------------------------
def ok_enabled?
handle?(:ok)
end
#--------------------------------------------------------------------------
# ● Cancel Enabled
#--------------------------------------------------------------------------
def cancel_enabled?
handle?(:cancel)
end
#--------------------------------------------------------------------------
# ● Process OK
#--------------------------------------------------------------------------
def process_ok
if current_item_enabled?
Sound.play_ok
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● Call OK Handler
#--------------------------------------------------------------------------
def call_ok_handler
call_handler(:ok)
end
#--------------------------------------------------------------------------
# ● Process Cancel
#--------------------------------------------------------------------------
def process_cancel
Sound.play_cancel
Input.update
deactivate
call_cancel_handler
end
#--------------------------------------------------------------------------
# ● Call Cancel Handler
#--------------------------------------------------------------------------
def call_cancel_handler
call_handler(:cancel)
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
end
#--------------------------------------------------------------------------
# ● Current Item Enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
end
#--------------------------------------------------------------------------
# ● Show
#--------------------------------------------------------------------------
def show
set_cursor_position(self.index)
$game_temp.battle_cursor[2] = true
super
end
#--------------------------------------------------------------------------
# ● Hide
#--------------------------------------------------------------------------
def hide
$game_temp.battle_cursor[2] = false
super
end
#--------------------------------------------------------------------------
# ● Check Index Limit
#--------------------------------------------------------------------------
def check_index_limit(index = self.index)
self.index = index
self.index = 0 if self.index >= item_max
self.index = (item_max - 1) if self.index < 0
end
end
#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy_Cursor < Window_Selectable_Battle_Cursor
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
super(-32, -32, 32, 32)
self.index = 0
self.visible = false
set_cursor_position(self.index)
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_troop.alive_members.size
end
#--------------------------------------------------------------------------
# ● Enemy
#--------------------------------------------------------------------------
def enemy
$game_troop.alive_members[self.index]
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
check_index_limit(index)
return if $game_troop.alive_members[self.index] == nil
$game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0]
$game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1]
$game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name
end
end
#==============================================================================
# ■ Window_BattleActor Cursor
#==============================================================================
class Window_BattleActor_Cursor < Window_Selectable_Battle_Cursor
include MOG_BATTLE_CURSOR
include MOG_BATTLE_HUD
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
super(-32, -32, 32, 32)
self.index = 0
self.visible = true
set_cursor_position(self.index)
end
#--------------------------------------------------------------------------
# ● Item Max
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# ● Set Cursor Position
#--------------------------------------------------------------------------
def set_cursor_position(index)
check_index_limit(index)
return if $game_party.members[self.index] == nil
screen_x = $game_party.members[self.index].screen_x rescue nil
screen_y = $game_party.members[self.index].screen_y rescue nil
if screen_x == nil or screen_y == nil
screen_x = $game_party.members[self.index].hud_x + (HP_NUMBER_POSITION[0] / 3) + 32
screen_y = $game_party.members[self.index].hud_y + (HP_NUMBER_POSITION[1] / 2) + 32
end
$game_temp.battle_cursor[0] = screen_x + CURSOR_POSITION[0]
$game_temp.battle_cursor[1] = screen_y + CURSOR_POSITION[1]
$game_temp.battle_cursor[3] = $game_party.members[self.index].name
end
end
$mog_rgss3_battle_hud = true
- LunriMembre
- Nombre de messages : 675
Age : 33
Distinction : aucune
Date d'inscription : 31/07/2011
Re: [Résolu]Demande modification script ACE "fenêtre d'action de combat"
Dim 20 Mai 2012 - 18:03
Oui ca me va merci beaucoup
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|