设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3367|回复: 1
打印 上一主题 下一主题

[已经解决] "XP战斗屏蔽角色"脚本求兼容VA

[复制链接]

Lv1.梦旅人

梦石
0
星屑
59
在线时间
536 小时
注册时间
2010-6-20
帖子
1489
跳转到指定楼层
1
发表于 2012-1-22 00:57:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

这个是用在XP的。
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。by:灵九哲
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     ######################【此处新添加,括号里的内容为修改限制的编号】
  12.     $game_party.remove_actor(1)
  13.     ######################
  14.     # 初始化战斗用的各种暂时数据
  15.     $game_temp.in_battle = true
  16.     $game_temp.battle_turn = 0
  17.     $game_temp.battle_event_flags.clear
  18.     $game_temp.battle_abort = false
  19.     $game_temp.battle_main_phase = false
  20.     $game_temp.battleback_name = $game_map.battleback_name
  21.     $game_temp.forcing_battler = nil
  22.     # 初始化战斗用事件解释器
  23.     $game_system.battle_interpreter.setup(nil, 0)
  24.     # 准备队伍
  25.     @troop_id = $game_temp.battle_troop_id
  26.     $game_troop.setup(@troop_id)
  27.     # 生成角色命令窗口
  28.     s1 = $data_system.words.attack
  29.     s2 = $data_system.words.skill
  30.     s3 = $data_system.words.guard
  31.     s4 = $data_system.words.item
  32.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  33.     @actor_command_window.y = 160
  34.     @actor_command_window.back_opacity = 160
  35.     @actor_command_window.active = false
  36.     @actor_command_window.visible = false
  37.     # 生成其它窗口
  38.     @party_command_window = Window_PartyCommand.new
  39.     @help_window = Window_Help.new
  40.     @help_window.back_opacity = 160
  41.     @help_window.visible = false
  42.     @status_window = Window_BattleStatus.new
  43.     @message_window = Window_Message.new
  44.     # 生成活动块
  45.     @spriteset = Spriteset_Battle.new
  46.     # 初始化等待计数
  47.     @wait_count = 0
  48.     # 执行过渡
  49.     if $data_system.battle_transition == ""
  50.       Graphics.transition(20)
  51.     else
  52.       Graphics.transition(40, "Graphics/Transitions/" +
  53.         $data_system.battle_transition)
  54.     end
  55.     # 开始自由战斗回合
  56.     start_phase1
  57.     # 主循环
  58.     loop do
  59.       # 刷新游戏画面
  60.       Graphics.update
  61.       # 刷新输入信息
  62.       Input.update
  63.       # 刷新画面
  64.       update
  65.       # 如果画面切换的话就中断循环
  66.       if $scene != self
  67.         break
  68.       end
  69.     end
  70.     # 刷新地图
  71.     $game_map.refresh
  72.     # 准备过渡
  73.     Graphics.freeze
  74.     # 释放窗口
  75.     @actor_command_window.dispose
  76.     @party_command_window.dispose
  77.     @help_window.dispose
  78.     @status_window.dispose
  79.     @message_window.dispose
  80.     if @skill_window != nil
  81.       @skill_window.dispose
  82.     end
  83.     if @item_window != nil
  84.       @item_window.dispose
  85.     end
  86.     if @result_window != nil
  87.       @result_window.dispose
  88.     end
  89.     # 释放活动块
  90.     @spriteset.dispose
  91.     # 标题画面切换中的情况
  92.     if $scene.is_a?(Scene_Title)
  93.       # 淡入淡出画面
  94.       Graphics.transition
  95.       Graphics.freeze
  96.     end
  97.     # 战斗测试或者游戏结束以外的画面切换中的情况
  98.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  99.       $scene = nil
  100.     end
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 胜负判定
  104.   #--------------------------------------------------------------------------
  105.   def judge
  106.     # 全灭判定是真、并且同伴人数为 0 的情况下
  107.     if $game_party.all_dead? or $game_party.actors.size == 0
  108.       # 允许失败的情况下
  109.       if $game_temp.battle_can_lose
  110.         # 还原为战斗开始前的 BGM
  111.         $game_system.bgm_play($game_temp.map_bgm)
  112.         # 战斗结束
  113.         battle_end(2)
  114.         # 返回 true
  115.         return true
  116.       end
  117.       # 设置游戏结束标志
  118.       $game_temp.gameover = true
  119.       # 返回 true
  120.       return true
  121.     end
  122.     # 如果存在任意 1 个敌人就返回 false
  123.     for enemy in $game_troop.enemies
  124.       if enemy.exist?
  125.         return false
  126.       end
  127.     end
  128.     # 开始结束战斗回合 (胜利)
  129.     start_phase5
  130.     # 返回 true
  131.     return true
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 战斗结束
  135.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  136.   #--------------------------------------------------------------------------
  137.   def battle_end(result)
  138.     # 清除战斗中标志
  139.     $game_temp.in_battle = false
  140.     # 清除全体同伴的行动
  141.     $game_party.clear_actions
  142.     # 解除战斗用状态
  143.     for actor in $game_party.actors
  144.       actor.remove_states_battle
  145.     end
  146.     # 清除敌人
  147.     $game_troop.enemies.clear
  148.     # 调用战斗返回调用
  149.     if $game_temp.battle_proc != nil
  150.       $game_temp.battle_proc.call(result)
  151.       $game_temp.battle_proc = nil
  152.     end
  153.     # 切换到地图画面
  154.     $scene = Scene_Map.new
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 设置战斗事件
  158.   #--------------------------------------------------------------------------
  159.   def setup_battle_event
  160.     # 正在执行战斗事件的情况下
  161.     if $game_system.battle_interpreter.running?
  162.       return
  163.     end
  164.     # 搜索全部页的战斗事件
  165.     for index in 0...$data_troops[@troop_id].pages.size
  166.       # 获取事件页
  167.       page = $data_troops[@troop_id].pages[index]
  168.       # 事件条件可以参考 c
  169.       c = page.condition
  170.       # 没有指定任何条件的情况下转到下一页
  171.       unless c.turn_valid or c.enemy_valid or
  172.              c.actor_valid or c.switch_valid
  173.         next
  174.       end
  175.       # 执行完毕的情况下转到下一页
  176.       if $game_temp.battle_event_flags[index]
  177.         next
  178.       end
  179.       # 确认回合条件
  180.       if c.turn_valid
  181.         n = $game_temp.battle_turn
  182.         a = c.turn_a
  183.         b = c.turn_b
  184.         if (b == 0 and n != a) or
  185.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  186.           next
  187.         end
  188.       end
  189.       # 确认敌人条件
  190.       if c.enemy_valid
  191.         enemy = $game_troop.enemies[c.enemy_index]
  192.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  193.           next
  194.         end
  195.       end
  196.       # 确认角色条件
  197.       if c.actor_valid
  198.         actor = $game_actors[c.actor_id]
  199.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  200.           next
  201.         end
  202.       end
  203.       # 确认开关条件
  204.       if c.switch_valid
  205.         if $game_switches[c.switch_id] == false
  206.           next
  207.         end
  208.       end
  209.       # 设置事件
  210.       $game_system.battle_interpreter.setup(page.list, 0)
  211.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  212.       if page.span <= 1
  213.         # 设置执行结束标志
  214.         $game_temp.battle_event_flags[index] = true
  215.       end
  216.       return
  217.     end
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 刷新画面
  221.   #--------------------------------------------------------------------------
  222.   def update
  223.     # 执行战斗事件中的情况下
  224.     if $game_system.battle_interpreter.running?
  225.       # 刷新解释器
  226.       $game_system.battle_interpreter.update
  227.       # 强制行动的战斗者不存在的情况下
  228.       if $game_temp.forcing_battler == nil
  229.         # 执行战斗事件结束的情况下
  230.         unless $game_system.battle_interpreter.running?
  231.           # 继续战斗的情况下、再执行战斗事件的设置
  232.           unless judge
  233.             setup_battle_event
  234.           end
  235.         end
  236.         # 如果不是结束战斗回合的情况下
  237.         if @phase != 5
  238.           # 刷新状态窗口
  239.           @status_window.refresh
  240.         end
  241.       end
  242.     end
  243.     # 系统 (计时器)、刷新画面
  244.     $game_system.update
  245.     $game_screen.update
  246.     # 计时器为 0 的情况下
  247.     if $game_system.timer_working and $game_system.timer == 0
  248.       # 中断战斗
  249.       $game_temp.battle_abort = true
  250.     end
  251.     # 刷新窗口
  252.     @help_window.update
  253.     @party_command_window.update
  254.     @actor_command_window.update
  255.     @status_window.update
  256.     @message_window.update
  257.     # 刷新活动块
  258.     @spriteset.update
  259.     # 处理过渡中的情况下
  260.     if $game_temp.transition_processing
  261.       # 清除处理过渡中标志
  262.       $game_temp.transition_processing = false
  263.       # 执行过渡
  264.       if $game_temp.transition_name == ""
  265.         Graphics.transition(20)
  266.       else
  267.         Graphics.transition(40, "Graphics/Transitions/" +
  268.           $game_temp.transition_name)
  269.       end
  270.     end
  271.     # 显示信息窗口中的情况下
  272.     if $game_temp.message_window_showing
  273.       return
  274.     end
  275.     # 显示效果中的情况下
  276.     if @spriteset.effect?
  277.       return
  278.     end
  279.     # 游戏结束的情况下
  280.     if $game_temp.gameover
  281.       # 切换到游戏结束画面
  282.       $scene = Scene_Gameover.new
  283.       return
  284.     end
  285.     # 返回标题画面的情况下
  286.     if $game_temp.to_title
  287.       # 切换到标题画面
  288.       $scene = Scene_Title.new
  289.       return
  290.     end
  291.     # 中断战斗的情况下
  292.     if $game_temp.battle_abort
  293.       # 还原为战斗前的 BGM
  294.       $game_system.bgm_play($game_temp.map_bgm)
  295.       # 战斗结束
  296.       battle_end(1)
  297.       return
  298.     end
  299.     # 等待中的情况下
  300.     if @wait_count > 0
  301.       # 减少等待计数
  302.       @wait_count -= 1
  303.       return
  304.     end
  305.     # 强制行动的角色存在、
  306.     # 并且战斗事件正在执行的情况下
  307.     if $game_temp.forcing_battler == nil and
  308.        $game_system.battle_interpreter.running?
  309.       return
  310.     end
  311.     # 回合分支
  312.     case @phase
  313.     when 1  # 自由战斗回合
  314.       update_phase1
  315.     when 2  # 同伴命令回合
  316.       update_phase2
  317.     when 3  # 角色命令回合
  318.       update_phase3
  319.     when 4  # 主回合
  320.       update_phase4
  321.     when 5  # 战斗结束回合
  322.       update_phase5
  323.     end
  324.   end
  325. end
复制代码
$game_party.remove_actor(1)
就是屏蔽角色的

那么怎么用在VA的RGSS3上呢?
[url=http://rpg.blue/thread-329159-1-1.html]http://attach.66rpg.com/bbs/attachment/forum/201308/24/132414sa8au7zgh7ab21gx.png[/url]   [b]
无尽之旅--永无止尽的旅程。[/b]

Lv1.梦旅人

66RPG站长

梦石
0
星屑
54
在线时间
615 小时
注册时间
2005-10-10
帖子
5734

RMVX自由创作大赛亚军第2届短篇游戏比赛亚军第5届短篇游戏比赛冠军

2
发表于 2012-1-24 18:48:35 | 只看该作者
你那个不是屏蔽,是直接把这个角色轰出队伍了,而且加不回来了好像……
重写了一个,原理就是先设置好不参与战斗的角色编号,进入战斗时候把他们轰出去、战斗结束时候把轰出去的人接回来。

范例工程:点击这里下载

  1. #======================================================
  2. # 某些角色不参与战斗,柳柳@66rpg.com
  3. #======================================================
  4. class Scene_Battle
  5.   #====================================================
  6.   # 不参与战斗的编号写在这里
  7.   #====================================================
  8.   I_AM_NPC = [1, 2, 3]
  9.   
  10.   
  11.   
  12.   # 不参与战斗的角色,进入战斗的时候临时轰走
  13.   alias o_start start unless $@
  14.   def start
  15.     @no_fight = []
  16.     for aid in I_AM_NPC
  17.       if $game_party.members.include?($game_actors[aid])
  18.         @no_fight.push(aid)
  19.         $game_party.remove_actor(aid)
  20.       end
  21.     end
  22.     o_start
  23.   end
  24.   
  25.   # 被轰走的角色,结束战斗的时候叫回来
  26.   alias o_terminate terminate unless $@
  27.   def terminate
  28.     o_terminate
  29.     for aid in @no_fight
  30.       $game_party.add_actor(aid)
  31.     end
  32.   end
  33.   
  34. end
复制代码

点评

呵呵,这是口袋妖怪同人作必备的脚本啊。  发表于 2012-1-28 00:55
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-27 19:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表