Project1

标题: 请问如何实现移动触发公共事件(附上自己写的失败插件) [打印本页]

作者: wmzmtz    时间: 2017-6-30 14:18
标题: 请问如何实现移动触发公共事件(附上自己写的失败插件)
功能很简单,每移动一步,执行一下公共事件

个人想法是利用增加步数(Game_Player.prototype.increaseSteps)来修改

结果自己写的插件经测试完全没有反应,请大神指教

另外话说论坛怎么发代码的格式?


//=============================================================================
// MoveEvent
//
// Last Update: 2017.6.30
//=============================================================================

/*:
* @plugindesc Allows move trigger CommonEvent
* @author
*
* @param Common Event ID
* @default 12
*
* @help This plugin does not provide plugin commands.
*
*/

(function() {

  var CommonEventId = parseInt(parameters['Common Event ID'] || 12);


//增加步数
Game_Player.prototype.increaseSteps = function() {
    //游戏人物 增加步数 呼叫(this , x , y)
    Game_Character.prototype.increaseSteps.call(this);
    //如果( 是普通() )
    if (this.isNormal()) {
        //游戏队伍 增加步数()
        $gameParty.increaseSteps();
        $gameTemp.reserveCommonEvent(CommonEventId);//此处为我添加的内容
    }

};

})();

作者: wymwaq    时间: 2017-7-4 17:20
加在if语句外试试?
作者: 铅笔描绘的思念    时间: 2017-7-4 18:00
本帖最后由 铅笔描绘的思念 于 2017-7-4 19:22 编辑

var CommonEventId = parseInt(parameters['Common Event ID']) || 12;


↑上面是猜的
不明原因。。独立成插件使用参数没效果。。怪


就是调用参数形式错了
JAVASCRIPT 代码复制
  1. var CommonEventId = parseInt(PluginManager.parameters('MoveEvent')['CommonEventID']) || 12;

作者: 703001848    时间: 2017-7-4 18:23
楼主放错地方了
Game_Player.prototype.increaseSteps你的位置
Game_Party.prototype.increaseSteps计步





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1