Project1

标题: 如何制作让普通攻击附带技能效果或者能触发公用事件 [打印本页]

作者: lxw2008    时间: 2019-4-23 23:34
标题: 如何制作让普通攻击附带技能效果或者能触发公用事件
想制作一个类似dota里的法球一样的效果
作者: 活气寒露    时间: 2019-4-23 23:54
问题十分含糊。。。
你是要装备特定武器后发动技能还是每个角色都要发动技能???
还有发动技能是必发还是概率???
作者: lxw2008    时间: 2019-4-24 00:01
活气寒露 发表于 2019-4-23 23:54
问题十分含糊。。。
你是要装备特定武器后发动技能还是每个角色都要发动技能???
还有发动技能是必发还是 ...

就是装备特定武器时候发动,法球效果是必定触发的。
作者: 活气寒露    时间: 2019-4-24 22:56
  1. module Weapon_Attack_Skill
  2.   Weapon_id = [3]
  3.   Skill_id = [61]
  4. end
  5. class Scene_Battle < Scene_Base
  6.   include Weapon_Attack_Skill
  7.   #--------------------------------------------------------------------------
  8.   # * 作戰行為處理
  9.   #--------------------------------------------------------------------------
  10.   def process_action
  11.     return if judge_win_loss
  12.     return if $game_temp.next_scene != nil
  13.     set_next_active_battler
  14.     if @active_battler == nil
  15.       turn_end
  16.       return
  17.     end
  18.     @message_window.clear
  19.     wait(5)
  20.     @active_battler.white_flash = true
  21.     unless @active_battler.action.forcing
  22.       @active_battler.action.prepare
  23.     end
  24.     if @active_battler.action.valid?
  25.       execute_action
  26.     end
  27.     for i in 0...Weapon_id.size
  28.     if @active_battler.is_a?(Game_Actor)
  29.     if @active_battler.weapon_id == Weapon_id[i]
  30.     execute_action_skill  
  31.     end
  32.   end
  33. end
  34.     unless @active_battler.action.forcing
  35.       @message_window.clear
  36.       remove_states_auto
  37.       display_current_state
  38.     end
  39.     @active_battler.white_flash = false
  40.     @message_window.clear
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # * 更新主角行動指令選擇的指令輸入資訊
  44.   #--------------------------------------------------------------------------
  45.   def update_actor_command_selection
  46.     if Input.trigger?(Input::B)
  47.       Sound.play_cancel
  48.       prior_actor
  49.     elsif Input.trigger?(Input::C)
  50.       case @actor_command_window.index
  51.       when 0  # 攻擊
  52.         Sound.play_decision
  53.         for i in 0...Weapon_id.size
  54.         if @active_battler.weapon_id == Weapon_id[i]
  55.         @skill = $data_skills[Skill_id[i]]
  56.         @active_battler.action.set_skill(@skill.id)
  57.         if @skill.need_selection?
  58.         if @skill.for_opponent?
  59.         start_target_enemy_selection
  60.         else
  61.         start_target_actor_selection
  62.       end
  63.       else
  64.         next_actor
  65.       end
  66.       else
  67.           @active_battler.action.set_attack
  68.           start_target_enemy_selection
  69.        end
  70.      end
  71.       when 1  # 技能
  72.         Sound.play_decision
  73.         start_skill_selection
  74.       when 2  # 防禦
  75.         Sound.play_decision
  76.         @active_battler.action.set_guard
  77.         next_actor
  78.       when 3  # 用品
  79.         Sound.play_decision
  80.         start_item_selection
  81.       end
  82.     end
  83.   end
  84. end
复制代码

简单写了一个,默认装备3号武器后,普通攻击发动61号技能
作者: lxw2008    时间: 2019-4-25 01:39
活气寒露 发表于 2019-4-24 22:56
简单写了一个,默认装备3号武器后,普通攻击发动61号技能

首先非常感谢,这个脚本能用。
不过自己测试的时候遇到了一个问题,实际平A会触发两次的技能效果,不知道是为什么,我是RMVX新手,对脚本不是很懂,望赐教
作者: 活气寒露    时间: 2019-4-25 22:52
  1. module Weapon_Attack_Skill
  2.   Weapon_id = [3]
  3.   Skill_id = [61]
  4. end
  5. class Scene_Battle < Scene_Base
  6.   include Weapon_Attack_Skill
  7.   #--------------------------------------------------------------------------
  8.   # * 作戰行為處理
  9.   #--------------------------------------------------------------------------
  10.   def process_action
  11.     return if judge_win_loss
  12.     return if $game_temp.next_scene != nil
  13.     set_next_active_battler
  14.     if @active_battler == nil
  15.       turn_end
  16.       return
  17.     end
  18.     @message_window.clear
  19.     wait(5)
  20.     @active_battler.white_flash = true
  21.     unless @active_battler.action.forcing
  22.       @active_battler.action.prepare
  23.     end
  24.     if @active_battler.action.valid?
  25.       execute_action
  26.       @active_battler.action.basic = 3
  27.     end
  28.     if @active_battler.is_a?(Game_Actor)
  29.     for i in 0...Weapon_id.size
  30.     if @active_battler.weapon_id == Weapon_id[i]
  31.     execute_action_skill if @active_battler.action.basic == -1
  32.     end
  33.   end
  34. end
  35.     unless @active_battler.action.forcing
  36.       @message_window.clear
  37.       remove_states_auto
  38.       display_current_state
  39.     end
  40.     @active_battler.white_flash = false
  41.     @message_window.clear
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # * 更新主角行動指令選擇的指令輸入資訊
  45.   #--------------------------------------------------------------------------
  46.   def update_actor_command_selection
  47.     if Input.trigger?(Input::B)
  48.       Sound.play_cancel
  49.       prior_actor
  50.     elsif Input.trigger?(Input::C)
  51.       case @actor_command_window.index
  52.       when 0  # 攻擊
  53.         Sound.play_decision
  54.         for i in 0...Weapon_id.size
  55.         if @active_battler.weapon_id == Weapon_id[i]
  56.         @skill = $data_skills[Skill_id[i]]
  57.         @active_battler.action.set_skill(@skill.id)
  58.         if @skill.need_selection?
  59.         if @skill.for_opponent?
  60.         start_target_enemy_selection
  61.         else
  62.         start_target_actor_selection
  63.       end
  64.       else
  65.         next_actor
  66.       end
  67.       else
  68.           @active_battler.action.set_attack
  69.           start_target_enemy_selection
  70.        end
  71.      end
  72.       when 1  # 技能
  73.         Sound.play_decision
  74.         start_skill_selection
  75.       when 2  # 防禦
  76.         Sound.play_decision
  77.         @active_battler.action.set_guard
  78.         next_actor
  79.       when 3  # 用品
  80.         Sound.play_decision
  81.         start_item_selection
  82.       end
  83.     end
  84.   end
  85. end
复制代码

没时间完善,勉强能用




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