查看: 2605|回复: 6

[已经过期] 有啥办法可以做到回避明雷遇敌么!

[复制链接]
梦石
0
星屑
7994
在线时间
1319 小时
注册时间
2006-7-18
回帖
459
发表于 2018-1-24 13:25:46 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
设定的遇敌方式是明雷的,怪物是主动向主角靠近!
为此制作了一个技能“潜行”,潜行中人物会半透明显示,100步后恢复正常!
以上都弄出来了!问题来了!
如何能做到:
潜行中怪不会往主角这靠近?
或者潜行中即使碰到怪也不会触发战斗?
或者潜行中碰不到怪直接穿透!
如何能做到三种方式的其中一种?
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2018-1-24 13:32:35 | 显示全部楼层
3公共事件>设定移动路线>开启穿透..
回复

使用道具 举报

梦石
0
星屑
7994
在线时间
1319 小时
注册时间
2006-7-18
回帖
459
 楼主| 发表于 2018-1-24 13:35:00 | 显示全部楼层
soulsaga 发表于 2018-1-24 13:32
3公共事件>设定移动路线>开启穿透..

试过的!开启穿透的话,连建筑物也能穿透了!所以方案PASS
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2018-1-24 13:38:58 | 显示全部楼层
本帖最后由 soulsaga 于 2018-1-24 13:40 编辑
雷影 发表于 2018-1-24 13:35
试过的!开启穿透的话,连建筑物也能穿透了!所以方案PASS


2怪物事件条件分岐判断玩家使用潛行打开的开关中不进入战斗..

潛行中开关打开..潛行结束开关关闭

点评

!!!对哦!只想着从人物上入手,忘了可以在怪物事件上搞了!  发表于 2018-1-24 13:44
1新建一个事件页,潛行开关打开怪物随机移动..  发表于 2018-1-24 13:44
回复

使用道具 举报

梦石
0
星屑
3557
在线时间
2337 小时
注册时间
2015-8-25
回帖
928

开拓者

发表于 2018-1-25 13:07:36 | 显示全部楼层
推荐一个脚本。
★ シンボルエンカウント補助 ★
代码
  1. =begin
  2.       RGSS3
  3.       
  4.       ★ シンボルエンカウント補助 ★

  5.       イベントでのシンボルエンカウントの動作を補助します。
  6.       
  7.       ● 仕様 ●==========================================================
  8.       シンボルエンカウント有効後は、
  9.       イベントページの自律移動の項で設定されたものは全て無効になります。
  10.       --------------------------------------------------------------------
  11.       一度有効になったシンボルエンカウントを無効にするには、
  12.       シンボルエンカウント設定のないイベントページに切り替えてください。
  13.       ====================================================================
  14.       
  15.       ● 機能 ●==========================================================
  16.       シンボルエンカウントイベントから戦闘を起動した場合、
  17.       シンボルとプレイヤーの位置関係により先制攻撃or不意打ちが発生します。
  18.           ・イベントの背後を取った場合           => 先制攻撃
  19.           ・イベントに背後を取られた場合         => 不意打ち
  20.           ・イベントが隊列の最後尾に接触した場合 => 不意打ち
  21.       --------------------------------------------------------------------
  22.       プレイヤーとの距離が一定内になるとプレイヤーを追跡するようになります。
  23.       --------------------------------------------------------------------
  24.       プレイヤーとの距離によりシンボルの透明度を変化させることができます。
  25.       --------------------------------------------------------------------
  26.       プレイヤーのレベルによりシンボルが逃走したりします。
  27.       --------------------------------------------------------------------
  28.       ダッシュしているとシンボルが反応しやすくなったりします。
  29.       --------------------------------------------------------------------
  30.       シンボルが反応した瞬間フキダシアイコンが表示されたりします。
  31.       --------------------------------------------------------------------
  32.       シンボルが反応しなくなるアイテムやスキルを作ることができます。
  33.       --------------------------------------------------------------------
  34.       シンボルが通行できないリージョンを設定することができます。
  35.       ====================================================================
  36.       
  37.       ● シンボルエンカウントイベントの設定方法 ●========================
  38.       シンボルの動作を設定箇所にてあらかじめ定義しておきます。
  39.       --------------------------------------------------------------------
  40.       イベント>自律移動>頻度を最高に設定してください。
  41.       --------------------------------------------------------------------
  42.       イベント>自律移動>カスタム>移動ルート>スクリプトに
  43.         enable_symbol_encount(id)
  44.       と記述します。idには設定箇所で定義したものを指定します。
  45.       --------------------------------------------------------------------
  46.       後はイベントのトリガーを"イベントから接触"にして戦闘を起動するだけ!
  47.       ====================================================================
  48.       
  49.       ● ステルス機能について ●==========================================
  50.       メモ欄に「ステルス:n」と記述されたスキル・アイテムを使用すると
  51.       ステルス状態となり、一定期間シンボルが反応しなくなります。
  52.       nにはステルス状態が維持されるプレイヤーの歩数を指定します。
  53.       --------------------------------------------------------------------
  54.       イベントのスクリプトから下記のコードを実行することで、
  55.       ステルスを強制的に解除することができます。
  56.         reset_stealth
  57.       --------------------------------------------------------------------
  58.       操作キャラクターの変更時や、シナリオ上で長い時間が経過した際などに
  59.       使用してください。
  60.       ====================================================================
  61.       
  62.       ● 注意 ●==========================================================
  63.       ニューゲームから始めないとエラーを吐きます。
  64.       ====================================================================
  65.       
  66.       ver1.01

  67.       Last Update : 2012/03/04
  68.       03/04 : 追跡中のイベントが存在する際にイベントが発生すると、
  69.               追跡状態がおかしくなる不具合を修正
  70.       ----------------------2012--------------------------
  71.       12/23 : RGSS2からの移植
  72.       ----------------------2011--------------------------
  73.       
  74.       ろかん   http://kaisou-ryouiki.sakura.ne.jp/
  75. =end

  76. #===================================
  77. #  ●設定箇所
  78. #===================================
  79. module SymbolEncount
  80.   # 隊列がシンボルと接触した場合、イベントを起動するかどうか
  81.   FOLLOWER_CONTACT = true
  82.   
  83.   # シンボルエンカウントの設定をあらかじめ定義
  84.   SYMBOL_SETTING_LIST = {
  85.     #-----------------------------------------------------------
  86.     0 => [
  87.           # シンボルが逃げるプレイヤーレベル
  88.           #   0が設定されている場合逃走しません
  89.           #玩家多少级别时候敌人会逃走
  90.           0,
  91.           # プレイヤーレベルの判断種別
  92.           #   0:平均レベル、1:最大レベル、2:先頭メンバーのレベル
  93.           #判断等级的方式,0:队伍平均,1:队伍成员最高等级,2:领队的等级
  94.           0,
  95.           # シンボルが反応するプレイヤーとの距離
  96.           #敌人产生反应的距离
  97.           3,
  98.           # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  99.           #敌人产生反应的距离(奔跑时)
  100.           6,
  101.           # プレイヤーに反応していない時の移動パターン
  102.           #   0:ランダム移動、1:停止
  103.           #不追击玩家时,敌人的行动
  104.           #0:随机移动,1:不动
  105.           0,
  106.           # 透明度の変化するプレイヤーとの距離
  107.           #   ここで指定した距離よりもシンボルから遠ざかることで
  108.           #   シンボルが少しずつ見えにくくなっていきます。
  109.           #   0が設定されている場合この機能は無効になります。
  110.           #透明度变化与玩家距离之间的关系。
  111.           #0:无效
  112.           #否则,越远越透明
  113.           0,
  114.           # 反応前の移動速度
  115.          
  116.           # 未开始追击玩家前的速度
  117.           #   1:1/8倍速、2:1/4倍速、3:1/2倍速、4:標準速、5:2倍速、6:4倍速
  118.          
  119.           3,
  120.           # 反応後の移動速度
  121.          
  122.           # 开始追击玩家的移动速度
  123.           #   1:1/8倍速、2:1/4倍速、3:1/2倍速、4:標準速、5:2倍速、6:4倍速
  124.           4,
  125.           # 反応前の移動頻度
  126.           #   1:最低、2:低、3:通常、4:高、5:最高
  127.           5,
  128.           # 反応後の移動頻度
  129.           #   1:最低、2:低、3:通常、4:高、5:最高
  130.           5,
  131.           # 反応時に再生するフキダシアイコンID
  132.           #   0が設定されている場合この機能は無効になります。
  133.           #做出反应时显示的图标id
  134.           #0是封印这个效果
  135.           1,
  136.           # シンボルが通行することのできないリージョンID
  137.           # 配列形式で指定してください。
  138.           #敌人不能通过的区域id
  139.           []
  140.          ],
  141.     #警備兵------------------------------------------------
  142.     1 => [
  143.           0, # シンボルが逃げるプレイヤーレベル
  144.           0, # プレイヤーレベルの判断種別
  145.           6, # シンボルが反応するプレイヤーとの距離
  146.           6, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  147.           1, # プレイヤーに反応していない時の移動パターン
  148.           0, # 透明度の変化するプレイヤーとの距離
  149.           3, # 反応前の移動速度
  150.           6, # 反応後の移動速度
  151.           5, # 反応前の移動頻度
  152.           5, # 反応後の移動頻度
  153.           1, # 反応時に再生するフキダシアイコンID
  154.           [] # シンボルが移動することのできないリージョンID
  155.          ],
  156.     #番兵-------------------------------
  157.     2 => [
  158.           0, # シンボルが逃げるプレイヤーレベル
  159.           0, # プレイヤーレベルの判断種別
  160.           6, # シンボルが反応するプレイヤーとの距離
  161.           6, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  162.           0, # プレイヤーに反応していない時の移動パターン
  163.           0, # 透明度の変化するプレイヤーとの距離
  164.           5, # 反応前の移動速度
  165.           6, # 反応後の移動速度
  166.           5, # 反応前の移動頻度
  167.           5, # 反応後の移動頻度
  168.           1, # 反応時に再生するフキダシアイコンID
  169.           [] # シンボルが移動することのできないリージョンID
  170.          ],
  171.     #Lv10までのモンスター----------------------------------------------------
  172.     3 => [
  173.           10, # シンボルが逃げるプレイヤーレベル
  174.           0, # プレイヤーレベルの判断種別
  175.           3, # シンボルが反応するプレイヤーとの距離
  176.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  177.           0, # プレイヤーに反応していない時の移動パターン
  178.           0, # 透明度の変化するプレイヤーとの距離
  179.           3, # 反応前の移動速度
  180.           4, # 反応後の移動速度
  181.           5, # 反応前の移動頻度
  182.           5, # 反応後の移動頻度
  183.           1, # 反応時に再生するフキダシアイコンID
  184.           [] # シンボルが移動することのできないリージョンID
  185.          ],
  186.     #Lv18までのモンスター----------------------------------------------------
  187.     4 => [
  188.           18, # シンボルが逃げるプレイヤーレベル
  189.           0, # プレイヤーレベルの判断種別
  190.           3, # シンボルが反応するプレイヤーとの距離
  191.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  192.           0, # プレイヤーに反応していない時の移動パターン
  193.           0, # 透明度の変化するプレイヤーとの距離
  194.           3, # 反応前の移動速度
  195.           4, # 反応後の移動速度
  196.           5, # 反応前の移動頻度
  197.           5, # 反応後の移動頻度
  198.           1, # 反応時に再生するフキダシアイコンID
  199.           [] # シンボルが移動することのできないリージョンID
  200.          ],
  201.     #Lv27までのモンスター----------------------------------------------------
  202.     5 => [
  203.           27, # シンボルが逃げるプレイヤーレベル
  204.           0, # プレイヤーレベルの判断種別
  205.           3, # シンボルが反応するプレイヤーとの距離
  206.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  207.           0, # プレイヤーに反応していない時の移動パターン
  208.           0, # 透明度の変化するプレイヤーとの距離
  209.           3, # 反応前の移動速度
  210.           4, # 反応後の移動速度
  211.           5, # 反応前の移動頻度
  212.           5, # 反応後の移動頻度
  213.           1, # 反応時に再生するフキダシアイコンID
  214.           [] # シンボルが移動することのできないリージョンID
  215.          ],
  216.     #Lv35までのモンスター----------------------------------------------------
  217.     6 => [
  218.           35, # シンボルが逃げるプレイヤーレベル
  219.           0, # プレイヤーレベルの判断種別
  220.           3, # シンボルが反応するプレイヤーとの距離
  221.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  222.           0, # プレイヤーに反応していない時の移動パターン
  223.           0, # 透明度の変化するプレイヤーとの距離
  224.           3, # 反応前の移動速度
  225.           4, # 反応後の移動速度
  226.           5, # 反応前の移動頻度
  227.           5, # 反応後の移動頻度
  228.           1, # 反応時に再生するフキダシアイコンID
  229.           [] # シンボルが移動することのできないリージョンID
  230.          ],
  231.     #制限なしモンスター----------------------------------------------------
  232.     7 => [
  233.           0, # シンボルが逃げるプレイヤーレベル
  234.           0, # プレイヤーレベルの判断種別
  235.           3, # シンボルが反応するプレイヤーとの距離
  236.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  237.           0, # プレイヤーに反応していない時の移動パターン
  238.           0, # 透明度の変化するプレイヤーとの距離
  239.           3, # 反応前の移動速度
  240.           4, # 反応後の移動速度
  241.           5, # 反応前の移動頻度
  242.           5, # 反応後の移動頻度
  243.           1, # 反応時に再生するフキダシアイコンID
  244.           [] # シンボルが移動することのできないリージョンID
  245.          ],
  246.     #山賊----------------------------------------------------
  247.     8 => [
  248.           0, # シンボルが逃げるプレイヤーレベル
  249.           0, # プレイヤーレベルの判断種別
  250.           3, # シンボルが反応するプレイヤーとの距離
  251.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  252.           0, # プレイヤーに反応していない時の移動パターン
  253.           0, # 透明度の変化するプレイヤーとの距離
  254.           3, # 反応前の移動速度
  255.           5, # 反応後の移動速度
  256.           5, # 反応前の移動頻度
  257.           5, # 反応後の移動頻度
  258.           1, # 反応時に再生するフキダシアイコンID
  259.           [] # シンボルが移動することのできないリージョンID
  260.          ],
  261.     #ノトーリアスモンスター-----------------------------------
  262.     9 => [
  263.           0, # シンボルが逃げるプレイヤーレベル
  264.           0, # プレイヤーレベルの判断種別
  265.           3, # シンボルが反応するプレイヤーとの距離
  266.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  267.           0, # プレイヤーに反応していない時の移動パターン
  268.           0, # 透明度の変化するプレイヤーとの距離
  269.           2, # 反応前の移動速度
  270.           4, # 反応後の移動速度
  271.           5, # 反応前の移動頻度
  272.           5, # 反応後の移動頻度
  273.           1, # 反応時に再生するフキダシアイコンID
  274.           [] # シンボルが移動することのできないリージョンID
  275.          ],
  276.     #警備兵(徘徊)------------------------------------------------
  277.     10 => [
  278.           0, # シンボルが逃げるプレイヤーレベル
  279.           0, # プレイヤーレベルの判断種別
  280.           5, # シンボルが反応するプレイヤーとの距離
  281.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  282.           0, # プレイヤーに反応していない時の移動パターン
  283.           0, # 透明度の変化するプレイヤーとの距離
  284.           2, # 反応前の移動速度
  285.           5, # 反応後の移動速度
  286.           5, # 反応前の移動頻度
  287.           5, # 反応後の移動頻度
  288.           1, # 反応時に再生するフキダシアイコンID
  289.           [] # シンボルが移動することのできないリージョンID
  290.          ],
  291.     #Lv42までのモンスター----------------------------------------------------
  292.     11 => [
  293.           42, # シンボルが逃げるプレイヤーレベル
  294.           0, # プレイヤーレベルの判断種別
  295.           3, # シンボルが反応するプレイヤーとの距離
  296.           5, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  297.           0, # プレイヤーに反応していない時の移動パターン
  298.           0, # 透明度の変化するプレイヤーとの距離
  299.           3, # 反応前の移動速度
  300.           4, # 反応後の移動速度
  301.           5, # 反応前の移動頻度
  302.           5, # 反応後の移動頻度
  303.           1, # 反応時に再生するフキダシアイコンID
  304.           [] # シンボルが移動することのできないリージョンID
  305.          ],
  306.     #看守------------------------------------------------
  307.     12 => [
  308.           0, # シンボルが逃げるプレイヤーレベル
  309.           0, # プレイヤーレベルの判断種別
  310.           3, # シンボルが反応するプレイヤーとの距離
  311.           6, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  312.           1, # プレイヤーに反応していない時の移動パターン
  313.           0, # 透明度の変化するプレイヤーとの距離
  314.           3, # 反応前の移動速度
  315.           4, # 反応後の移動速度
  316.           5, # 反応前の移動頻度
  317.           5, # 反応後の移動頻度
  318.           1, # 反応時に再生するフキダシアイコンID
  319.           [] # シンボルが移動することのできないリージョンID
  320.          ],
  321.     #高速接近------------------------------------------------
  322.     13 => [
  323.           0, # シンボルが逃げるプレイヤーレベル
  324.           0, # プレイヤーレベルの判断種別
  325.           3, # シンボルが反応するプレイヤーとの距離
  326.           3, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  327.           0, # プレイヤーに反応していない時の移動パターン
  328.           0, # 透明度の変化するプレイヤーとの距離
  329.           5, # 反応前の移動速度
  330.           5, # 反応後の移動速度
  331.           5, # 反応前の移動頻度
  332.           5, # 反応後の移動頻度
  333.           1, # 反応時に再生するフキダシアイコンID
  334.           [] # シンボルが移動することのできないリージョンID
  335.          ],
  336.     #宝飾店店主------------------------------------------------
  337.     14 => [
  338.           0, # シンボルが逃げるプレイヤーレベル
  339.           0, # プレイヤーレベルの判断種別
  340.           4, # シンボルが反応するプレイヤーとの距離
  341.           4, # シンボルが反応するプレイヤーとの距離(プレイヤーダッシュ時)
  342.           1, # プレイヤーに反応していない時の移動パターン
  343.           0, # 透明度の変化するプレイヤーとの距離
  344.           5, # 反応前の移動速度
  345.           6, # 反応後の移動速度
  346.           5, # 反応前の移動頻度
  347.           5, # 反応後の移動頻度
  348.           1, # 反応時に再生するフキダシアイコンID
  349.           [] # シンボルが移動することのできないリージョンID
  350.          ],
  351.   }
  352. end
  353. #===================================
  354. #  ここまで
  355. #===================================

  356. $rsi ||= {}
  357. $rsi["シンボルエンカウント補助"] = true

  358. class RPG::UsableItem < RPG::BaseItem
  359.   def stealth_obj_count
  360.     self.note.each_line{|line|
  361.       return $1.to_i if line =~ /ステルス:(\d+)/i
  362.     }
  363.     0
  364.   end
  365. end

  366. class << BattleManager
  367.   #--------------------------------------------------------------------------
  368.   # ● モジュールのインスタンス変数
  369.   #--------------------------------------------------------------------------
  370.   attr_writer   :run_event
  371.   @run_event = nil # 戦闘を呼び出したイベント
  372.   #--------------------------------------------------------------------------
  373.   # ● セットアップ
  374.   #--------------------------------------------------------------------------
  375.   alias _symbol_encount_setup setup
  376.   def setup(troop_id, can_escape = true, can_lose = false)
  377.     _symbol_encount_setup(troop_id, can_escape, can_lose)
  378.     set_battle_condition
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● シンボルエンカウントイベントから戦闘が呼び出されている場合の処理
  382.   #--------------------------------------------------------------------------
  383.   def set_battle_condition
  384.     if @run_event && @run_event.symbol_encount
  385.       @run_event.set_contact_condition
  386.       case @run_event.contact_condition
  387.       when 1
  388.         @preemptive = true
  389.       when 2
  390.         @surprise = true
  391.       end
  392.     end
  393.     @run_event = nil
  394.   end
  395. end

  396. class Game_Actor < Game_Battler
  397.   #--------------------------------------------------------------------------
  398.   # ● スキル/アイテムの使用
  399.   #--------------------------------------------------------------------------
  400.   def use_item(item)
  401.     stealth_effect(item)
  402.     super
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● ステルス効果の適用
  406.   #--------------------------------------------------------------------------
  407.   def stealth_effect(item)
  408.     result = item.stealth_obj_count
  409.     $game_player.stealth_count = result if result > 0
  410.   end
  411. end

  412. class Game_Party < Game_Unit
  413.   #--------------------------------------------------------------------------
  414.   # ● プレイヤーレベルの取得
  415.   #--------------------------------------------------------------------------
  416.   def get_player_level(type)
  417.     case type
  418.     when 0
  419.       members.inject(0){|r, actor| r += actor.level} / members.size
  420.     when 1
  421.       members.max_by{|actor| actor.level}
  422.     when 2
  423.       $game_party.members.first.level
  424.     end
  425.   end
  426. end

  427. class Game_Character < Game_CharacterBase
  428.   #--------------------------------------------------------------------------
  429.   # ● 非公開メンバ変数の初期化
  430.   #--------------------------------------------------------------------------
  431.   alias _symbol_init_private_members init_private_members
  432.   def init_private_members
  433.     _symbol_init_private_members
  434.     @origin_opacity = @opacity
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 移動コマンドの処理
  438.   #--------------------------------------------------------------------------
  439.   alias _symbol_process_move_command process_move_command
  440.   def process_move_command(command)
  441.     params = command.parameters
  442.     @origin_opacity = params[0] if command.code == ROUTE_CHANGE_OPACITY
  443.     _symbol_process_move_command(command)
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # ● 指定キャラクターとの位置関係を取得(接触していることを前提)
  447.   #--------------------------------------------------------------------------
  448.   def positional_relationship(character)
  449.     if character.real_x == real_x
  450.       character.real_y > real_y ? 1 : 0
  451.     elsif character.real_y == real_y
  452.       character.real_x > real_x ? 2 : 3
  453.     else
  454.       -1
  455.     end
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● シンボルエンカウント関連処理による透明度の更新
  459.   #--------------------------------------------------------------------------
  460.   def update_symbol_opacity
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● フレーム更新
  464.   #--------------------------------------------------------------------------
  465.   alias _symbol_opacity_update update
  466.   def update
  467.     _symbol_opacity_update
  468.     update_symbol_opacity
  469.   end
  470. end

  471. class Game_Player < Game_Character
  472.   #--------------------------------------------------------------------------
  473.   # ● 公開インスタンス変数
  474.   #--------------------------------------------------------------------------
  475.   attr_writer :stealth_count
  476.   #--------------------------------------------------------------------------
  477.   # ● 公開メンバ変数の初期化
  478.   #--------------------------------------------------------------------------
  479.   def init_public_members
  480.     super
  481.     reset_stealth
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● ステルス状態の初期化
  485.   #--------------------------------------------------------------------------
  486.   def reset_stealth
  487.     @stealth_count = 0
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● ステルス判定
  491.   #--------------------------------------------------------------------------
  492.   def stealth?
  493.     !@stealth_count.zero?
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # ● 歩数増加
  497.   #--------------------------------------------------------------------------
  498.   alias _increase_stealth_count increase_steps
  499.   def increase_steps
  500.     _increase_stealth_count
  501.     @stealth_count -= 1 if stealth?
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● シンボルエンカウント関連処理による透明度の更新
  505.   #--------------------------------------------------------------------------
  506.   def update_symbol_opacity
  507.     if stealth? && !$game_map.interpreter.running?
  508.       @opacity = 64 #規定値 128
  509.     else
  510.       @opacity = @origin_opacity
  511.     end
  512.   end
  513. end

  514. class Game_Follower < Game_Character
  515.   #--------------------------------------------------------------------------
  516.   # ● 公開インスタンス変数
  517.   #--------------------------------------------------------------------------
  518.   attr_reader :member_index
  519. end

  520. class Game_Event < Game_Character
  521.   #--------------------------------------------------------------------------
  522.   # ● インクルード SymbolEncount
  523.   #--------------------------------------------------------------------------
  524.   include SymbolEncount
  525.   #--------------------------------------------------------------------------
  526.   # ● 公開インスタンス変数
  527.   #--------------------------------------------------------------------------
  528.   attr_reader :symbol_encount
  529.   attr_reader :contact_condition
  530.   #--------------------------------------------------------------------------
  531.   # ● 非公開メンバ変数の初期化
  532.   #--------------------------------------------------------------------------
  533.   alias _symbol_encount_ini init_private_members
  534.   def init_private_members
  535.     _symbol_encount_ini
  536.     init_symbol_encount
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● イベントページのセットアップ
  540.   #--------------------------------------------------------------------------
  541.   alias _symbol_encount_setup_page setup_page
  542.   def setup_page(new_page)
  543.     init_symbol_encount
  544.     _symbol_encount_setup_page(new_page)
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ● シンボルエンカウントの初期化
  548.   #--------------------------------------------------------------------------
  549.   def init_symbol_encount
  550.     @forming = false
  551.     @symbol_encount = false
  552.     @symbol_away_level = 0
  553.     @symbol_away_level_type = 0
  554.     @reaction_distance = 0
  555.     @reaction_distance_with_dash = 0
  556.     @nonreaction_move_type = 0
  557.     @visibility_distance = 0
  558.     @reaction_before_speed = 0
  559.     @reaction_after_speed = 0
  560.     @reaction_before_speed = 0
  561.     @reaction_after_frequency = 0
  562.     @reaction_balloon_id = 0
  563.     @unpassable_region = []
  564.     @contact_index = -1
  565.     @contact_condition = 0
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # ● シンボルエンカウントを有効化
  569.   #--------------------------------------------------------------------------
  570.   def enable_symbol_encount(id)
  571.     data = SYMBOL_SETTING_LIST[id]
  572.     @symbol_encount = true
  573.     @symbol_away_level = data[0]
  574.     @symbol_away_level_type = data[1]
  575.     @reaction_distance = data[2]
  576.     @reaction_distance_with_dash = data[3]
  577.     @nonreaction_move_type = data[4]
  578.     @visibility_distance = data[5]
  579.     @reaction_before_speed = data[6]
  580.     @reaction_after_speed = data[7]
  581.     @reaction_before_frequency = data[8]
  582.     @reaction_after_frequency = data[9]
  583.     @reaction_balloon_id = data[10]
  584.     @unpassable_region = data[11].dup
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 通行可能判定
  588.   #--------------------------------------------------------------------------
  589.   def passable?(x, y, d)
  590.     if @symbol_encount
  591.       x2 = $game_map.round_x_with_direction(x, d)
  592.       y2 = $game_map.round_y_with_direction(y, d)
  593.       return false if @unpassable_region.include?($game_map.region_id(x2, y2))
  594.     end
  595.     super
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● ロック(実行中のイベントが立ち止まる処理) ※再定義
  599.   #--------------------------------------------------------------------------
  600.   def lock
  601.     unless @locked
  602.       @prelock_direction = @direction
  603.       turn_toward_player unless @symbol_encount
  604.       @locked = true
  605.     end
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● プレイヤーレベルの取得
  609.   #--------------------------------------------------------------------------
  610.   def player_level
  611.     $game_party.get_player_level(@symbol_away_level_type)
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● プレイヤーからの距離を取得
  615.   #--------------------------------------------------------------------------
  616.   def distance_from_player
  617.     distance_x_from($game_player.x).abs + distance_y_from($game_player.y).abs
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 指定キャラクターからの距離を取得
  621.   #--------------------------------------------------------------------------
  622.   def distance_from_character(character)
  623.     distance_x_from(character.x).abs + distance_y_from(character.y).abs
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● 反応するプレイヤーからの距離を取得
  627.   #--------------------------------------------------------------------------
  628.   def reaction_distance
  629.     if @forming
  630.       @reaction_distance_with_dash.next
  631.     elsif $game_player.dash? && $game_player.moving?
  632.       @reaction_distance_with_dash
  633.     else
  634.       @reaction_distance
  635.     end
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● シンボルエンカウントを動作させるか
  639.   #--------------------------------------------------------------------------
  640.   def active_symbol_encount?
  641.     if $game_map.interpreter.running?
  642.       false
  643.     elsif @erased || $game_player.stealth?
  644.       @forming = false
  645.       false
  646.     else
  647.       true
  648.     end
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ● プレイヤーと同じ方向を向いているか
  652.   #--------------------------------------------------------------------------
  653.   def direction_as_player?
  654.     direction == $game_player.direction
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 指定キャラクターとの簡易接触判定
  658.   #--------------------------------------------------------------------------
  659.   def contact?(character)
  660.     distance_from_character(character) <= 1
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● プレイヤーへの反応判定
  664.   #--------------------------------------------------------------------------
  665.   def reaction?
  666.     distance_from_player <= reaction_distance
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # ● プレイヤーからの逃走判定
  670.   #--------------------------------------------------------------------------
  671.   def away?
  672.     player_level > @symbol_away_level
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # ● 接触状況の判断
  676.   #--------------------------------------------------------------------------
  677.   def set_contact_condition
  678.     @contact_index = -1
  679.     @contact_condition = 0
  680.     if contact?($game_player)
  681.       @contact_index = 0
  682.     elsif FOLLOWER_CONTACT
  683.       $game_player.followers.visible_folloers.each{|follower|
  684.         @contact_index = follower.member_index if contact?(follower)
  685.       }
  686.     end
  687.     if @contact_index.zero?
  688.       @contact_condition = direction_and_positional
  689.     elsif $game_player.followers.visible_folloers.size == @contact_index
  690.       @contact_condition = 2
  691.     else
  692.       @contact_condition = 0
  693.     end
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # ● プレイヤーとの位置と向き関係から接触状況を取得
  697.   #--------------------------------------------------------------------------
  698.   def direction_and_positional
  699.     position = positional_relationship($game_player)
  700.     if position == -1
  701.       0
  702.     else
  703.       case direction
  704.       when 2
  705.         direction_as_player? ? (position == 0 ? 1 : 2) : 0
  706.       when 4
  707.         direction_as_player? ? (position == 2 ? 1 : 2) : 0
  708.       when 6
  709.         direction_as_player? ? (position == 3 ? 1 : 2) : 0
  710.       when 8
  711.         direction_as_player? ? (position == 1 ? 1 : 2) : 0
  712.       else
  713.         0
  714.       end
  715.     end
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● 接触イベントの起動判定
  719.   #--------------------------------------------------------------------------
  720.   alias _symbol_encount_trigger check_event_trigger_touch
  721.   def check_event_trigger_touch(x, y)
  722.     if @symbol_encount && FOLLOWER_CONTACT
  723.       unless $game_map.interpreter.running?
  724.         if @trigger == 2 && collide_with_player_characters?(x, y)
  725.           start unless jumping?
  726.         end
  727.       end
  728.     else
  729.       _symbol_encount_trigger(x, y)
  730.     end
  731.   end
  732.   #--------------------------------------------------------------------------
  733.   # ● 追跡の開始
  734.   #--------------------------------------------------------------------------
  735.   def start_forming
  736.     @move_speed = @reaction_after_speed
  737.     @move_frequency = @reaction_after_frequency
  738.     unless @reaction_balloon_id.zero?
  739.       Audio.se_play('Audio/SE/Decision1', 50, 150)
  740.       @balloon_id = @reaction_balloon_id
  741.     end
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # ● 追跡の終了(見失う)
  745.   #--------------------------------------------------------------------------
  746.   def end_forming
  747.     @move_speed = @reaction_before_speed
  748.     @move_frequency = @reaction_before_frequency
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # ● 反応している時の移動処理
  752.   #--------------------------------------------------------------------------
  753.   def reaction_movement
  754.     @move_speed = @reaction_after_speed
  755.     @move_frequency = @reaction_after_frequency
  756.     if @symbol_away_level.zero?
  757.       move_type_toward_player
  758.     elsif away?
  759.       move_away_from_player
  760.     else
  761.       move_type_toward_player
  762.     end
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ● 反応していない時の移動処理
  766.   #--------------------------------------------------------------------------
  767.   def nonreaction_movement
  768.     @move_speed = @reaction_before_speed
  769.     @move_frequency = @reaction_before_frequency
  770.     case @nonreaction_move_type
  771.     when 0
  772.       move_type_random
  773.     when 1
  774.     end
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ● フレーム更新
  778.   #--------------------------------------------------------------------------
  779.   alias _update_with_symbol update
  780.   def update
  781.     update_symbol_reaction if @symbol_encount && @wait_count <= 0 && !@move_route_forcing
  782.     _update_with_symbol
  783.   end
  784.   #--------------------------------------------------------------------------
  785.   # ● プレイヤーへの反応判定を更新
  786.   #--------------------------------------------------------------------------
  787.   def update_symbol_reaction
  788.     if active_symbol_encount?
  789.       if !@forming && reaction?
  790.         start_forming
  791.       elsif @forming && !reaction?
  792.         end_forming
  793.       end
  794.       @forming = reaction?
  795.     end
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # ● シンボルエンカウント関連処理による透明度の更新
  799.   #--------------------------------------------------------------------------
  800.   def update_symbol_opacity
  801.     if @visibility_distance.zero?
  802.       @opacity = @origin_opacity
  803.     else
  804.       @opacity = @origin_opacity - 50 * (distance_from_player - @visibility_distance)
  805.     end
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● 自律移動の更新
  809.   #--------------------------------------------------------------------------
  810.   alias _update_self_movement_with_symbol update_self_movement
  811.   def update_self_movement
  812.     if @symbol_encount
  813.       update_symbol_movement if near_the_screen? && @stop_count > stop_count_threshold
  814.     else
  815.       _update_self_movement_with_symbol
  816.     end
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # ● シンボルの動作を更新
  820.   #--------------------------------------------------------------------------
  821.   def update_symbol_movement
  822.     if near_the_screen? && @stop_count > stop_count_threshold
  823.       if active_symbol_encount?
  824.         @forming ? reaction_movement : nonreaction_movement
  825.       else
  826.         nonreaction_movement
  827.       end
  828.     end
  829.   end
  830. end

  831. class Game_Interpreter
  832.   #--------------------------------------------------------------------------
  833.   # ● バトルの処理
  834.   #--------------------------------------------------------------------------
  835.   alias _command_301_with_symbol_encount command_301
  836.   def command_301
  837.     unless $game_party.in_battle
  838.       BattleManager.run_event = $game_map.events[@event_id]
  839.       _command_301_with_symbol_encount
  840.     end
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # ● ステルス状態の解除
  844.   #--------------------------------------------------------------------------
  845.   def reset_stealth
  846.     $game_player.reset_stealth
  847.   end
  848. end
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部