查看: 2537|回复: 1

[已经解决] 可以控制N个人物运动

[复制链接]
梦石
0
星屑
540
在线时间
13 小时
注册时间
2014-1-20
回帖
2
发表于 2014-6-17 16:07:16 | 显示全部楼层 |阅读模式

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

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

×
如题,求大神说怎么做

点评

没看懂你要怎么控制  发表于 2014-6-17 16:42

梦石
1
星屑
23241
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2014-6-17 17:16:44 | 显示全部楼层
本帖最后由 喵呜喵5 于 2014-6-17 17:26 编辑

说明脚本插入到main以上,然后按照脚本开头的设置执行事件内容

截图

脚本
  1. =begin
  2. ===============================================================================
  3.   共同移动 By喵呜喵5
  4. ===============================================================================

  5. 【说明】
  6.   
  7.   在事件中的脚本编辑器里输入
  8.   
  9.     movetog(1,2,3)
  10.   
  11.   1,2,3换成地图事件的ID,用英文逗号隔开,数量不限
  12.   
  13.   接着按方向键时指定ID的事件就会跟着玩家的操作一起移动
  14.   
  15. =end
  16. $m5script = {} if $m5script.nil?
  17. $m5script["M5MoveTogether"] = true
  18. module M5MoveTogether
  19. #==============================================================================
  20. # 设定部分
  21. #==============================================================================

  22.   
  23.   VAR = 1
  24.   
  25.   #这里设置一个变量的ID,在游戏中请不要随意修改这个ID对应的变量
  26.   
  27.   
  28. #==============================================================================
  29. # 脚本部分
  30. #==============================================================================   
  31. end
  32. class Game_Interpreter  
  33.   def movetog(*eve)
  34.     $game_variables[M5MoveTogether::VAR] = eve.clone
  35.   end
  36. end
  37. class Game_Event
  38.   def movable?
  39.     return false if moving?
  40.     return false if $game_message.busy? || $game_message.visible
  41.     return true
  42.   end
  43. end
  44. class Game_Player
  45.   alias m5_20140617_move_by_input move_by_input
  46.   def move_by_input
  47.     m5_20140617_move_by_input
  48.     return unless $game_variables[M5MoveTogether::VAR].is_a?(Array)
  49.     return if $game_map.interpreter.running?
  50.     return unless Input.dir4 > 0
  51.     $game_variables[M5MoveTogether::VAR].each do |id|
  52.       next unless $game_map.events[id]
  53.       next unless $game_map.events[id].movable?
  54.       $game_map.events[id].move_straight(Input.dir4)      
  55.     end
  56.   end
  57. end
复制代码

评分

参与人数 2星屑 +160 梦石 +1 收起 理由
taroxd + 100 + 1 认可答案
moy + 60 塞糖

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部