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

Project1

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

战斗菜单命令个性化

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
399
在线时间
186 小时
注册时间
2006-1-8
帖子
53
跳转到指定楼层
1
发表于 2007-5-20 03:28:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x

给每个角色有不同名字的攻击命令文字

具体设置在  Window_Command_Battle 里 get_command(battler)

  1. #==============================================================================
  2. # ■ Window_Command_Battle
  3. #------------------------------------------------------------------------------
  4. #  战斗命令选择行窗口。
  5. #==============================================================================

  6. class Window_Command_Battle < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     width    : 窗口的宽
  10.   #     commands : 命令字符串序列
  11.   #--------------------------------------------------------------------------
  12.   def initialize(width, battler)
  13.     commands = get_command(battler)
  14.     # 由命令的个数计算出窗口的高
  15.     super(0, 0, width, commands.size * 32 + 32)
  16.     @item_max = commands.size
  17.     @commands = commands
  18.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  19.     self.z = 100
  20.     refresh(battler)
  21.     self.index = 0
  22.     @old_id = 0
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh(battler)
  28.     if battler.id != @old_id
  29.       self.contents.clear
  30.       for i in 0...get_command(battler).size
  31.         draw_item(i, normal_color,get_command(battler)[i])
  32.       end
  33.       @old_id = battler.id
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 描绘项目
  38.   #     index : 项目编号
  39.   #     color : 文字色
  40.   #--------------------------------------------------------------------------
  41.   def draw_item(index, color,name)
  42.     self.contents.font.color = color
  43.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  44.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  45.     self.contents.draw_text(rect, name)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 项目无效化
  49.   #     index : 项目编号
  50.   #--------------------------------------------------------------------------
  51.   def disable_item(index)
  52.     draw_item(index, disabled_color)
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 获取命令
  56.   #--------------------------------------------------------------------------
  57.   def get_command(battler)
  58.     # 根据名字来定义 或者 其它属性来定义
  59.     if battler.name == "阿尔西斯"  
  60.       return ["攻击","剑技","防御","物品"]
  61.     elsif battler.name == "帕吉尔"
  62.       return ["攻击","枪技","防御","物品"]
  63.     elsif battler.name == "克萝莉亚"
  64.       return ["攻击","神术","防御","物品"]
  65.     elsif battler.name == "西露达"
  66.      return ["攻击","魔法","防御","物品"]
  67.     else
  68.      return ["攻击","特技","防御","物品"]
  69.     end
  70.   end
  71. end

  72. class Scene_Battle
  73.    #--------------------------------------------------------------------------
  74.   # ● 主处理
  75.   #--------------------------------------------------------------------------
  76.   def main
  77.     # 初始化战斗用的各种暂时数据
  78.     $game_temp.in_battle = true
  79.     $game_temp.battle_turn = 0
  80.     $game_temp.battle_event_flags.clear
  81.     $game_temp.battle_abort = false
  82.     $game_temp.battle_main_phase = false
  83.     $game_temp.battleback_name = $game_map.battleback_name
  84.     $game_temp.forcing_battler = nil
  85.     # 初始化战斗用事件解释器
  86.     $game_system.battle_interpreter.setup(nil, 0)
  87.     # 准备队伍
  88.     @troop_id = $game_temp.battle_troop_id
  89.     $game_troop.setup(@troop_id)
  90.     # 生成角色命令窗口
  91.     s1 = $data_system.words.attack
  92.     s2 = $data_system.words.skill
  93.     s3 = $data_system.words.guard
  94.     s4 = $data_system.words.item
  95.     @actor_command_window = Window_Command_Battle.new(160,$game_party.actors[0])
  96.     @actor_command_window.y = 160
  97.     @actor_command_window.back_opacity = 160
  98.     @actor_command_window.active = false
  99.     @actor_command_window.visible = false
  100.     # 生成其它窗口
  101.     @party_command_window = Window_PartyCommand.new
  102.     @help_window = Window_Help.new
  103.     @help_window.back_opacity = 160
  104.     @help_window.visible = false
  105.     @status_window = Window_BattleStatus.new
  106.     @message_window = Window_Message.new
  107.     # 生成活动块
  108.     @spriteset = Spriteset_Battle.new
  109.     # 初始化等待计数
  110.     @wait_count = 0
  111.     # 执行过渡
  112.     if $data_system.battle_transition == ""
  113.       Graphics.transition(20)
  114.     else
  115.       Graphics.transition(40, "Graphics/Transitions/" +
  116.         $data_system.battle_transition)
  117.     end
  118.     # 开始自由战斗回合
  119.     start_phase1
  120.     # 主循环
  121.     loop do
  122.       # 刷新游戏画面
  123.       Graphics.update
  124.       # 刷新输入信息
  125.       Input.update
  126.       # 刷新画面
  127.       update
  128.       # 如果画面切换的话就中断循环
  129.       if $scene != self
  130.         break
  131.       end
  132.     end
  133.     # 刷新地图
  134.     $game_map.refresh
  135.     # 准备过渡
  136.     Graphics.freeze
  137.     # 释放窗口
  138.     @actor_command_window.dispose
  139.     @party_command_window.dispose
  140.     @help_window.dispose
  141.     @status_window.dispose
  142.     @message_window.dispose
  143.     if @skill_window != nil
  144.       @skill_window.dispose
  145.     end
  146.     if @item_window != nil
  147.       @item_window.dispose
  148.     end
  149.     if @result_window != nil
  150.       @result_window.dispose
  151.     end
  152.     # 释放活动块
  153.     @spriteset.dispose
  154.     # 标题画面切换中的情况
  155.     if $scene.is_a?(Scene_Title)
  156.       # 淡入淡出画面
  157.       Graphics.transition
  158.       Graphics.freeze
  159.     end
  160.     # 战斗测试或者游戏结束以外的画面切换中的情况
  161.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  162.       $scene = nil
  163.     end
  164.   end
  165.   def phase3_setup_command_window
  166.     @actor_command_window.refresh(@active_battler)
  167.     # 同伴指令窗口无效化
  168.     @party_command_window.active = false
  169.     @party_command_window.visible = false
  170.     # 角色指令窗口无效化
  171.     @actor_command_window.active = true
  172.     @actor_command_window.visible = true
  173.     # 设置角色指令窗口的位置
  174.     @actor_command_window.x = @actor_index * 160
  175.     # 设置索引为 0
  176.     @actor_command_window.index = 0
  177.   end
  178. end

复制代码

Lv2.观梦者

梦石
0
星屑
399
在线时间
186 小时
注册时间
2006-1-8
帖子
53
2
 楼主| 发表于 2007-5-20 03:28:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x

给每个角色有不同名字的攻击命令文字

具体设置在  Window_Command_Battle 里 get_command(battler)

  1. #==============================================================================
  2. # ■ Window_Command_Battle
  3. #------------------------------------------------------------------------------
  4. #  战斗命令选择行窗口。
  5. #==============================================================================

  6. class Window_Command_Battle < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     width    : 窗口的宽
  10.   #     commands : 命令字符串序列
  11.   #--------------------------------------------------------------------------
  12.   def initialize(width, battler)
  13.     commands = get_command(battler)
  14.     # 由命令的个数计算出窗口的高
  15.     super(0, 0, width, commands.size * 32 + 32)
  16.     @item_max = commands.size
  17.     @commands = commands
  18.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  19.     self.z = 100
  20.     refresh(battler)
  21.     self.index = 0
  22.     @old_id = 0
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh(battler)
  28.     if battler.id != @old_id
  29.       self.contents.clear
  30.       for i in 0...get_command(battler).size
  31.         draw_item(i, normal_color,get_command(battler)[i])
  32.       end
  33.       @old_id = battler.id
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 描绘项目
  38.   #     index : 项目编号
  39.   #     color : 文字色
  40.   #--------------------------------------------------------------------------
  41.   def draw_item(index, color,name)
  42.     self.contents.font.color = color
  43.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  44.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  45.     self.contents.draw_text(rect, name)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 项目无效化
  49.   #     index : 项目编号
  50.   #--------------------------------------------------------------------------
  51.   def disable_item(index)
  52.     draw_item(index, disabled_color)
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 获取命令
  56.   #--------------------------------------------------------------------------
  57.   def get_command(battler)
  58.     # 根据名字来定义 或者 其它属性来定义
  59.     if battler.name == "阿尔西斯"  
  60.       return ["攻击","剑技","防御","物品"]
  61.     elsif battler.name == "帕吉尔"
  62.       return ["攻击","枪技","防御","物品"]
  63.     elsif battler.name == "克萝莉亚"
  64.       return ["攻击","神术","防御","物品"]
  65.     elsif battler.name == "西露达"
  66.      return ["攻击","魔法","防御","物品"]
  67.     else
  68.      return ["攻击","特技","防御","物品"]
  69.     end
  70.   end
  71. end

  72. class Scene_Battle
  73.    #--------------------------------------------------------------------------
  74.   # ● 主处理
  75.   #--------------------------------------------------------------------------
  76.   def main
  77.     # 初始化战斗用的各种暂时数据
  78.     $game_temp.in_battle = true
  79.     $game_temp.battle_turn = 0
  80.     $game_temp.battle_event_flags.clear
  81.     $game_temp.battle_abort = false
  82.     $game_temp.battle_main_phase = false
  83.     $game_temp.battleback_name = $game_map.battleback_name
  84.     $game_temp.forcing_battler = nil
  85.     # 初始化战斗用事件解释器
  86.     $game_system.battle_interpreter.setup(nil, 0)
  87.     # 准备队伍
  88.     @troop_id = $game_temp.battle_troop_id
  89.     $game_troop.setup(@troop_id)
  90.     # 生成角色命令窗口
  91.     s1 = $data_system.words.attack
  92.     s2 = $data_system.words.skill
  93.     s3 = $data_system.words.guard
  94.     s4 = $data_system.words.item
  95.     @actor_command_window = Window_Command_Battle.new(160,$game_party.actors[0])
  96.     @actor_command_window.y = 160
  97.     @actor_command_window.back_opacity = 160
  98.     @actor_command_window.active = false
  99.     @actor_command_window.visible = false
  100.     # 生成其它窗口
  101.     @party_command_window = Window_PartyCommand.new
  102.     @help_window = Window_Help.new
  103.     @help_window.back_opacity = 160
  104.     @help_window.visible = false
  105.     @status_window = Window_BattleStatus.new
  106.     @message_window = Window_Message.new
  107.     # 生成活动块
  108.     @spriteset = Spriteset_Battle.new
  109.     # 初始化等待计数
  110.     @wait_count = 0
  111.     # 执行过渡
  112.     if $data_system.battle_transition == ""
  113.       Graphics.transition(20)
  114.     else
  115.       Graphics.transition(40, "Graphics/Transitions/" +
  116.         $data_system.battle_transition)
  117.     end
  118.     # 开始自由战斗回合
  119.     start_phase1
  120.     # 主循环
  121.     loop do
  122.       # 刷新游戏画面
  123.       Graphics.update
  124.       # 刷新输入信息
  125.       Input.update
  126.       # 刷新画面
  127.       update
  128.       # 如果画面切换的话就中断循环
  129.       if $scene != self
  130.         break
  131.       end
  132.     end
  133.     # 刷新地图
  134.     $game_map.refresh
  135.     # 准备过渡
  136.     Graphics.freeze
  137.     # 释放窗口
  138.     @actor_command_window.dispose
  139.     @party_command_window.dispose
  140.     @help_window.dispose
  141.     @status_window.dispose
  142.     @message_window.dispose
  143.     if @skill_window != nil
  144.       @skill_window.dispose
  145.     end
  146.     if @item_window != nil
  147.       @item_window.dispose
  148.     end
  149.     if @result_window != nil
  150.       @result_window.dispose
  151.     end
  152.     # 释放活动块
  153.     @spriteset.dispose
  154.     # 标题画面切换中的情况
  155.     if $scene.is_a?(Scene_Title)
  156.       # 淡入淡出画面
  157.       Graphics.transition
  158.       Graphics.freeze
  159.     end
  160.     # 战斗测试或者游戏结束以外的画面切换中的情况
  161.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  162.       $scene = nil
  163.     end
  164.   end
  165.   def phase3_setup_command_window
  166.     @actor_command_window.refresh(@active_battler)
  167.     # 同伴指令窗口无效化
  168.     @party_command_window.active = false
  169.     @party_command_window.visible = false
  170.     # 角色指令窗口无效化
  171.     @actor_command_window.active = true
  172.     @actor_command_window.visible = true
  173.     # 设置角色指令窗口的位置
  174.     @actor_command_window.x = @actor_index * 160
  175.     # 设置索引为 0
  176.     @actor_command_window.index = 0
  177.   end
  178. end

复制代码
头像被屏蔽

Lv1.梦旅人 (禁止发言)

苹果梨

梦石
0
星屑
43
在线时间
6 小时
注册时间
2007-2-14
帖子
720
3
发表于 2007-5-21 08:34:34 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 18:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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