=begin RGSS3 ★ スキル発動時バトルバック暗転 ★ スキル発動時に、バトルバックを暗く変化させることで、雰囲気アップ。 ● 使い方 ●======================================================== スキルのメモ欄に「背景暗転」という文字列を含ませてください。 ==================================================================== ver1.00 Last Update : 2015/04/30 4/30 : RGSS2にあったものを移植 ろかん [url]http://kaisou-ryouiki.sakura.ne.jp/[/url] =end #=================================== # ●設定箇所 #=================================== module Skill_Fade # 全てのスキルで背景を暗転させるか # (true にした場合メモ欄に設定をしなくてもバトルバックが暗転するようになります) ALL_FADE = false end #=================================== # ここまで #=================================== $rsi ||= {} $rsi["スキル発動時バトルバック暗転"] = true class Game_Action #-------------------------------------------------------------------------- # ● 通常攻撃判定 #-------------------------------------------------------------------------- def guard? item == $data_skills[subject.guard_skill_id] end #-------------------------------------------------------------------------- # ● スキル判定 #-------------------------------------------------------------------------- def skill? item.is_a?(RPG::Skill) && !attack? && !guard? end end class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ● インクルード Skill_Fade #-------------------------------------------------------------------------- include Skill_Fade #-------------------------------------------------------------------------- # ● バトルバック暗転スキルを発動しようとしているかどうか #-------------------------------------------------------------------------- def fade_back_skill? if ALL_FADE current_action.skill? else current_action.skill? && current_action.item.note.include?("背景暗转") end end end class Spriteset_Battle SFO_SPEED = 30 MAX_FADE_OPACITY = SFO_SPEED * 6 #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :skill_fade_flag # スキル暗転フラグ #-------------------------------------------------------------------------- # ● 戦闘背景(床)スプライトの作成 #-------------------------------------------------------------------------- alias skill_fade_create_battleback1 create_battleback1 def create_battleback1 skill_fade_create_battleback1 @back1_sprite.color.set(0, 0, 0, 0) end #-------------------------------------------------------------------------- # ● 戦闘背景(壁)スプライトの作成 #-------------------------------------------------------------------------- alias skill_fade_create_battleback2 create_battleback2 def create_battleback2 skill_fade_create_battleback2 @back2_sprite.color = @back1_sprite.color end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias skill_fade_update update def update skill_fade_update update_fade_battleback end #-------------------------------------------------------------------------- # ● バトルバックスプライト暗転更新 #-------------------------------------------------------------------------- def update_fade_battleback if @skill_fade_flag unless @back1_sprite.color.alpha == MAX_FADE_OPACITY @back1_sprite.color.alpha += SFO_SPEED @back2_sprite.color.alpha = @back1_sprite.color.alpha end else @back1_sprite.color.alpha -= SFO_SPEED @back2_sprite.color.alpha = @back1_sprite.color.alpha end end end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● アニメーションの表示 #-------------------------------------------------------------------------- alias skill_fade_show_animation show_animation def show_animation(targets, animation_id) if @subject.fade_back_skill? @spriteset.skill_fade_flag = true wait(40) end skill_fade_show_animation(targets, animation_id) end #-------------------------------------------------------------------------- # ● スキル/アイテムの使用 #-------------------------------------------------------------------------- alias skill_fade_use_item use_item def use_item skill_fade_use_item @spriteset.skill_fade_flag = false end end
#============================================================================== # +++ MOG - Scope EX (v1.5) +++ #============================================================================== # By Moghunter # [url]https://atelierrgss.wordpress.com/[/url] #============================================================================== # Adiciona a característica de área de impacto da ação baseado na posição # e o tamanho do sprite do alvo. # Por exemplo, uma habilidade de explosão vai acertar apenas os inimigos que # estiverem em volta do alvo inicial. # O script adiciona também a função de incluir todos os alvos da tela, aliados # e inimigos juntos. #============================================================================== # Adicione a Tag abaixo na caixa de comentários de notas para definir a área de # impacto da habilidade. # # <Scope Range = X1 - X2 - Y1 - Y2> # # Y1 # # X1 X2 # # Y2 # # Ex -> <Scope Range = 100 - 32 - 64 - 32> # #============================================================================== # Incluir todos os alvos da tela. (Inimigos e Aliados) #============================================================================== # # <All Targets> # #============================================================================== # Histórico #============================================================================== # v1.5 Correção de ativar o sistema sem fazer comentário na caixa de notas. # v1.4 Compatibilidade com MOG Sprite Actor. # v1.3 Melhoria no cálculo de área em alvos únicos. # v1.2 Melhoria no sistema de calculo baseado no tamanho do sprite. # v1.1 Possibilidade de definir a área específica para cada lado. # #============================================================================== #首先请把技能的目标设成单个敌人或单个队友或使用者 #技能备注里 #<Scope Range = 120 - 120 - 64 - 40> #目标两侧120像素,向上64像素,向下40像素 #技能对上述范围内的目标生效 #<All Targets> #范围内全部目标,不分敌我 #如果备注里填入 #<All Targets> #<Scope Range = 544 - 544 - 416 - 416> #那好吧,这是一个地地道道的全屏范围的技能,当然你的画面尺寸是544*416. #精灵尺寸,大概是给怪物图设个尺寸来代替怪物图原本的尺寸 #SPRITE_SIZE_RANGE = [80,70] #范围类型,大概是0表示用怪物图原本的尺寸,而1是用上面设置的尺寸 #SCOPE_TYPE = 1 #以上两个设定会影响到范围的计算,细微之处不是很确定。 $imported = {} if $imported.nil? $imported[:mog_scope_ex] = true module MOG_SCOPE_EX #============================================================================ # Definição do modo que vai ser calculado a área do alvo. # # 0 - Baseado apenas na posição X e Y. (ignorando o tamanho do sprite) # 1 - Baseado na posição X e Y + o tamanho do sprite do alvo. # (Alvos grandes tem maior area de impacto) # #============================================================================ SCOPE_TYPE = 1 #============================================================================ # Definição da porcentágem total do tamanho sprite, para ser efetuado o # calculo. (Apenas se o valor do SCOPE_TYPE estiver no 1) # Por exemplo, definindo o valor de 100% o sistema vai considerar 100% do # tamanho do sprite para fazer o calculo. #============================================================================ # SPRITE_SIZE_RANGE = [WIDTH %, HEIGHT %] #============================================================================ SPRITE_SIZE_RANGE = [80,70] end #============================================================================== # ■ Game Battler #============================================================================== class Game_Battler < Game_BattlerBase attr_accessor :sprite_size #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- alias mog_scope_ex_initialize initialize def initialize @sprite_size = [0,0,true] mog_scope_ex_initialize end end #============================================================================== # ■ Sprite Battler #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # * Update Bitmap #-------------------------------------------------------------------------- alias mog_scope_ex_update_bitmap update_bitmap def update_bitmap @battler.sprite_size = [bitmap.width,bitmap.height,true] if bitmap mog_scope_ex_update_bitmap end end #============================================================================== # ■ Scene Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Show Normal Animation #-------------------------------------------------------------------------- alias mog_scope_ex_show_normal_animation show_normal_animation def show_normal_animation(targets, animation_id, mirror = false) new_targets = [] targets.each do |t| new_targets.push(t) if t.sprite_size[2] end targets = new_targets mog_scope_ex_show_normal_animation(targets, animation_id, mirror) targets.each do |t| t.sprite_size[2] = true end end end #============================================================================== # ■ Game Action #============================================================================== class Game_Action include MOG_SCOPE_EX #-------------------------------------------------------------------------- # * Make Targets #-------------------------------------------------------------------------- def make_targets if $imported[:mog_battler_motion] != nil and $imported[:mog_sprite_actor] != nil return @subject.pre_target if @subject != nil and @subject.pre_target != nil end if !forcing && subject.confusion? confusion_target elsif item.for_opponent? targets_for_opponents elsif item.for_friend? targets_for_friends else [] end end #-------------------------------------------------------------------------- # * Confusion Target #-------------------------------------------------------------------------- def confusion_target case subject.confusion_level when 1 ; new_targets = make_new_targets([opponents_unit.random_target],0) when 2 if rand(2) == 0 new_targets = make_new_targets([opponents_unit.random_target],0) else new_targets = make_new_targets([friends_unit.random_target],1) end else new_targets = make_new_targets([friends_unit.random_target],1) end end #-------------------------------------------------------------------------- # * Targets for Opponents #-------------------------------------------------------------------------- def targets_for_opponents if item.for_random? org_target = Array.new(item.number_of_targets) { opponents_unit.random_target } new_targets = make_new_targets(org_target,0) elsif item.for_one? num = 1 + (attack? ? subject.atk_times_add.to_i : 0) if @target_index < 0 org_target = [opponents_unit.random_target] * num new_targets = make_new_targets(org_target,0) else org_target = [opponents_unit.smooth_target(@target_index)] * num new_targets = make_new_targets(org_target,0) end else return (opponents_unit.alive_members + friends_unit.alive_members) if all_targets return opponents_unit.alive_members end end #-------------------------------------------------------------------------- # * All Targets #-------------------------------------------------------------------------- def all_targets return true if @item.object.note =~ /<All Targets>/ return false end #-------------------------------------------------------------------------- # * Targets for Allies #-------------------------------------------------------------------------- def targets_for_friends if item.for_user? new_targets = make_new_targets([subject],1) elsif item.for_dead_friend? if item.for_one? org_target = [friends_unit.smooth_dead_target(@target_index)] new_targets = make_new_targets(org_target,2) else org_target = friends_unit.dead_members new_targets = make_new_targets(org_target,2) end elsif item.for_friend? if item.for_one? org_target = [friends_unit.smooth_target(@target_index)] new_targets = make_new_targets(org_target,1) else return (opponents_unit.alive_members + friends_unit.alive_members) if all_targets return friends_unit.alive_members end end end #-------------------------------------------------------------------------- # * Make New Targets #-------------------------------------------------------------------------- def make_new_targets(target,type = 0) targets = [] if all_targets members = (opponents_unit.alive_members + friends_unit.alive_members) if type <= 1 members = friends_unit.dead_members if type == 2 else members = opponents_unit.alive_members if type == 0 members = friends_unit.alive_members if type == 1 members = friends_unit.dead_members if type == 2 end for t in target for m in members targets.push(m) if t == m next if t == m (targets.push(m); m.sprite_size[2] = false) if scope_range?(t,m) end end return targets end #-------------------------------------------------------------------------- # * Scope Range #-------------------------------------------------------------------------- def scope_range?(user,target) t_r2 = [user.screen_x, user.screen_y] rescue nil t_r3 = [target.screen_x, target.screen_y] rescue nil return false if t_r2 == nil or t_r3 == nil s_r = [0,0,0,0] ; s_p = [0,0] s_r = [$1.to_i,$2.to_i,$3.to_i,$4.to_i] if @item.object.note =~ /<Scope Range = (\d+) - (\d+) - (\d+) - (\d+)>/ return false if s_r == [0,0,0,0] if SCOPE_TYPE > 0 s_p = [target.sprite_size[0] / 2, target.sprite_size[1]] s_p[0] = s_p[0] * SPRITE_SIZE_RANGE[0] / 100 s_p[1] = s_p[1] * SPRITE_SIZE_RANGE[1] / 100 end return false if !t_r3[0].between?(t_r2[0] - (s_r[0] + s_p[0]), t_r2[0] + (s_r[1] + s_p[0])) return false if !t_r3[1].between?(t_r2[1] - s_r[2], t_r2[1] + s_r[3] + s_p[1]) return true end end
alexncf125 发表于 2021-2-15 21:51
我这边测不出有问题...
看完两个脚本的代码也看不到会有问题...
所以可否提供问题工程看一下是怎样子的问题 ...
QQ截图20210215235159.png (55.26 KB, 下载次数: 29)
SDGIF_Rusult_1.gif (1.77 MB, 下载次数: 26)
SDGIF_Rusult_2.gif (1.63 MB, 下载次数: 25)
alexncf125 发表于 2021-2-16 00:19
哦哦...我看到问题了...
虽然不知道原理...不过好像把那句wait(40)注释/删掉就可以了... ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |