Project1

标题: 战斗中按R键重复上次动作 [打印本页]

作者: 雪流星    时间: 2008-10-27 14:30
标题: 战斗中按R键重复上次动作
在战斗中按 Z 键,重复上次动作,包括上次选择目标

  1. #重複的按鍵
  2. $repeat_button = Input::Z


  3. class Scene_Battle < Scene_Base
  4.   alias repeat_start start
  5.   alias repeat_update update
  6.   alias repeat_update_actor_command_selection update_actor_command_selection
  7.   alias repeat_update_target_enemy_selection update_target_enemy_selection
  8.   alias repeat_update_target_actor_selection update_target_actor_selection
  9.   alias repeat_determine_skill determine_skill
  10.   alias repeat_determine_item determine_item
  11.   def start
  12.     @actor_last_action = {}
  13.     repeat_start
  14.   end
  15.   def update
  16.     unless $game_message.visible
  17.       if Input.trigger?($repeat_button)
  18.         return unless @actor_command_window.active
  19.       end
  20.     end
  21.     repeat_update
  22.   end
  23.   def update_actor_command_selection
  24.     if Input.trigger?(Input::C)
  25.       case @actor_command_window.index
  26.       when 0  # 攻擊
  27.         @actor_last_action[@active_battler] = [0]
  28.       when 2  # 防禦
  29.         @actor_last_action[@active_battler] = [2]
  30.       end
  31.     elsif Input.trigger?($repeat_button)
  32.       determine_last_action
  33.     end
  34.     repeat_update_actor_command_selection
  35.   end
  36.   def update_target_enemy_selection
  37.     if Input.trigger?(Input::C)
  38.       if @active_battler.action.attack?
  39.         @actor_last_action[@active_battler] = [0, @target_enemy_window.enemy.index]
  40.       elsif @active_battler.action.skill?
  41.         @actor_last_action[@active_battler] = [1, @skill, @target_enemy_window.enemy.index]
  42.       elsif @active_battler.action.item?
  43.         @actor_last_action[@active_battler] = [3, @item, @target_enemy_window.enemy.index]
  44.       end
  45.     end
  46.     repeat_update_target_enemy_selection
  47.   end
  48.   def update_target_actor_selection
  49.     if Input.trigger?(Input::C)
  50.       if @active_battler.action.attack?
  51.         @actor_last_action[@active_battler] = [0, @target_actor_window.index]
  52.       elsif @active_battler.action.skill?
  53.         @actor_last_action[@active_battler] = [1, @skill, @target_actor_window.index]
  54.       elsif @active_battler.action.item?
  55.         @actor_last_action[@active_battler] = [3, @item, @target_actor_window.index]
  56.       end
  57.     end
  58.     repeat_update_target_actor_selection
  59.   end
  60.   def determine_item
  61.     @actor_last_action[@active_battler] = [1, @item]
  62.     repeat_determine_item
  63.   end
  64.   def determine_skill
  65.     @actor_last_action[@active_battler] = [1, @skill]
  66.     repeat_determine_skill
  67.   end
  68.   def determine_last_action
  69.     return if @actor_last_action[@active_battler].nil?
  70.     case @actor_last_action[@active_battler][0]
  71.     when 0
  72.       @active_battler.action.set_attack
  73.       @active_battler.action.target_index = @actor_last_action[@active_battler][1]
  74.     when 1
  75.       @skill = @actor_last_action[@active_battler][1]
  76.       @active_battler.action.set_skill(@skill.id)
  77.       if @skill.need_selection?
  78.         @active_battler.action.target_index = @actor_last_action[@active_battler][2]
  79.       else
  80.         determine_skill
  81.       end
  82.     when 2
  83.       @actor_last_action[@active_battler] = [2]
  84.       @active_battler.action.set_guard
  85.     when 3
  86.       @item = @actor_last_action[@active_battler][1]
  87.       @active_battler.action.set_item(@item.id)
  88.       if @item.need_selection?
  89.         @active_battler.action.target_index = @actor_last_action[@active_battler][2]
  90.       else
  91.         determine_item
  92.       end
  93.     else; return
  94.     end
  95.     @actor_command_window.active = true
  96.     next_actor
  97.   end
  98. end
复制代码


与SideView2.7相容补丁:

  1. =begin
  2.   将以下这段插在主角本的最後一个end前面
  3.   然後全局搜索 def select_member 在里面找到
  4.   
  5.      elsif Input.trigger?(Input::C)
  6.        Sound.play_decision
  7.        @active_battler.action.target_index = @index
  8.       
  9.    插入
  10.    set_selected_target(@index)
  11. =end
  12.   def set_selected_target(i)
  13.     if @active_battler.action.attack?
  14.       @actor_last_action[@active_battler] = [0, i]
  15.     elsif @active_battler.action.skill?
  16.       @actor_last_action[@active_battler] = [1, @skill, i]
  17.     elsif @active_battler.action.item?
  18.       @actor_last_action[@active_battler] = [3, @item, i]
  19.     end
  20.   end
复制代码


要用 "R" 键的话
需要全按键脚本
作者: 木葬枫    时间: 2008-10-27 14:59
嘛……是个实用的脚本……
作者: qchsiao    时间: 2008-10-27 18:24
谢谢- -太强大了,我犹如浩瀚大海里面的一条小鱼- -终于让我找到了我的归宿,让我慢慢喝光大海吧
作者: 宾少    时间: 2008-10-30 09:16
发现了--NO用!按Z的话,只是进行普通攻击而已~
作者: 精灵使者    时间: 2008-10-30 18:33
与sideview脚本冲突么?如果不冲突的话我肯定会用这个(P.S.魔神战记里面就用了这个的XP版本)
作者: 雪流星    时间: 2008-10-30 19:10
以下引用宾少于2008-10-30 1:16:58的发言:
发现了--NO用!按Z的话,只是进行普通攻击而已~

是不是你按错了
我是指RM里面的A、B、C、X、Y、Z那些按键设定的「Z」键
而不是键盘上的那个Z键
键盘上的Z键默认是对应C(确定键)的
也就是说,你按的是确定键

以下引用精灵使者于2008-10-30 10:33:20的发言:
与sideview脚本冲突么?如果不冲突的话我肯定会用这个(P.S.魔神战记里面就用了这个的XP版本)

不知道,要试试看
脚本里面全部适用alias的
如果有冲突就尽量往下放
[LINE]1,#dddddd[/LINE]
经测试,有冲突
原因来自横版战斗选择目标方式与默认战斗不同
正在制作能够使用的版本中...
作者: 木葬枫    时间: 2008-10-30 19:22
嗯……
就这样慢慢地追赶上XP吧……
作者: 雪流星    时间: 2008-10-30 20:26
横版相容补丁已经完称
精灵测试吧
作者: 精灵使者    时间: 2008-10-30 23:05
恩恩,有机会测试
作者: 土萌萤    时间: 2008-11-2 12:24
提示: 作者被禁止或删除 内容自动屏蔽
作者: zh99998    时间: 2008-11-2 15:51
拉尔夫战记那个CP横版支持乎?
作者: 雪流星    时间: 2008-11-2 21:33
以下引用土萌萤于2008-11-2 4:24:32的发言:
不懂哟~不是键盘上的Z的话,那应该按什么键呢?我把26个字母全按了一遍,只有Z确定和C取消,有反应~其他的都没反应呀~是不是要弄那个全键盘脚本才行呢?

按F1看
我记得默认是D
作者: Huntna    时间: 2010-7-15 21:39
本帖最后由 Huntna 于 2010-7-15 21:40 编辑

回复 土萌萤 的帖子

新人插嘴~

你开始测试游戏后按F1然后打开键盘按键设定的TAB里面就知道RM里的A,B,C,X,Y,Z对应的是你键盘上的哪个了~

我用了起码8,9个脚本~这个REPEAT的脚本似乎对我不兼容啊~不过多谢楼主了~

   




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