HOME
ツクール
RGSS
テクニック
ゲーム紹介
制作中のゲーム
ダウンロード
掲示板
ブログ
EnDREss DREamERブログ
PCパーツ・ソフト通販(仮)
DIYチューンブログ
リンク
スキル使用前コモン
コンセプト
魔法の詠唱などの演出を簡単に行いたい!
挿入位置
▼ 他の戦闘系イベントより下に。
完成すると
「使用前コモン」と入れるとスキル使用前にコモンイベントを実行する。何もしていない場合は通常通りの動作をする。
更新履歴
2/25:スキル使用前コモンの処理周りを修正。 ========== 2011年 ============================================================ 8/16:敵キャラIDが変数に正常に格納されていなかったのを修正。 ========== 2010年 ============================================================ 6/6:行動中のアクター及びエネミーID・ターゲットのIDを取得可能に。 ========== 2009年 ============================================================ 11/20:スキル使用前と後と2回実行できるように機能追加。 ========== 2008年 ============================================================
#============================================================================== # ?VX RGSS2 「スキル使用前コモン」? # EnDlEss DREamER # URL:http://mitsu-evo.6.ql.bz/ # 製作者 mitsu-evo # Last:2011/2/25 # データベース「スキル」設定のコモンイベントをスキル使用前に実行する。 # ▼ 他の戦闘系イベントより下に。 #============================================================================== $ed_rgss2 = {} if $ed_rgss2 == nil $ed_rgss2["ed_skill_common"] = true # 使い方:スキルのメモ欄に「使用前コモン」と記入。(「」はいらない。) =begin 2/25:スキル使用前コモンの処理周りを修正。 使い方 ・スキルメモ欄に「使用前コモン」と入れておくと そのスキルのコモンイベントはスキル使用前の実行されます。 「END_SKILL_COMMON」が「true」の場合は使用後も実行されます。 ・アクター及びエネミーのIDをイベントコマンドの変数に格納します。 ・対象キャラのIDとは「アクターID」及び「エネミーID」です。 コモンイベントの組み方によって、特定の敵や味方の時にのみ 会話や演出を行うことが出来るようになります。 ・敵キャラIDなので複数の同じ敵の場合は全員が対象となります。 ボス戦など同じ敵が複数出現しない場合などに有効です。 =end module ED SKILL_COMMON = "使用前コモン" END_SKILL_COMMON = false # スキル使用前と使用後にコモン発生 ACTIVE_ACTOR = 6 # 行動中のアクターID格納変数 ACTIVE_ENEMY = 7 # 行動中のエネミーID格納変数 ACTIVE_TARGET = 8 # 対象キャラID格納変数 # 全体なら対象キャラIDは「9999」になる。 end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ # 敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias ed_skill_common_initialize initialize def initialize # スキル使用前コモン用のインタプリンタ @skill_common_interpreter = Game_Interpreter.new ed_skill_common_initialize end #-------------------------------------------------------------------------- # ● スキル使用前コモンイベントの取得 #-------------------------------------------------------------------------- def skill_common_interpreter return @skill_common_interpreter end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- alias ed_skill_common_clear clear def clear ed_skill_common_clear @skill_common_interpreter.clear unless @skill_common_interpreter == nil end #-------------------------------------------------------------------------- # ● スキル使用前コモンイベントのセットアップ #-------------------------------------------------------------------------- def setup_skill_common_event return if @skill_common_interpreter.running? if $game_temp.common_event_id > 0 common_event = $data_common_events[$game_temp.common_event_id] @skill_common_interpreter.setup(common_event.list) $game_temp.common_event_id = 0 return end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ # バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 戦闘行動の実行 #-------------------------------------------------------------------------- alias ed_skill_common_execute_action execute_action def execute_action unless @active_battler == nil if @active_battler.actor? $game_variables[ED::ACTIVE_ACTOR] = @active_battler.id else $game_variables[ED::ACTIVE_ENEMY] = @active_battler.enemy_id end end ed_skill_common_execute_action end #-------------------------------------------------------------------------- # ● バトルイベントの処理 #-------------------------------------------------------------------------- def skill_battle_event_update loop do return if judge_win_loss return if $game_temp.next_scene != nil $game_troop.skill_common_interpreter.update $game_troop.setup_skill_common_event wait_for_message process_action if $game_troop.forcing_battler != nil return unless $game_troop.skill_common_interpreter.running? update_basic end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : スキル #-------------------------------------------------------------------------- def execute_action_skill skill = @active_battler.action.skill text = @active_battler.name + skill.message1 targets = @active_battler.action.make_targets # ターゲットのID取得 if targets.size == 1 for ed_target in targets if ed_target.actor? $game_variables[ED::ACTIVE_TARGET] = ed_target.id else $game_variables[ED::ACTIVE_TARGET] = ed_target.enemy_id end end else $game_variables[ED::ACTIVE_TARGET] = 9999 end skill_common = skill.note.scan(/#{ED::SKILL_COMMON}/) skill_common = skill_common.flatten skill_common = skill_common[0].to_s # スキル使用前にコモンイベント実行 if skill_common != nil and not skill_common.empty? $game_temp.common_event_id = skill.common_event_id skill_battle_event_update @message_window.dispose @message_window = Window_BattleMessage.new end @message_window.add_instant_text(text) unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end display_animation(targets, skill.animation_id) @active_battler.mp -= @active_battler.calc_mp_cost(skill) # 通常通りにスキルコモンイベント実行 if skill_common == nil or skill_common == "" or ED::END_SKILL_COMMON == true $game_temp.common_event_id = skill.common_event_id end for target in targets target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end end end
Copyright (C)
永遠の夢に向かって
. All Rights Reserved.
テンプレートのpondt
リサーチ