/*:ja * @plugindesc v1.07 プレイヤーが近づくと、プレイヤーを追いかけたり、逃げるイベントを作成できます。 * @author Yanfly Engine Plugins * * @param Sight Lock * @text 追跡時間 * @type number * @max 9007 * @desc 'SeePlayer'がtrueの時、イベントがプレイヤーを追いかける時間(フレーム単位) * @default 300 * * @param See Player * @text プレイヤー認識有効化 * @type boolean * @on 有効 * @off 無効 * @desc イベントのプレイヤー認識を有効化 * 無効:false / 有効:true * @default true * * @param Alert Timer * @text 認識フキダシ表示時間 * @type number * @max 9007 * @desc イベントにフキダシ表示されるまでにかかるフレーム数 * @default 120 * * @param Alert Balloon * @text 表示フキダシ * @type select * @option 無効 * @value 0 * @option びっくり * @value 1 * @option はてな * @value 2 * @option 音符 * @value 3 * @option ハート * @value 4 * @option 怒り * @value 5 * @option 汗 * @value 6 * @option くしゃくしゃ * @value 7 * @option 沈黙 * @value 8 * @option 電球 * @value 9 * @option Zzz * @value 10 * @option ユーザ定義1 * @value 11 * @option ユーザ定義2 * @value 12 * @option ユーザ定義3 * @value 13 * @option ユーザ定義4 * @value 14 * @option ユーザ定義5 * @value 15 * @desc プレイヤー認識時に表示するフキダシを指定(フキダシID)利用しない場合、0 * @default 1 * * @param Alert Sound * @text 認識音 * @type file * @dir audio/se/ * @require 1 * @desc プレイヤー認識時に再生するSE * @default Attack1 * * @param Alert Common Event * @text 認識コモンイベント * @type common_event * @desc 認識時に実行するコモンイベント。利用しない場合、0 * @default 0 * * @param Return After * @text 追跡終了後動作 * @type boolean * @on 戻す * @off 終了時位置 * @desc 追跡/逃走後、イベントを元の位置に戻すか。終了時位置:false / 戻す:true * @default true * * @param Return Wait * @text 追跡終了後時間 * @type number * @max 9007 * @desc 追跡/逃走後、次の動作までのフレーム数 * @default 180 * * @help * 翻訳:ムノクラ * https://fungamemake.com/ * https://twitter.com/munokura/ * * =========================================================================== * 導入 * =========================================================================== * * このプラグインは、プレイヤーを追いかけるイベント、 * プレイヤーから逃げるイベントを作成することができます。 * プレイヤーがイベントから一定の距離範囲内に入った時や * イベントがプレイヤーを認識した際に発動させることができます。 * * =========================================================================== * 使用方法 * =========================================================================== * * イベントの自律移動タイプを「カスタム」にし、 * 「ルート…」内の「スクリプト…」内に次のコードを入れることで、 * そのイベントに追跡/逃走の指定ができます。 * * 注*プレイヤーに対しては無効です。 * * スクリプトの説明 * 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 * →プレイヤー認識時、フキダシID x を表示します * this._alertSound = x * →プレイヤー認識時、SE x を再生します * this._alertSoundVol = x * →プレイヤー認識時SEの音量を指定します * this._alertSoundPitch = x * →プレイヤー認識時SEのピッチを指定します * this._alertSoundPan = x * →プレイヤー認識時SEのパンを指定します * this._alertCommonEvent = x * →プレイヤー認識時、コモンイベントID 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! */