查看: 3031|回复: 9

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

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

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

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

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


有没有这样的脚本 呢?      

h
梦石
0
星屑
2772
在线时间
215 小时
注册时间
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
星屑
2772
在线时间
215 小时
注册时间
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 | 显示全部楼层
[pre lang="javascript" line="1" file="MOG_EventSensor.js"]//=============================================================================
// MOG_EventSensor.js
//=============================================================================

/*:
* @plugindesc (v1.1) Event distance system.
* @author Moghunter
*
* @param Self Switch Key
* @desc Setting the Letter of SelfSwitch
* @default D
*
* @help  
* =============================================================================
* +++ MOG - Event Sensor (v1.1) +++
* By Moghunter
* https://atelierrgss.wordpress.com/
* =============================================================================
* Event distance system.
* Depending on the distance between the player and the event, the predetermined
* page of the event can be activated or not.
* =============================================================================
* To set the distance of the event sensor, place this comment in the event.
*
* event sensor : X
*
* =============================================================================
* HISTORY
* =============================================================================
* (v1.1) - Change noteTag to standardize the form of commands.
*
*/

//=============================================================================
// ** PLUGIN PARAMETERS
//=============================================================================
  
var Imported = Imported || {};  
Imported.MOG_EventSensor = true;  
var Moghunter = Moghunter || {};

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

//=============================================================================
// ** Character Base
//=============================================================================

//==============================
// * Init Members
//==============================
var _alias_mog_evensensor_cbase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
    _alias_mog_evensensor_cbase_initMembers.call(this);
    this._sensor_range = [false, 0];
};

//=============================================================================
// ** Sprite Character
//=============================================================================

//==============================
// * Initialize
//==============================
var _alias_mog_evensensor_schar_initialize = Sprite_Character.prototype.initialize;
Sprite_Character.prototype.initialize = function(character) {
    _alias_mog_evensensor_schar_initialize.call(this, character);
    if (this._character && this._character._eventId) { this._character.check_event_sensor() };
};

//=============================================================================
// ** Scene Map
//=============================================================================

//==============================
// * Terminate
//==============================
var _alias_mog_evensensor_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function() {
    _alias_mog_evensensor_terminate.call(this);
    $gameMap.events().forEach(function(event) {
        if (event._sensor_range[0]) { $gameSelfSwitches.setValue(event.sensor_key(), false) };
    }, this);
};

//=============================================================================
// ** Game Event
//=============================================================================

//==============================
// * Setup Page
//==============================
var _alias_mog_evensensor_gevent_setupPage = Game_Event.prototype.setupPage;
Game_Event.prototype.setupPage = function() {
    _alias_mog_evensensor_gevent_setupPage.call(this);
    this.check_event_sensor();
};

//==============================
// * Check Event Sensor
//==============================
Game_Event.prototype.check_event_sensor = function() {
    if (!this._erased && this.page()) {
        this.list().forEach(function(l) {
            if (l.code === 108) {
                var comment = l.parameters[0].split(' : ');
                if (comment[0].toLowerCase() == "event sensor") {
                    this._sensor_range = [true, Number(Math.abs(comment[1]))];
                    this._need_clear_sensor = false;
                };
            };
        }, this);
    };
};

//==============================
// * Update
//==============================
var _mog_event_sensor_gev_update = Game_Event.prototype.update;
Game_Event.prototype.update = function() {
    _mog_event_sensor_gev_update.call(this);
    if (this.needUpdateSensor()) { this.update_sensor() };
};

//==============================
// * Need Update Sensor
//==============================
Game_Event.prototype.needUpdateSensor = function() {
    if (!this._sensor_range[0]) { return false };
    return true;
};

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

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

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

//==============================
// * Sensor Effect
//==============================
Game_Event.prototype.sensor_effect = function(enable) {
    $gameSelfSwitches.setValue(this.sensor_key(), enable);
};[/pre]
回复

使用道具 举报

梦石
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.

在本版发帖返回顶部