查看: 3080|回复: 9

[有事请教] 请问RMMV 怎 么实现 敌人视距???

[复制链接]
梦石
0
星屑
788
在线时间
109 小时
注册时间
2008-2-10
回帖
199
发表于 2017-11-6 09:13:56 | 显示全部楼层 |阅读模式

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

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

×
RMMV 怎 么实现 敌人视力范围???  当主角给NPC看见时触发事件


有没有这样的脚本 呢?      

h
梦石
0
星屑
2787
在线时间
216 小时
注册时间
2017-9-28
回帖
255
发表于 2017-11-6 11:39:55 | 显示全部楼层
可以去看看YEPRegionEvents
回复 1 0

使用道具 举报

梦石
0
星屑
788
在线时间
109 小时
注册时间
2008-2-10
回帖
199
 楼主| 发表于 2017-11-6 19:11:29 | 显示全部楼层
擦不完的水 发表于 2017-11-6 11:39
可以去看看YEPRegionEvents

谢谢·······
h
回复

使用道具 举报

梦石
0
星屑
788
在线时间
109 小时
注册时间
2008-2-10
回帖
199
 楼主| 发表于 2017-11-6 19:33:42 | 显示全部楼层
本帖最后由 花王子 于 2017-11-6 19:34 编辑
擦不完的水 发表于 2017-11-6 11:39
可以去看看YEPRegionEvents

看了说明 ,表示 不会用

介绍和说明
============================================================================

你可以在地图上标出255个区域。你可以设置它,以便
玩家踏上特定的区域,每次都会有一个普通的比赛项目。
他们踩了它。为此,将一个公共事件的ID绑定到
这个插件的参数。它会使任何瓷砖与此非常
特定区域id使用普通触发器触发玩家触摸事件
您已标记的事件id。

请记住,如果在触摸输入中发生任何常见事件,它将
清除游戏引擎的触摸输入。

============================================================================
notetags
============================================================================

你可以使用这个notetag在你的地图。

图notetags:
<区域X事件:y >
如果游戏者走到标有X区域的瓷砖上,它就会运行
常见事件y。这将覆盖标记中的默认设置。
编辑器专门针对该地图。

============================================================================
更新日志
============================================================================

1.02版:
-修正了如果鼠标按钮阻止区域事件触发的错误
比平常持有的时间长。

1.01a版:
-修正了一个错误的区域活动notetags,停止工作,如果是用
传送到同一张地图上。

1版:
-完成插件!
h
回复

使用道具 举报

梦石
0
星屑
788
在线时间
109 小时
注册时间
2008-2-10
回帖
199
 楼主| 发表于 2017-11-6 19:44:12 | 显示全部楼层
要怎么实现 敌人
视线、视野

点评

B站有YEP插件使用教程的,你自己搜下。  发表于 2017-11-6 21:43
h
回复

使用道具 举报

梦石
0
星屑
2787
在线时间
216 小时
注册时间
2017-9-28
回帖
255
发表于 2017-11-6 21:42:23 | 显示全部楼层
花王子 发表于 2017-11-6 19:44
要怎么实现 敌人
视线、视野

你可以试试在NPC前方弄一大块区域1,然后主角走上去触发YEP插件区域1的参数指定的事件序号。
这个插件应该是这样的吧,我没用过。还不行的话我再去自己操作一下再告诉你,虽然我也刚学没多久。
回复

使用道具 举报

梦石
0
星屑
7427
在线时间
948 小时
注册时间
2017-9-27
回帖
566
发表于 2017-11-6 21:55:13 | 显示全部楼层
  1. //=============================================================================
  2. // MOG_EventSensor.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.1) Event distance system.
  6. * @author Moghunter
  7. *
  8. * @param Self Switch Key
  9. * @desc Setting the Letter of SelfSwitch
  10. * @default D
  11. *
  12. * @help  
  13. * =============================================================================
  14. * +++ MOG - Event Sensor (v1.1) +++
  15. * By Moghunter
  16. * [url]https://atelierrgss.wordpress.com/[/url]
  17. * =============================================================================
  18. * Event distance system.
  19. * Depending on the distance between the player and the event, the predetermined
  20. * page of the event can be activated or not.
  21. * =============================================================================
  22. * To set the distance of the event sensor, place this comment in the event.
  23. *
  24. * event sensor : X
  25. *
  26. * =============================================================================
  27. * HISTORY
  28. * =============================================================================
  29. * (v1.1) - Change noteTag to standardize the form of commands.
  30. *
  31. */

  32. //=============================================================================
  33. // ** PLUGIN PARAMETERS
  34. //=============================================================================
  35.   
  36. var Imported = Imported || {};  
  37. Imported.MOG_EventSensor = true;  
  38. var Moghunter = Moghunter || {};

  39.  
  40. Moghunter.parameters = PluginManager.parameters('MOG_EventSensor');
  41. Moghunter.sensor_range_key = String(Moghunter.parameters['Self Switch Key'] || "D");

  42. //=============================================================================
  43. // ** Character Base
  44. //=============================================================================

  45. //==============================
  46. // * Init Members
  47. //==============================
  48. var _alias_mog_evensensor_cbase_initMembers = Game_CharacterBase.prototype.initMembers;
  49. Game_CharacterBase.prototype.initMembers = function() {
  50.     _alias_mog_evensensor_cbase_initMembers.call(this);
  51.     this._sensor_range = [false, 0];
  52. };

  53. //=============================================================================
  54. // ** Sprite Character
  55. //=============================================================================

  56. //==============================
  57. // * Initialize
  58. //==============================
  59. var _alias_mog_evensensor_schar_initialize = Sprite_Character.prototype.initialize;
  60. Sprite_Character.prototype.initialize = function(character) {
  61.     _alias_mog_evensensor_schar_initialize.call(this, character);
  62.     if (this._character && this._character._eventId) { this._character.check_event_sensor() };
  63. };

  64. //=============================================================================
  65. // ** Scene Map
  66. //=============================================================================

  67. //==============================
  68. // * Terminate
  69. //==============================
  70. var _alias_mog_evensensor_terminate = Scene_Map.prototype.terminate;
  71. Scene_Map.prototype.terminate = function() {
  72.     _alias_mog_evensensor_terminate.call(this);
  73.     $gameMap.events().forEach(function(event) {
  74.         if (event._sensor_range[0]) { $gameSelfSwitches.setValue(event.sensor_key(), false) };
  75.     }, this);
  76. };

  77. //=============================================================================
  78. // ** Game Event
  79. //=============================================================================

  80. //==============================
  81. // * Setup Page
  82. //==============================
  83. var _alias_mog_evensensor_gevent_setupPage = Game_Event.prototype.setupPage;
  84. Game_Event.prototype.setupPage = function() {
  85.     _alias_mog_evensensor_gevent_setupPage.call(this);
  86.     this.check_event_sensor();
  87. };

  88. //==============================
  89. // * Check Event Sensor
  90. //==============================
  91. Game_Event.prototype.check_event_sensor = function() {
  92.     if (!this._erased && this.page()) {
  93.         this.list().forEach(function(l) {
  94.             if (l.code === 108) {
  95.                 var comment = l.parameters[0].split(' : ');
  96.                 if (comment[0].toLowerCase() == "event sensor") {
  97.                     this._sensor_range = [true, Number(Math.abs(comment[1]))];
  98.                     this._need_clear_sensor = false;
  99.                 };
  100.             };
  101.         }, this);
  102.     };
  103. };

  104. //==============================
  105. // * Update
  106. //==============================
  107. var _mog_event_sensor_gev_update = Game_Event.prototype.update;
  108. Game_Event.prototype.update = function() {
  109.     _mog_event_sensor_gev_update.call(this);
  110.     if (this.needUpdateSensor()) { this.update_sensor() };
  111. };

  112. //==============================
  113. // * Need Update Sensor
  114. //==============================
  115. Game_Event.prototype.needUpdateSensor = function() {
  116.     if (!this._sensor_range[0]) { return false };
  117.     return true;
  118. };

  119. //==============================
  120. // * Sensor Dis
  121. //==============================
  122. Game_Event.prototype.sensor_dis = function() {
  123.     return Math.abs($gamePlayer.x - this.x) + Math.abs($gamePlayer.y - this.y);
  124. };

  125. //==============================
  126. // * Sensor Key
  127. //==============================
  128. Game_Event.prototype.sensor_key = function() {
  129.     return [this._mapId, this._eventId, Moghunter.sensor_range_key];
  130. };

  131. //==============================
  132. // * Update Sensor
  133. //==============================
  134. Game_Event.prototype.update_sensor = function() {
  135.     var enable = (this.sensor_dis() <= this._sensor_range[1]);
  136.     var last_enable = $gameSelfSwitches.value(this.sensor_key());
  137.     if (enable != last_enable) { this.sensor_effect(enable) };
  138. };

  139. //==============================
  140. // * Sensor Effect
  141. //==============================
  142. Game_Event.prototype.sensor_effect = function(enable) {
  143.     $gameSelfSwitches.setValue(this.sensor_key(), enable);
  144. };
复制代码

回复

使用道具 举报

梦石
0
星屑
29220
在线时间
1535 小时
注册时间
2006-1-10
回帖
1898

开拓者第一届地图绘制大赛RTP组第四名

发表于 2017-11-6 21:56:01 | 显示全部楼层
本帖最后由 king 于 2017-11-6 22:00 编辑

最好去看视频
你这个插件好像不是这个NPC范围,应该是区域事件
具体我找看看,YEP的插件是这个
Event Chase Player 事件追逐
Event Chase Player > Event Chase Stealth 隐身模式

MV帮助 http://miaowm5.github.io/RMMV-F1/日复一日,年复一年人还是保留一点自我兴趣的好啊~~~忘记过去 ,这样我就可以  放弃未来了……哭~~终于找回以前的头像了,哎~~原来我是那么的想念阿……
画地图没灵感?很烦?很无聊 【 戳 我 】一 大 波 地 图 在 等 你  \^0^/
我的游戏
回复

使用道具 举报

梦石
0
星屑
788
在线时间
109 小时
注册时间
2008-2-10
回帖
199
 楼主| 发表于 2017-11-17 21:03:13 | 显示全部楼层
king 发表于 2017-11-6 21:56
最好去看视频
你这个插件好像不是这个NPC范围,应该是区域事件
具体我找看看,YEP的插件是这个

谢谢咯````````````
h
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部