Project1

标题: 关于敌人在脚本里面怎么判断攻击攻击/防御的... [打印本页]

作者: 小泡    时间: 2008-8-7 05:00
标题: 关于敌人在脚本里面怎么判断攻击攻击/防御的...
实在是头大..麻烦各位帮忙..谢谢

我想找的就是类似Scene_Battle 3中
   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
      end
      return
    end

这样的东西。但是是怪物的 不是我方的 [LINE]1,#dddddd[/LINE]版务信息:版主帮忙结贴~
作者: dbshy    时间: 2008-8-7 05:03
def start_phase4
    # 转移到回合 4
    @phase = 4
    # 回合数计数
    $game_temp.battle_turn += 1
    # 搜索全页的战斗事件
    for index in 0...$data_troops[@troop_id].pages.size
      # 获取事件页
      page = $data_troops[@troop_id].pages[index]
      # 本页的范围是 [回合] 的情况下
      if page.span == 1
        # 设置已经执行标志
        $game_temp.battle_event_flags[index] = false
      end
    end
    # 设置角色为非选择状态
    @actor_index = -1
    @active_battler = nil
    # 有效化同伴指令窗口
    @party_command_window.active = false
    @party_command_window.visible = false
    # 无效化角色指令窗口
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 设置主回合标志
    $game_temp.battle_main_phase = true
    # 生成敌人行动
    for enemy in $game_troop.enemies
      enemy.make_action
    end

作者: 小泡    时间: 2008-8-7 05:20
嗯 在Game_Enemy里面找到了。但是我想判断 如果 攻击的时候如何如何 其他场合如何如何 该在哪里怎么添呢
作者: 婉转深渊    时间: 2008-8-7 05:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: 灯笼菜刀王    时间: 2008-8-7 05:28
在Scene_Battle 4里
@active_battler.current_action.basic = 0
  0攻击1防御2道具3什么也不做  

角色和敌人都一样,当然敌人没有2....

找到if @active_battler.current_action.basic == 0就是攻击了
如何如何就在下面添就是了。
如果要分角色和敌人,就用@active_battler.is_a?判断下就OK了~~~
---分割分割---
是 == 0 攻击。 囧...已经修改...不过我相信小泡同志也不会让这小错误误导...
[LINE]1,#dddddd[/LINE]系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
作者: dbshy    时间: 2008-8-7 05:32
def update_phase4_step2
    # 如果不是强制行动
    unless @active_battler.current_action.forcing
      # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
      if @active_battler.restriction == 2 or @active_battler.restriction == 3
        # 设置行动为攻击
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
      end
      # 限制为 [不能行动] 的情况下
      if @active_battler.restriction == 4
        # 清除行动强制对像的战斗者
        $game_temp.forcing_battler = nil
        # 移至步骤 1
        @phase4_step = 1
        return
      end
    end
    # 清除对像战斗者
    @target_battlers = []
    # 行动种类分支
    case @active_battler.current_action.kind
    when 0  # 基本
      make_basic_action_result
    when 1  # 特技
      make_skill_action_result
    when 2  # 物品
      make_item_action_result
    end
    # 移至步骤 3
    if @phase4_step == 2
      @phase4_step = 3
    end
  end


在这里用IF来判断
作者: link006007    时间: 2008-8-7 07:10
Game_BattleAction
作者: 小泡    时间: 2008-8-7 07:18
感谢各位{/ka}




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