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

Project1

 找回密码
 注册会员
搜索
楼主: love198959
打印 上一主题 下一主题

2VIP求人做个偷窃系统

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
41
 楼主| 发表于 2007-7-3 05:03:36 | 只看该作者
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。(改了那么多东西,这个里面一点没动,自己赞一个)
  5. #==============================================================================

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

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 初始化战斗用的各种暂时数据
  12.     $game_temp.in_battle = true
  13.     $game_temp.battle_turn = 0
  14.     $game_temp.battle_event_flags.clear
  15.     $game_temp.battle_abort = false
  16.     $game_temp.battle_main_phase = false
  17.     $game_temp.battleback_name = $game_map.battleback_name
  18.     $game_temp.forcing_battler = nil
  19.     # 初始化战斗用事件解释器
  20.     $game_system.battle_interpreter.setup(nil, 0)
  21.     # 准备队伍
  22.     @troop_id = $game_temp.battle_troop_id
  23.     $game_troop.setup(@troop_id)
  24.     # 生成角色命令窗口
  25.     s1 = $data_system.words.attack
  26.     s2 = $data_system.words.skill
  27.     s3 = $data_system.words.guard
  28.     s4 = $data_system.words.item
  29.     s5 = "偷窃"
  30.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])##shell
  31.     @actor_command_window.y = 160-32
  32.     @actor_command_window.back_opacity = 160
  33.     @actor_command_window.active = false
  34.     @actor_command_window.visible = false
  35.     # 生成其它窗口
  36.     @party_command_window = Window_PartyCommand.new
  37.     @help_window = Window_Help.new
  38.     @help_window.back_opacity = 160
  39.     @help_window.visible = false
  40.     @status_window = Window_BattleStatus.new
  41.     @message_window = Window_Message.new
  42.     # 生成活动块
  43.     @spriteset = Spriteset_Battle.new
  44.     # 初始化等待计数
  45.     @wait_count = 0
  46.     # 执行过渡
  47.     if $data_system.battle_transition == ""
  48.       Graphics.transition(20)
  49.     else
  50.       Graphics.transition(40, "Graphics/Transitions/" +
  51.         $data_system.battle_transition)
  52.     end
  53.     # 开始自由战斗回合
  54.     start_phase1
  55.     # 主循环
  56.     loop do
  57.       # 刷新游戏画面
  58.       Graphics.update
  59.       # 刷新输入信息
  60.       Input.update
  61.       # 刷新画面
  62.       update
  63.       # 如果画面切换的话就中断循环
  64.       if $scene != self
  65.         break
  66.       end
  67.     end
  68.     # 刷新地图
  69.     $game_map.refresh
  70.     # 准备过渡
  71.     Graphics.freeze
  72.     # 释放窗口
  73.     @actor_command_window.dispose
  74.     @party_command_window.dispose
  75.     @help_window.dispose
  76.     @status_window.dispose
  77.     @message_window.dispose
  78.     if @skill_window != nil
  79.       @skill_window.dispose
  80.     end
  81.     if @item_window != nil
  82.       @item_window.dispose
  83.     end
  84.     if @result_window != nil
  85.       @result_window.dispose
  86.     end
  87.     # 释放活动块
  88.     @spriteset.dispose
  89.     # 标题画面切换中的情况
  90.     if $scene.is_a?(Scene_Title)
  91.       # 淡入淡出画面
  92.       Graphics.transition
  93.       Graphics.freeze
  94.     end
  95.     # 战斗测试或者游戏结束以外的画面切换中的情况
  96.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  97.       $scene = nil
  98.     end
  99.   end
  100. end
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
1
星屑
916
在线时间
101 小时
注册时间
2006-3-27
帖子
1081
42
发表于 2007-7-3 05:10:50 | 只看该作者
把中间写成这样
    # 生成角色命令窗口
    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, "魔法","召唤","偷窃"])

然后Scene_Battle里的
def update_phase4_step2方法里
case @actor_command_window.index
下面那几个WHEN,你也看着合一下就可以了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
43
 楼主| 发表于 2007-7-3 05:11:09 | 只看该作者
谢谢
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
1
星屑
916
在线时间
101 小时
注册时间
2006-3-27
帖子
1081
44
发表于 2007-7-3 05:12:26 | 只看该作者
以下引用kaze于2007-7-2 21:01:19的发言:

我提出来了
在新手区
大致脚本是
module RPG
class Enemy
  def name
    name = @name.split(/,/)[0]
    return name != nil ? name : ""
  end
  def kaze_steal
    treasure = @name.split(/,/)[1]
    return treasure.to_s
  end
end
end

class Scene_Kaze_steal
def main
   if 敌人有的状态?(20)
       $game_party.gain_item(@kaze_steal,1)
   end
end
end



[本贴由作者于 2007-7-2 21:02:39 最后编辑]


这句有点小问题
$game_party.gain_item(@kaze_steal,1)


@kaze_steal这个变量在你自己新的类里面应该是不能读到你要的数的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
45
 楼主| 发表于 2007-7-3 05:34:51 | 只看该作者
{/gg}整合还蛮辛苦的说
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
46
 楼主| 发表于 2007-7-3 05:40:47 | 只看该作者
{/gg}晕死。整合到偷不到东西的说
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
1
星屑
916
在线时间
101 小时
注册时间
2006-3-27
帖子
1081
47
发表于 2007-7-3 05:44:21 | 只看该作者
{/gg}{/gg}其实就只要几个序号对上就行了

S1,对应 when 0
s2 -> when 1
.
.
.
s7 -> when 6
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
48
 楼主| 发表于 2007-7-3 05:48:17 | 只看该作者
{/gg}没办法。刚学脚本是比较笨的说{/pz}我再去试试
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
4 小时
注册时间
2006-9-28
帖子
208
49
 楼主| 发表于 2007-7-3 05:52:17 | 只看该作者
{/gg}好了谢了。感谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-9-21 15:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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