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

Project1

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

[已经过期] 怎么添加一个任务系统在这个脚本里?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
996
在线时间
25 小时
注册时间
2013-11-26
帖子
4
跳转到指定楼层
1
发表于 2014-4-15 12:48:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. class Scene_Menu
  5. # --------------------------------
  6.   def initialize(menu_index = 0)
  7.     @menu_index = menu_index
  8.     @changer = 0
  9.     @where = 0
  10.     @checker = 0
  11.   end
  12. # --------------------------------
  13.   def main
  14.     s1 = $data_system.words.item
  15.     s2 = $data_system.words.skill
  16.     s3 = $data_system.words.equip
  17.     s4 = "队伍状态"
  18.     s5 = "储存进度"
  19.     s6 = "离开游戏"
  20.     s7 = "调整队伍"
  21.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  22.     @command_window.index = @menu_index
  23.     if $game_party.actors.size == 0
  24.       @command_window.disable_item(0)
  25.       @command_window.disable_item(1)
  26.       @command_window.disable_item(2)
  27.       @command_window.disable_item(3)
  28.     end
  29.     if $game_system.save_disabled
  30.       @command_window.disable_item(4)
  31.     end
  32.     if $game_party.actors.size == 1
  33.       @command_window.disable_item(6)
  34.     end
  35.     @playtime_window = Window_PlayTime.new
  36.     @playtime_window.x = 0
  37.     @playtime_window.y = 256
  38.     @gold_window = Window_Gold.new
  39.     @gold_window.x = 0
  40.     @gold_window.y = 416
  41.     @status_window = Window_MenuStatus.new
  42.     @status_window.x = 160
  43.     @status_window.y = 0
  44.     Graphics.transition
  45.     loop do
  46.       Graphics.update
  47.       Input.update
  48.       update
  49.       if $scene != self
  50.         break
  51.       end
  52.     end
  53.     Graphics.freeze
  54.     @command_window.dispose
  55.     @playtime_window.dispose
  56.     @gold_window.dispose
  57.     @status_window.dispose
  58.   end
  59. # --------------------------------
  60.   def update
  61.     @command_window.update
  62.     @playtime_window.update
  63.     @gold_window.update
  64.     @status_window.update
  65.     if @command_window.active
  66.       update_command
  67.       return
  68.     end
  69.     if @status_window.active
  70.       update_status
  71.       return
  72.     end
  73.   end
  74. # --------------------------------
  75.   def update_command
  76.     if Input.trigger?(Input::B)
  77.       $game_system.se_play($data_system.cancel_se)
  78.       $scene = Scene_Map.new
  79.       return
  80.     end
  81.     if Input.trigger?(Input::C)
  82.       if $game_party.actors.size == 0 and @command_window.index < 4
  83.         $game_system.se_play($data_system.buzzer_se)
  84.         return
  85.       end
  86.       if $game_party.actors.size == 1 and @command_window.index ==6
  87.         $game_system.se_play($data_system.buzzer_se)
  88.         return
  89.       end
  90.       case @command_window.index
  91.       when 0
  92.         $game_system.se_play($data_system.decision_se)
  93.         $scene = Scene_Item.new
  94.       when 1
  95.         $game_system.se_play($data_system.decision_se)
  96.         @command_window.active = false
  97.         @status_window.active = true
  98.         @status_window.index = 0
  99.       when 2
  100.         $game_system.se_play($data_system.decision_se)
  101.         @command_window.active = false
  102.         @status_window.active = true
  103.         @status_window.index = 0
  104.       when 3
  105.         $game_system.se_play($data_system.decision_se)
  106.         @command_window.active = false
  107.         @status_window.active = true
  108.         @status_window.index = 0
  109.       when 4
  110.         if $game_system.save_disabled
  111.           $game_system.se_play($data_system.buzzer_se)
  112.           return
  113.         end
  114.         $game_system.se_play($data_system.decision_se)
  115.         $scene = Scene_Save.new
  116.       when 5
  117.         $game_system.se_play($data_system.decision_se)
  118.         $scene = Scene_End.new
  119.       when 6
  120.         $game_system.se_play($data_system.decision_se)
  121.         @checker = 0
  122.         @command_window.active = false
  123.         @status_window.active = true
  124.         @status_window.index = 0
  125.       end
  126.       return
  127.     end
  128.   end
  129. # --------------------------------
  130.   def update_status
  131.     if Input.trigger?(Input::B)
  132.       $game_system.se_play($data_system.cancel_se)
  133.       @command_window.active = true
  134.       @status_window.active = false
  135.       @status_window.index = -1
  136.       return
  137.     end
  138.     if Input.trigger?(Input::C)
  139.       case @command_window.index
  140.       when 1
  141.         if $game_party.actors[@status_window.index].restriction >= 2
  142.           $game_system.se_play($data_system.buzzer_se)
  143.           return
  144.         end
  145.         $game_system.se_play($data_system.decision_se)
  146.         $scene = Scene_Skill.new(@status_window.index)
  147.       when 2
  148.         $game_system.se_play($data_system.decision_se)
  149.         $scene = Scene_Equip.new(@status_window.index)
  150.       when 3
  151.         $game_system.se_play($data_system.decision_se)
  152.         $scene = Scene_Status.new(@status_window.index)
  153.       when 6
  154.         $game_system.se_play($data_system.decision_se)
  155.         if @checker == 0
  156.           @changer = $game_party.actors[@status_window.index]
  157.           @where = @status_window.index
  158.           @checker = 1
  159.         else
  160.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  161.           $game_party.actors[@status_window.index] = @changer
  162.           @checker = 0
  163.           @status_window.refresh
  164.         end
  165.       end
  166.       return
  167.     end
  168.   end
  169. end
  170. #==============================================================================
  171. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  172. #==============================================================================




大家好,我想请问一下怎么把任务系统加在这段脚本里?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
2
发表于 2014-4-18 12:36:44 | 只看该作者
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. #==============================================================================
  5. # Game_System
  6. #------------------------------------------------------------------------------
  7. # 添加内容
  8. #==============================================================================
  9. class Game_System
  10. attr_accessor :mission #现在执行的任务
  11. attr_accessor :partmission
  12. alias carol3_ini initialize
  13. def initialize
  14.     carol3_ini
  15.     [url=home.php?mod=space&uid=364398]@mission[/url] = ""
  16.     @partmission = []
  17. end
  18. end
  19. #==============================================================================
  20. # ■ Scene_Title
  21. #------------------------------------------------------------------------------
  22. #  处理标题画面的类。
  23. #==============================================================================
  24. class Scene_Title
  25. alias carol3_title1 main
  26. def main
  27.     $map_infos = load_data("Data/MapInfos.rxdata")
  28.     for key in $map_infos.keys
  29.       $map_infos[key] = $map_infos[key].name
  30.     end
  31.     $任务 = ""
  32.     $支线 = nil
  33.     $支线完成 = nil
  34.     carol3_title1
  35. end
  36. end
  37. class Scene_Map
  38. alias carol3_update update
  39. def update
  40.     carol3_update
  41.     if $支线 != nil
  42.       for i in 0...$game_system.partmission.size
  43.         if $game_system.partmission[i] == $支线
  44.           $支线 = nil
  45.           break
  46.         end
  47.       end
  48.       if $支线 != nil
  49.         $game_system.partmission.push($支线)
  50.         $支线 = nil
  51.       end
  52.     end
  53.     if $支线完成 != nil
  54.       for i in 0...$game_system.partmission.size
  55.         if $game_system.partmission[i] == $支线完成
  56.           $game_system.partmission.delete($game_system.partmission[i])
  57.           break
  58.         end
  59.       end
  60.       $支线完成 = nil
  61.     end
  62. end
  63. end
  64. #==============================================================================
  65. # ■ Game_Map
  66. #------------------------------------------------------------------------------
  67. #  处理地图的类。包含卷动以及可以通行的判断功能。
  68. # 本类的实例请参考 $game_map 。
  69. #==============================================================================
  70. class Game_Map
  71. def name
  72.     return $map_infos[@map_id]
  73. end
  74. end
  75. #==============================================================================
  76. # Window_RecordBook
  77. #------------------------------------------------------------------------------
  78. # 菜单界面表示信息的窗口
  79. #==============================================================================
  80. class Window_RecordBook < Window_Base
  81. #--------------------------------------------------------------------------
  82. # ● 初始化对象
  83. #--------------------------------------------------------------------------
  84. def initialize
  85.     super(160, 384, 480, 480)
  86.     self.contents = Bitmap.new(width - 32, height - 32)
  87.     if $任务 == ""
  88.       $任务 = $game_system.mission
  89.     else
  90.       $game_system.mission = $任务
  91.     end
  92.     refresh
  93. end
  94. #--------------------------------------------------------------------------
  95. # ● 刷新画面
  96. #--------------------------------------------------------------------------
  97. def refresh
  98.     self.contents.clear
  99.     self.contents.font.color = system_color
  100.     self.contents.font.size = 20
  101.     cx = self.contents.text_size("现在位置").width + 24
  102.     self.contents.draw_text(4, 0, cx, 24, "现在位置")
  103.     self.contents.font.color = normal_color
  104.     self.contents.draw_text(4 + cx, 0, 444 - cx, 24, $game_map.name.to_s)
  105.     self.contents.font.color = system_color
  106.     cx = self.contents.text_size("主线任务").width + 24
  107.     self.contents.draw_text(4, 32, cx, 24, "主线任务")
  108.     self.contents.font.color = Color.new(240,250,75,255)
  109.     self.contents.draw_text(4 + cx, 32, 444 - cx, 24, $game_system.mission.to_s)
  110.     self.contents.font.color = system_color
  111.     cx = self.contents.text_size("支线任务").width + 24
  112.     self.contents.draw_text(4, 96, cx, 24, "支线任务")
  113.     self.contents.font.color = normal_color
  114.     for i in 0...$game_system.partmission.size
  115.       self.contents.draw_text(4 + cx, 96 + i * 32, 444 - cx, 24, $game_system.partmission[i].to_s)
  116.     end
  117. end
  118. end
  119. #==============================================================================
  120. # ■ Scene_Menu
  121. #------------------------------------------------------------------------------
  122. #  处理菜单画面的类。
  123. #==============================================================================
  124. class Scene_Menu
  125. #--------------------------------------------------------------------------
  126. # ● 初始化对像
  127. # menu_index : 命令光标的初期位置
  128. #--------------------------------------------------------------------------
  129. def initialize(menu_index = 0)
  130.     @menu_index = menu_index
  131.     @切换状态暂停 = ""
  132. end
  133. #--------------------------------------------------------------------------
  134. # ● 主处理
  135. #--------------------------------------------------------------------------
  136. def main
  137.     # 生成命令窗口
  138.     s1 = "使用物品"#$data_system.words.item
  139.     s2 = "查看技能"#$data_system.words.skill
  140.     s3 = "更改装备"#$data_system.words.equip
  141.     s4 = "查看状态"
  142.     s5 = "记忆旅程"
  143.     s6 = "旅程结束"
  144.     s7 = "查看任务"
  145.     s8 = "人物加点"
  146.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
  147.     @command_window.index = @menu_index
  148.     # 同伴人数为 0 的情况下
  149.     if $game_party.actors.size == 0
  150.       # 物品、特技、装备、状态无效化
  151.       @command_window.disable_item(0)
  152.       @command_window.disable_item(1)
  153.       @command_window.disable_item(2)
  154.       @command_window.disable_item(3)
  155.     end
  156.     # 禁止存档的情况下
  157.     if $game_system.save_disabled
  158.       # 存档无效
  159.       @command_window.disable_item(4)
  160.     end
  161.     # 生成游戏时间窗口
  162.     @playtime_window = Window_PlayTime.new
  163.     @playtime_window.x = 0
  164.     @playtime_window.y = 280
  165.     # 生成金钱窗口
  166.     @gold_window = Window_Gold.new
  167.     @gold_window.x = 0
  168.     @gold_window.y = 416
  169.     # 生成状态窗口
  170.     @status_window = Window_MenuStatus.new
  171.     @status_window.x = 160
  172.     @status_window.y = 0
  173.     #—— 生成天书窗口
  174.     @recordbook_window = Window_RecordBook.new
  175.     @recordbook_window.z = 100
  176.     #—— 生成外边框窗口
  177.     @outside_window = Window_Outside.new
  178.     @outside_window.visible = true
  179.     @outside_window.z = 1001
  180.     # 执行过渡
  181.     Graphics.transition
  182.     # 主循环
  183.     loop do
  184.       # 刷新游戏画面
  185.       Graphics.update
  186.       # 刷新输入信息
  187.       Input.update
  188.       # 刷新画面
  189.       update
  190.       # 如果切换画面就中断循环
  191.       if $scene != self
  192.         break
  193.       end
  194.     end
  195.     # 准备过渡
  196.     Graphics.freeze
  197.     # 释放窗口
  198.     @command_window.dispose
  199.     @playtime_window.dispose
  200.     @gold_window.dispose
  201.     @status_window.dispose
  202.     @outside_window.dispose
  203.     @recordbook_window.dispose
  204. end
  205. #--------------------------------------------------------------------------
  206. # ● 刷新画面
  207. #--------------------------------------------------------------------------
  208. def update
  209.     # 刷新窗口
  210.     @command_window.update
  211.     @playtime_window.update
  212.     @gold_window.update
  213.     @status_window.update
  214.     # 命令窗口被激活的情况下: 调用 update_command
  215.     if @command_window.active
  216.       update_command
  217.       return
  218.     end
  219.     # 状态窗口被激活的情况下: 调用 update_status
  220.     if @status_window.active
  221.       update_status
  222.       return
  223.     end
  224.     if @outside_window.visible == false
  225.       update_recordbook
  226.       return
  227.     end
  228. end
  229. #--------------------------------------------------------------------------
  230. # ● 刷新画面 (命令窗口被激活的情况下)
  231. #--------------------------------------------------------------------------
  232. def update_command
  233.     # 按下 B 键的情况下
  234.     if Input.trigger?(Input::B)
  235.       # 演奏取消 SE
  236.       $game_system.se_play($data_system.cancel_se)
  237.       # 切换的地图画面
  238.       $scene = Scene_Map.new
  239.       return
  240.     end
  241.     # 按下 C 键的情况下
  242.     if Input.trigger?(Input::C)
  243.       # 同伴人数为 0、存档、游戏结束以外的场合
  244.       if $game_party.actors.size == 0 and @command_window.index < 4
  245.         # 演奏冻结 SE
  246.         $game_system.se_play($data_system.buzzer_se)
  247.         return
  248.       end
  249.       # 命令窗口的光标位置分支
  250.       case @command_window.index
  251.       when 0 # 物品
  252.         # 演奏确定 SE
  253.         $game_system.se_play($data_system.decision_se)
  254.         # 切换到物品画面
  255.         $scene = Scene_Item.new
  256.       when 1 # 特技
  257.         # 演奏确定 SE
  258.         $game_system.se_play($data_system.decision_se)
  259.         # 激活状态窗口
  260.         @command_window.active = false
  261.         @status_window.active = true
  262.         @status_window.index = 0
  263.       when 2 # 装备
  264.         # 演奏确定 SE
  265.         $game_system.se_play($data_system.decision_se)
  266.         # 激活状态窗口
  267.         @command_window.active = false
  268.         @status_window.active = true
  269.         @status_window.index = 0
  270.       when 3 # 状态
  271.         # 演奏确定 SE
  272.         $game_system.se_play($data_system.decision_se)
  273.         # 激活状态窗口
  274.         @command_window.active = false
  275.         @status_window.active = true
  276.         @status_window.index = 0
  277.       when 4  # 存档
  278.         # 禁止存档的情况下
  279.         if $game_system.save_disabled
  280.           # 演奏冻结 SE
  281.           $game_system.se_play($data_system.buzzer_se)
  282.           return
  283.         end
  284.         # 演奏确定 SE
  285.         $game_system.se_play($data_system.decision_se)
  286.         # 切换到存档画面
  287.         $scene = Scene_Loadsave.new
  288.       when 5 # 游戏结束
  289.         # 演奏确定 SE
  290.         $game_system.se_play($data_system.decision_se)
  291.         # 切换到游戏结束画面
  292.         $scene = Scene_End.new
  293.       when 6 # 查看任务
  294.         # 演奏确定 SE
  295.         $game_system.se_play($data_system.decision_se)
  296.         @command_window.active = false
  297.         @outside_window.visible = false
  298.      when 7  # level up
  299.         # 演奏确定 SE
  300.         $game_system.se_play($data_system.decision_se)
  301.         # 切换到level point画面
  302.         $scene = Scene_Lvup.new
  303.       end
  304.       return
  305.     end
  306. end
  307. #--------------------------------------------------------------------------
  308. # ● 刷新画面 (查看天书的情况下)
  309. #--------------------------------------------------------------------------
  310. def update_recordbook
  311.     if @切换状态暂停 == "天书消失"
  312.       if @recordbook_window.y < 384
  313.         @recordbook_window.y +=64
  314.         @status_window.y -= 16
  315.         return
  316.       else
  317.         @切换状态暂停 = ""
  318.         @outside_window.visible = true
  319.         @command_window.active = true
  320.       end
  321.     else
  322.       if @recordbook_window.y >0
  323.         @recordbook_window.y -= 32
  324.         @status_window.y += 8
  325.         return
  326.       else
  327.         @status_window.visible = false
  328.         if Input.trigger?(Input::B)
  329.           @切换状态暂停 = "天书消失"
  330.           $game_system.se_play($data_system.cancel_se)
  331.           @status_window.visible = true
  332.           return
  333.         end
  334.       end
  335.     end
  336. end
  337. #--------------------------------------------------------------------------
  338. # ● 刷新画面 (状态窗口被激活的情况下)
  339. #--------------------------------------------------------------------------
  340. def update_status
  341.     # 按下 B 键的情况下
  342.     if Input.trigger?(Input::B)
  343.       # 演奏取消 SE
  344.       $game_system.se_play($data_system.cancel_se)
  345.       # 激活命令窗口
  346.       @command_window.active = true
  347.       @status_window.active = false
  348.       @status_window.index = -1
  349.       return
  350.     end
  351.     # 按下 C 键的情况下
  352.     if Input.trigger?(Input::C)
  353.       # 命令窗口的光标位置分支
  354.       case @command_window.index
  355.       when 1 # 特技
  356.         # 本角色的行动限制在 2 以上的情况下
  357.         if $game_party.actors[@status_window.index].restriction >= 2
  358.           # 演奏冻结 SE
  359.           $game_system.se_play($data_system.buzzer_se)
  360.           return
  361.         end
  362.         # 演奏确定 SE
  363.         $game_system.se_play($data_system.decision_se)
  364.         # 切换到特技画面
  365.         $scene = Scene_Skill.new(@status_window.index)
  366.       when 2 # 装备
  367.         # 演奏确定 SE
  368.         $game_system.se_play($data_system.decision_se)
  369.         # 切换的装备画面
  370.         $scene = Scene_Equip.new(@status_window.index)
  371.       when 3 # 状态
  372.         # 演奏确定 SE
  373.         $game_system.se_play($data_system.decision_se)
  374.         # 切换到状态画面
  375.         $scene = Scene_Status.new(@status_window.index)
  376.       end
  377.       return
  378.     end
  379. end
  380. end

  381. #==============================================================================
  382. # Window_Outside
  383. #------------------------------------------------------------------------------
  384. # 外边框窗口
  385. #==============================================================================
  386. class Window_Outside < Window_Base
  387. #--------------------------------------------------------------------------
  388. # ● 初始化对象
  389. #--------------------------------------------------------------------------
  390. def initialize
  391.     super(160, 384, 480, 96)
  392.     self.back_opacity = 0
  393. end
  394. end
  395. #==============================================================================
  396. # ■ Window_PlayTime
  397. #------------------------------------------------------------------------------
  398. # 菜单画面的系统时间表示
  399. #==============================================================================
  400. class Window_PlayTime < Window_Base
  401. #--------------------------------------------------------------------------
  402. # ● 初始化对像
  403. #--------------------------------------------------------------------------
  404. def initialize
  405.     super(0, 0, 160, 128)
  406.     self.contents = Bitmap.new(width - 32, height - 32)
  407.     self.contents.font.size = 18
  408.     refresh
  409. end
  410. #--------------------------------------------------------------------------
  411. # ● 刷新
  412. #--------------------------------------------------------------------------
  413. def refresh
  414.     self.contents.clear
  415.     self.contents.font.color = system_color
  416.     self.contents.font.color = text_color(6)
  417.     time = Time.now
  418.     text = time.strftime("%x %X")
  419.     self.contents.draw_text(-2, 32, 130, 32, text, 2)
  420.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  421.     hour = @total_sec / 60 / 60
  422.     min = @total_sec / 60 % 60
  423.     sec = @total_sec % 60
  424.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  425.     self.contents.font.color = normal_color
  426.     self.contents.draw_text(4, 0, 160, 32, "日期与游戏时间")
  427.     self.contents.draw_text(-2, 64, 130, 32, text, 2)
  428. end
  429. #--------------------------------------------------------------------------
  430. # ● 更新
  431. #--------------------------------------------------------------------------
  432. def update
  433.     super
  434.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  435.       refresh
  436.     end
  437. end
  438. end
复制代码

点评

第16行代码出现变异,自己改下  发表于 2014-4-18 12:38

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 19:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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