当サイトの運営者です。ゲーム制作とプラグイン開発が好きで、コミュニティに貢献したいと考えています。
RPGツクールMZでゲームを制作中です。
※プログラマ・エンジニアではありません。
YEP Event Chase Player - YEP_EventChasePlayer.js

▼YEP Event Chase Player(Yanfly様作) - YEP_EventChasePlayer.js
https://plugin.fungamemake.com/archives/10630
プレイヤーが近づくと追いかけてきたり逃げたりするイベントを設定
ふりがな:いべんとちぇいすぷれいやー
機能概要: プレイヤーが近づくと追いかけてきたり逃げたりするイベントを設定
利用規約(ライセンス):http://www.yanfly.moe/wiki/Category:Yanfly_Engine_Plugi…
作者:Yanfly
作者サイト:http://yanfly.moe/
解説ページ:https://fungamemake.com/archives/191
ダウンロードページ:http://yanfly.moe/2015/10/21/yep-20-event-chase-player/
ファイル名:YEP_EventChasePlayer.js
備考:準公式採用プラグインのアップデート
プラグインのヘルプ:
/*:ja * @plugindesc v1.07 プレイヤーが特定のイベントに近づくと、イベントがプレイヤーを追いかけたりプレイヤーから逃げます * @author Yanfly Engine Plugins * * @param Sight Lock * @type number * @min 0 * @desc 'SeePlayer'がtrueの時、イベントがプレイヤーを追いかける時間(フレーム単位) * @default 300 * * @param See Player * @type boolean * @on 必要 * @off 不要 * @desc イベントがプレイヤーを認識するかを設定 * 不要 - false 必要 - true * @default true * * @param Alert Timer * @type number * @min 0 * @desc 同じイベント上でフキダシ表示までにかかるフレーム数 * @default 120 * * @param Alert Balloon * @type number * @min 0 * @desc プレイヤーが認識された際の表示フキダシ。フキダシIDで指定 * @default 1 * * @param Alert Sound * @type file * @dir audio/se/ * @require 1 * @desc プレイヤーが認識された際のサウンドを指定 * @default Attack1 * * @param Alert Common Event * @type common_event * @desc 認識された際に呼び出されるコモンイベントを指定 * 利用しない場合は、0 * @default 0 * * @param Return After * @type boolean * @on はい * @off いいえ * @desc 追跡または逃走した後に、イベントが元の位置に戻しますか? * いいえ - false はい - true * @default true * * @param Return Wait * @type number * @min 0 * @desc 追跡または逃走したあとに、待機するフレーム数を指定 * @default 180 * * @help * 翻訳:ムノクラ * https://munokura.tk/ * https://twitter.com/munokura/ * * ============================================================================ * Introduction * ============================================================================ * * このプラグインでは、プレイヤーを追いかけるイベントや、 * プレイヤーから逃げるイベントを作成することができます。 * プレイヤーがイベントから一定の距離範囲内に入った時や * イベントがプレイヤーを認識した際に発動させることができます。 * * ============================================================================ * How to Use * ============================================================================ * * 下記のコードをイベント内の * 「自律移動>タイプ:カスタム>ルート>スクリプト…」へ挿入することで、 * そのイベントに追跡もしくは逃走のフラグを付与することができます。 * * 注:プレイヤーに対しては無効です。 * * Script Call lines * this._chaseRange = x * →x の距離内に入った時、イベントがプレイヤーを追いかけます * this._fleeRange = x * →x の距離内に入った時、イベントはプレイヤーから逃げます * this._chaseSpeed = x * →追いかける時のイベントの速度 x を決定します * this._fleeSpeed = x * →逃げる時のイベントの速度 x を決定します * this._sightLock = x * →イベントは、フレーム数 x だけ追跡/逃走を行います * this._seePlayer = true * →イベントはプレイヤーを認識する必要があります * this._seePlayer = false * →イベントはプレイヤーを認識する必要がありません * this._alertBalloon = x * →プレイヤーが認識されると、x というフキダシを表示します * this._alertSound = x * →プレイヤーが認識されると、x というサウンドを再生します * this._alertSoundVol = x * →プレイヤーが認識されたときに再生される音の音量を指定します * this._alertSoundPitch = x * →プレイヤーが認識されたときに再生される音のピッチを指定します * this._alertSoundPan = x * →プレイヤーが認識されたときに再生される音のパンを指定します * this._alertCommonEvent = x * →プレイヤーが認識されると、x というイベントを再生します * this._returnAfter = true * →イベントを元の位置に戻します * this._returnAfter = false * →追跡/逃走が終わってもイベントはそこにとどまります * this._returnWait = x * →追跡/逃走が終わったあと x の間待機します * * カスタムした移動ルート内でイベントを再生させる際は、 * 移動頻度はなるべく高く設定するようにしてください。 * 設定が完了し有効になるまでは、これらのエフェクトは発動しません。 * 移動頻度の低いイベントですと、マップロード中に'this._chaseRange = x'の * 読み込みを完了できず、プレイヤーを追いかけなくなってしまう可能性があります。 * * ============================================================================ * Changelog * ============================================================================ * * Version 1.07: * - Added a background mechanic to stagger an event if they're chasing the * player and get caught behind an object. This will prevent the event from * continuously chasing the player and dropping the FPS rate. * * Version 1.06: * - Updated for RPG Maker MV version 1.5.0. * * Version 1.05: * - Optimization update. * * Version 1.04: * - Fixed a bug with this._seePlayer causing them to see stealthed players. * * Version 1.03: * - Improved pathfinding for chasing events. They will get stuck less by walls * and/or events that may be blocking the event. * - Added random factor for fleeing events. Fleeing events won't simply just * run away 180 degrees away from the player. They will sometimes move in a * random direction. * * Version 1.02: * - Added 'Return After' parameter where events will return to their original * spot after chasing/fleeing from a player. * - Added 'Return Wait' parameter to determine how long an event will wait in * place before returning after a finished chase/flee. * - Added 'this._returnAfter' and 'this._returnWait' to the list of available * movement route script calls. * * Version 1.01: * - Added 'this._alertSoundPitch' 'this._alertSoundVol' 'this._alertSoundPan' * to the settings you can alter to adjust the alert sound. * * Version 1.00: * - Finished Plugin! */