如何实现“切换主角”?

查看数: 3070 | 评论数: 3 | 收藏 7
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2022-10-17 01:36

正文摘要:

本帖最后由 asukalin 于 2022-10-17 01:52 编辑 贴子标题说得有点暧昧不清。 上一条贴子问了: https://rpg.blue/thread-491289-1-1.html 按那个方法,换主角之后还是站在原来的位置,这不够好。 我想要的是 ...

回复

烈风 发表于 2023-5-11 16:43:20
楼主你写的代码如何使用哈
moking9 发表于 2022-10-18 15:32:03
坛子人好少,我昨晚发帖也是自行解决的。
asukalin 发表于 2022-10-17 05:48:42
成功了!

在rmmz_scenes里放几个js函数

  1. //切换主角
  2. Scene_Menu.prototype.commandSwitchMain = function() {
  3.     this._statusWindow.setFormationMode(true);
  4.     this._statusWindow.selectLast();
  5.     this._statusWindow.activate();
  6.     this._statusWindow.setHandler("ok", this.onSwitchMainOk.bind(this));
  7.     this._statusWindow.setHandler("cancel", this.onSwitchMainCancel.bind(this));
  8. };

  9. Scene_Menu.prototype.onSwitchMainOk = function() {
  10.         //选中人物
  11.     const index = this._statusWindow.index();
  12.         if (index == 0) {
  13.                 SoundManager.playBuzzer();
  14.                 this._statusWindow.activate();
  15.         } else {
  16.             //关闭菜单
  17.             this.popScene();
  18.             $gameVariables.setValue(1, index);
  19.             $gameTemp.reserveCommonEvent(1);
  20.         }
  21. };

  22. Scene_Menu.prototype.onSwitchMainCancel = function() {
  23.     this._statusWindow.deselect();
  24.     this._commandWindow.activate();
  25. };
复制代码


在菜单选择对应人物时就运行公共事件

在公共事件里让玩家角色和NPC角色交换位置就行了
比想象中容易呢

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

在本版发帖返回顶部