Project1

标题: 战斗菜单调用公共事件 [打印本页]

作者: 789456qwe    时间: 2016-2-20 21:02
标题: 战斗菜单调用公共事件


战斗菜单调用公共事件
,角色1调用 角色1公共事件

,角色2调用 角色2公共事件

,角色3调用 角色3公共事件

,角色4调用 角色4公共事件

,角色5调用 角色5公共事件

,角色6调用 角色6公共事件
。。。。。

怎么写脚本?{:2_272:}

谢谢!


作者: yang1zhi    时间: 2016-2-20 22:09
本帖最后由 yang1zhi 于 2016-2-22 14:33 编辑

Scene_Battle 1
这里找到    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
加个S5进去
s5 = "角色公共事件"

在Scene_Battle 3里面找到  # ● 刷新画面 (角色命令回合 : 基本命令)
      # 角色指令窗口光标位置分之
      case @actor_command_window.index
在这个分支下面添加一个when 4
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)  
        # 开始执行公共事件
$game_temp.common_event_id = actor.id


楼下说的对,应该是这样写的。

[pre lang="ruby"]class Scene_Battle
  def main
    # 初始化战斗用的各种暂时数据
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # 初始化战斗用事件解释器
    $game_system.battle_interpreter.setup(nil, 0)
    # 准备队伍
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # 生成角色命令窗口
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    # ★新建选项
    s5 = "公共事件"
    # ★调整窗口及坐标
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
    @actor_command_window.y = 128
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 生成其它窗口
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # 生成活动块
    @spriteset = Spriteset_Battle.new
    # 初始化等待计数
    @wait_count = 0
    # 执行过渡
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # 开始自由战斗回合
    start_phase1
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果画面切换的话就中断循环
      if $scene != self
        break
      end
    end
    # 刷新地图
    $game_map.refresh
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # 释放活动块
    @spriteset.dispose
    # 标题画面切换中的情况
    if $scene.is_a?(Scene_Title)
      # 淡入淡出画面
      Graphics.transition
      Graphics.freeze
    end
    # 战斗测试或者游戏结束以外的画面切换中的情况
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end    #--------------------------------------------------------------------------
  # ● 刷新画面 (角色命令回合 : 基本命令)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 转向前一个角色的指令输入
      phase3_prior_actor
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 角色指令窗口光标位置分之
      case @actor_command_window.index
      when 0  # 攻击
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        # 开始选择敌人
        start_enemy_select
      when 1  # 特技
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 1
        # 开始选择特技
        start_skill_select
      when 2  # 防御
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # 转向下一位角色的指令输入
        phase3_next_actor
      when 3  # 物品
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 2
        # 开始选择物品
        start_item_select
        # ★新建分歧
      when 4
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 执行
        common_event = $data_common_events[@active_battler.id]
        $game_system.battle_interpreter.setup(common_event.list, 0)
                # 转到下一位角色的指令输入
        phase3_next_actor

      end
      return
    end
  end
  end[/pre]
作者: 789456qwe    时间: 2016-2-21 07:59
yang1zhi 发表于 2016-2-20 22:09
Scene_Battle 1
这里找到    s1 = $data_system.words.attack
    s2 = $data_system.words.skill

然后怎么写?


错误
作者: 紫英晓狼1130    时间: 2016-2-21 10:51
LS的执行公共事件不对,这样用才对
  1. common_event = $data_common_events[xxx]
复制代码
LZ可以看一下范例,查找“★”来查看更改 (, 下载次数: 76)
作者: 789456qwe    时间: 2016-2-21 11:52
本帖最后由 789456qwe 于 2016-2-21 11:53 编辑
紫英晓狼1130 发表于 2016-2-21 10:51
LS的执行公共事件不对,这样用才对LZ可以看一下范例,查找“★”来查看更改 ...


谢谢大神!
作者: 789456qwe    时间: 2016-2-22 07:38
yang1zhi 发表于 2016-2-20 22:09
Scene_Battle 1
这里找到    s1 = $data_system.words.attack
    s2 = $data_system.words.skill


那么怎么修改?大神
作者: 789456qwe    时间: 2016-2-22 17:22
紫英晓狼1130 发表于 2016-2-21 10:51
LS的执行公共事件不对,这样用才对LZ可以看一下范例,查找“★”来查看更改 ...

大神,别生气,谢谢!




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