level 4
只需要让玩家到了那个NPC的上下左右那一格的地方再使用点击插件就可以了。
MZ版的话,
ButtonPicture.js是点击图片的,
TouchInputDispatcherMZ.js是点击NPC的。
在plugin.fungamemake.com分别搜索Button、TouchInput好像就可以找到MV版的相关插件了,
TouchInputDispatcher.js这个就是MV版的点击插件。
求助,怎么让npc做在椅子上啊!【rpgmakermv吧】_百度贴吧
https://tieba.baidu.com/p/10399329184?pid=153098119463&cid=0#153098119463
上面这里4楼说的就是NPC跟NPC或者是主角的距离有多远。
NearEventSensor.js这个插件好像也是。
可以改成下面这样,在下雨天那里设置点击插件应该就可以了。
◆脚本:Game_Event.prototype.isNearThePlayer = function() {
: :const sx = Math.abs(this.deltaXFrom($gamePlayer.x));
: :const sy = Math.abs(this.deltaYFrom($gamePlayer.y));
: :return sx + sy <= 1;
: :};
◆如果:脚本:$gameMap.event(this.eventId()).isNearThePlayer();
◆设置天气:雨, 5, 1 帧
◆
:否则
◆设置天气:无, 1 帧
◆
:结束
也可以改成下面这样,
一是因为上面这个Game_Event.prototype.isNearThePlayer是自带的函数,
不更改函数名直接更改函数里面的东西会覆盖、替换掉本来的函数。
二是因为下面这个Math.sqrt();根号比上面这个加法更好。
Math.sqrt();
根号1等于多少
根号2等于多少
根号3等于多少
根号4等于多少
根号5等于多少
百度一下上面这6行,就知道return Radius1 <= 1;是上下左右,
如果想要左上、左下、右上、右下这些跟上下左右都算成是一环的话,
就应该改成return Radius1 <= 1.414213562374;了。
(下面的1.414213562373好像是还有小数点没有算完,所以改成1.414213562374了)
√(1)
1
√(2)
1.414213562373
√(3)
1.732050807569
√(4)
2
√(5)
2.2360679775
◆脚本:Game_Event.prototype.isNearThePlayerRadius1 = function() {
: :const sx = Math.abs(this.deltaXFrom($gamePlayer.x));
: :const sy = Math.abs(this.deltaYFrom($gamePlayer.y));
: :Radius1 = Math.sqrt(sx*sx + sy*sy);
: :return Radius1 <= 1;
: :};
◆如果:脚本:$gameMap.event(this.eventId()).isNearThePlayerRadius1();
◆设置天气:雨, 5, 1 帧
◆
:否则
◆设置天气:无, 1 帧
◆
:结束