查看: 2931|回复: 3

[已经解决] 请问囧魂CG书脚本怎么用?

[复制链接]
梦石
0
星屑
50
在线时间
35 小时
注册时间
2011-3-2
回帖
4
发表于 2015-12-6 17:04:32 | 显示全部楼层 |阅读模式

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

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

×
  我在站内站外搜索了如下关键字:CG书,图鉴,华丽图鉴等等都没找到需要的内容。
  我看了下囧魂的CG书脚本,看不懂啊....然后我依次复制到新建工程里,现在窗口里倒是有点像原作的样子,但是点击好孩子相册无反应。需要怎么修改脚本才能调出CG画面?

   真心跪求,一直都是一个人摸索在做,高中时候就想做个小RPG,直到去年5月才正式动工(话说以前搜集的教程,图块,素材什么的都丢失了真是太遗憾了)现在勉强画完地图了,开始做事件

评分

参与人数 1星屑 +30 收起 理由
冷峻逸 + 30 2011年的新人

查看全部评分

梦石
0
星屑
50
在线时间
35 小时
注册时间
2011-3-2
回帖
4
 楼主| 发表于 2015-12-6 17:08:54 | 显示全部楼层
本帖最后由 RyanBern 于 2015-12-6 19:47 编辑

附:所用到的脚本

CG背景脚本

  1. #==============================================================================
  2. # ■ Window_CGBookBG
  3. #------------------------------------------------------------------------------
  4. #  窗口式CG图鉴系统,尝试使用CG书则打开图鉴(Programed By 狸猫阿白)
  5. #==============================================================================

  6. class Window_Cgbookbg < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     # 调整大小以免显示出多余的箭头
  12.     super(-32, -32, 706, 544)
  13.     self.opacity = 0
  14.     # 设定初始页页数
  15.     $page = 0
  16.     #刷新
  17.     refresh
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 刷新
  21.   #--------------------------------------------------------------------------
  22.   def refresh
  23.     if self.contents != nil
  24.       self.contents.dispose
  25.       self.contents = nil
  26.     end
  27.     self.contents = Bitmap.new(674, 512)
  28.     # 根据当前页数显示背景图片
  29.     background =  RPG::Cache.picture("cgbookbg" + "#{$page + 1}")
  30.      # 调整位置以使图片显示在画面正中间*(注意 32 和 16)
  31.     self.contents.blt(16, 16, background, Rect.new(0, 0, 640, 480), 255)
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 刷新画面
  35.   #--------------------------------------------------------------------------
  36.   def update
  37.     super
  38.     # 必须在背景窗口和选项窗口都设置如果按下 L/R ,否则机器卡的话容易出现
  39.     # 画面残留现象。
  40.     # R 键被按下的情况下
  41.       if Input.trigger?(Input::R)
  42.         # 如果在第3页
  43.         if $page == 2
  44.           #演奏冻结SE
  45.           $game_system.se_play($data_system.buzzer_se)
  46.         # 否则向右翻页
  47.         else
  48.           # 演奏翻页SE
  49.           Audio.se_play("Audio/SE/046-Book01", 100, 100)
  50.           # 向右翻页
  51.           $page += 1
  52.         end  
  53.       end
  54.       # L键被按下的情况下
  55.       if Input.trigger?(Input::L)
  56.         # 如果在第1页
  57.         if $page == 0
  58.           # 演奏冻结SE
  59.           $game_system.se_play($data_system.buzzer_se)
  60.         # 否则向左翻页
  61.         else
  62.           # 演奏翻页SE
  63.           Audio.se_play("Audio/SE/046-Book01", 100, 100)
  64.           # 向左翻页
  65.           $page -= 1
  66.         end  
  67.       end
  68.     # 刷新画面
  69.     refresh
  70.   end
  71. end
复制代码

CG未扩大的小图脚本

  1. #==============================================================================
  2. # ■ Window_CGBook
  3. #------------------------------------------------------------------------------
  4. #  窗口式CF图鉴系统,使用CG书则打开图鉴(Programed By 狸猫阿白)
  5. #   所用窗口外观图形名称:001-Blue1514
  6. #   获得CG脚本:需在事件中运行脚本:
  7. #   示例:在事件中添加下列脚本则获得第1张CG
  8. #   file = File.open("save/cg/cg1.rxdata", "wb")
  9. #   file.close
  10. #==============================================================================

  11. class Window_Cgbook < Window_Selectable
  12.   #--------------------------------------------------------------------------
  13.   # ● 定义实例变量
  14.   #--------------------------------------------------------------------------
  15.   attr_reader   :index                    # 光标位置
  16.   #--------------------------------------------------------------------------
  17.   # ● 初始化对像
  18.   #--------------------------------------------------------------------------
  19.   def initialize
  20.     super(0, 0, 640, 480)
  21.     # 设置每行显示CG小图标的数量
  22.     @column_max = 3
  23.     # 设置CG书窗口使用的皮肤文件
  24.     self.windowskin =  RPG::Cache.windowskin("CG对话框")
  25.     self.opacity = 0
  26.     # 使用图片作为光标
  27.     refresh
  28.     self.index = 0
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 刷新
  32.   #--------------------------------------------------------------------------
  33.   def refresh   
  34.     if self.contents != nil
  35.       self.contents.dispose
  36.       self.contents = nil
  37.     end
  38.     @cg = []
  39.     # 根据当前页数计算该页显示CG图的物品ID
  40.     page_first = $page * 9 + 1
  41.     page_last = [$page * 9 + 9, 23].min
  42.     # 添加CG图片的小图标
  43.     for i in page_first..page_last
  44.       if FileTest.exist?("save/cg/cg" + "#{i}" + ".rxdata" )
  45.         if $page == 0
  46.           case i
  47.           when 1
  48.             @cg.push(RPG::Cache.picture("CG小-踏上旅途的少年"))
  49.           when 2
  50.             @cg.push(RPG::Cache.picture("CG小-新一&兰"))
  51.           when 3
  52.             @cg.push(RPG::Cache.picture("CG小-三段式大笑"))
  53.           when 4
  54.             @cg.push(RPG::Cache.picture("CG小-错乱僧"))
  55.           when 5
  56.             @cg.push(RPG::Cache.picture("CG小-乱&雷易"))
  57.           when 6
  58.             @cg.push(RPG::Cache.picture("CG小-圭子"))
  59.           when 7
  60.             @cg.push(RPG::Cache.picture("CG小-这都是爱啊"))
  61.           when 8
  62.             @cg.push(RPG::Cache.picture("CG小-神木"))
  63.           when 9
  64.             @cg.push(RPG::Cache.picture("CG小-下水道中"))
  65.           end
  66.         end
  67.         if $page == 1
  68.           case i
  69.           when 10
  70.             @cg.push(RPG::Cache.picture("CG小-好人花太郎"))
  71.           when 11
  72.             @cg.push(RPG::Cache.picture("CG小-桂&伊丽莎白"))
  73.           when 12
  74.             @cg.push(RPG::Cache.picture("CG小-人造人十九号"))
  75.           when 13
  76.             @cg.push(RPG::Cache.picture("CG小-欣喜的山本总队长"))
  77.           when 14
  78.             @cg.push(RPG::Cache.picture("CG小-凌波的微笑"))
  79.           when 15
  80.             @cg.push(RPG::Cache.picture("CG小-初号机的报复"))
  81.           when 16
  82.             @cg.push(RPG::Cache.picture("CG小-罗迪王子"))
  83.           when 17
  84.             @cg.push(RPG::Cache.picture("CG小-仙太郎的婚礼"))
  85.           when 18
  86.             @cg.push(RPG::Cache.picture("CG小-结局-白菜之爱版"))
  87.           end
  88.         end
  89.         if $page == 2
  90.           case i
  91.           when 19
  92.             @cg.push(RPG::Cache.picture("CG小-结局-妄想版"))
  93.           when 20
  94.             @cg.push(RPG::Cache.picture("CG小-结局-王子之爱版"))
  95.           when 21
  96.             @cg.push(RPG::Cache.picture("CG小-结局-护卫队版"))
  97.           when 22
  98.             @cg.push(RPG::Cache.picture("CG小-结局-返回现实版"))
  99.           when 23
  100.             @cg.push(RPG::Cache.picture("CG小-结局-穿越版"))
  101.           end
  102.         end
  103.       else  # for [if FileTest.exist?("save/cg/cg" + "#{i}" + ".rxdata" )]
  104.         @cg.push(RPG::Cache.picture("cgsmallempty"))
  105.       end
  106.     end
  107.     # 生成位图、重新描绘全部项目
  108.     @item_max = @cg.size
  109.     self.contents = Bitmap.new(width - 32, 448)
  110.     for i in 0...@item_max
  111.       draw_item(i)
  112.     end
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 描绘项目(CG小图标)
  116.   #     index : CG的物品编号
  117.   #--------------------------------------------------------------------------
  118.   def draw_item(index)
  119.     cg = @cg[index]
  120.     # 每张小图的位置左上角坐标
  121.     if index % 3 == 2
  122.       x = 74 + index % 3 * 176
  123.     else
  124.       x = 75 + index % 3 * 176
  125.     end
  126.     if index / 3 == 0
  127.       y = 52 + index / 3 * 121
  128.     else
  129.       y = 53 + index / 3 * 121
  130.     end
  131.    
  132.     # 描绘选框光标
  133.     #rect = Rect.new(x + 12, y, 140, 110)
  134.     # 描绘CG小图
  135.     self.contents.blt(x, y, cg, Rect.new(0, 0, 120, 90), 255)
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 定义选择框光标
  139.   #--------------------------------------------------------------------------
  140.   def update_cursor_rect
  141.     # 矩形光标选框左上角坐标与CG小图统一
  142.     if index % 3 == 2
  143.       x = 74 + index % 3 * 176
  144.     else
  145.       x = 75 + index % 3 * 176
  146.     end
  147.     if index / 3 == 0
  148.       y = 52 + index / 3 * 121
  149.     else
  150.       y = 53 + index / 3 * 121
  151.     end
  152.     # 更新光标矩形
  153.     self.cursor_rect.set(x - 12, y - 12, 144, 114)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 刷新画面
  157.   #--------------------------------------------------------------------------
  158.   def update
  159.     super
  160.     # 必须在背景窗口和选项窗口都设置如果按下 L/R ,否则机器卡的话容易出现
  161.     # 画面残留现象。
  162.     # 可以移动光标的情况下
  163.     if self.active and @item_max > 0 and @index >= 0
  164.       # R 键被按下的情况下
  165.       if Input.trigger?(Input::R)
  166.         # 如果翻到最后一页且光标超出最后一张图,则把光标指向最后一张图
  167.         if $page == 2 and @index > 4
  168.           @index = 4
  169.         end
  170.       end
  171.       # L 键被按下的情况下
  172.       if Input.trigger?(Input::L)
  173.         # 如果翻到最后一页且光标超出最后一张图,则把光标指向最后一张图
  174.         if $page == 2 and @index > 4
  175.           @index = 4
  176.         end
  177.       end
  178.     end
  179.     # 刷新画面
  180.     refresh
  181.     update_cursor_rect
  182.   end
  183. end
复制代码

显示CG的脚本

  1. #==============================================================================
  2. # ■ Window_Cg
  3. #------------------------------------------------------------------------------
  4. #  CG书卡CG观赏窗口(预留按方向键则直接切换到下1张CG的功能,所以设了refresh)
  5. #==============================================================================

  6. class Window_Cg < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize(cg_id)
  11.     # 调整大小以免显示出多余的箭头
  12.     super(-32, -32, 706, 544)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.opacity = 0
  15.     # 刷新
  16.     refresh(cg_id)
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh(cg_id)
  22.     self.contents.clear
  23.     # CG图片名称中的编号与该CG图在CG书上的index统一
  24.     cg_now = cg_id + 1 + $page * 9
  25.     # 获取CG图片的物品ID
  26.     # 如果已经获得该图则描绘CG
  27.     if FileTest.exist?("save/cg/cg" + "#{cg_now}" + ".rxdata" )
  28.       case cg_now
  29.         when 1
  30.           cg = "CG-踏上旅途的少年"
  31.         when 2
  32.           cg = "CG-新一&兰"
  33.         when 3
  34.           cg = "CG-三段式大笑"
  35.         when 4
  36.           cg = "CG-错乱僧"
  37.         when 5
  38.           cg = "CG-乱&雷易"
  39.         when 6
  40.           cg = "CG-圭子"
  41.         when 7
  42.           cg = "CG-这都是爱啊"
  43.         when 8
  44.           cg = "CG-神木"
  45.         when 9
  46.           cg = "CG-下水道中"
  47.         when 10
  48.           cg = "CG-好人花太郎"
  49.         when 11
  50.           cg = "CG-桂&伊丽莎白"
  51.         when 12
  52.           cg = "CG-人造人十九号"
  53.         when 13
  54.           cg = "CG-欣喜的山本总队长"
  55.         when 14
  56.           cg = "CG-凌波的微笑"
  57.         when 15
  58.           cg = "CG-初号机的报复"
  59.         when 16
  60.           cg = "CG-罗迪王子"
  61.         when 17
  62.           cg = "CG-仙太郎的婚礼"
  63.         when 18
  64.           cg = "CG-结局-白菜之爱版"
  65.         when 19
  66.           cg = "CG-结局-妄想版"
  67.         when 20
  68.           cg = "CG-结局-王子之爱版"
  69.         when 21
  70.           cg = "CG-结局-护卫队版"
  71.         when 22
  72.           cg = "CG-结局-返回现实版"
  73.         when 23
  74.           cg = "CG-结局-穿越版"
  75.         end
  76.       # 描绘图片
  77.       bitmap =  RPG::Cache.picture("#{cg}")
  78.       self.contents.blt(16, 16, bitmap, Rect.new(0, 0, 640, 480), 255)
  79.     end
  80.   end
  81. end
复制代码

窗口选项脚本
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. # ■ 功能加强  BY  狸猫阿白 ■
  4. # ■ 修改了原来在物品窗口不活动时,仍然显示光标的bug
  5. # ■ 新增教训数显示窗口
  6. # ■ 新增卡片书功能
  7. # ■ 新增相册(CG)功能
  8. # ■ 太极图平时使用时消耗 SP
  9. #==============================================================================

  10. #==============================================================================
  11. # ■ Harts_Window_ItemTitle
  12. #------------------------------------------------------------------------------
  13. #  アイテム画面で、タイトルを表示するウィンドウ。
  14. #==============================================================================

  15. class Harts_Window_ItemTitle < Window_Base
  16.   #--------------------------------------------------------------------------
  17.   # ● オブジェクト初期化
  18.   #--------------------------------------------------------------------------
  19.   def initialize
  20.     super(0, 0, 160, 64)
  21.     self.contents = Bitmap.new(width - 32, height - 32)
  22.     self.contents.clear
  23.     self.contents.font.color = normal_color
  24.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  25.   end
  26. end

  27. #==============================================================================
  28. # ■ Harts_Window_ItemCommand
  29. #------------------------------------------------------------------------------
  30. #  アイテムの種別選択を行うウィンドウです。
  31. #==============================================================================

  32. class Harts_Window_ItemCommand < Window_Selectable
  33.   #--------------------------------------------------------------------------
  34.   # ● オブジェクト初期化
  35.   #--------------------------------------------------------------------------
  36.   def initialize
  37.     super(0, 64, 160, 288)
  38.     self.contents = Bitmap.new(width - 32, height - 32)
  39.     @item_max = 8
  40.     @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
  41.     refresh
  42.     self.index = 0
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● リフレッシュ
  46.   #--------------------------------------------------------------------------
  47.   def refresh
  48.     self.contents.clear
  49.     for i in 0...@item_max
  50.     draw_item(i, normal_color)
  51.     end
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 項目の描画
  55.   # index : 項目番号
  56.   # color : 文字色
  57.   #--------------------------------------------------------------------------
  58.   def draw_item(index, color)
  59.     self.contents.font.color = color
  60.     y = index * 32
  61.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● ヘルプテキスト更新
  65.   #--------------------------------------------------------------------------
  66.   def update_help
  67.     case self.index
  68.     when 0
  69.       @text = "目前可以使用的物品。"
  70.     when 1
  71.       @text = "只能在战斗中使用的物品。"
  72.     when 2
  73.       @text = "未装备的武器。"
  74.     when 3
  75.       @text = "未装备的副手防具。"
  76.     when 4
  77.       @text = "未装备的头部防具。"
  78.     when 5
  79.       @text = "未装备的身体防具。"
  80.     when 6
  81.       @text = "未装备的装饰品。"
  82.     when 7
  83.       @text = "无法直接使用的剧情道具,只要持有就会在需要时自行用到。"
  84.     end
  85.     @help_window.set_text(@text)
  86.   end
  87. end

  88. #==============================================================================
  89. # ■ Window_Item
  90. #------------------------------------------------------------------------------
  91. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  92. #==============================================================================

  93. class Harts_Window_ItemList < Window_Selectable
  94.   #--------------------------------------------------------------------------
  95.   # ● オブジェクト初期化
  96.   #--------------------------------------------------------------------------
  97.   def initialize
  98.     super(160, 0, 480, 416)
  99.     refresh
  100.      # ■■■ 物品显示窗口初始光标在-1位置,使玩家看不到光标 ■■■
  101.     self.index = -1
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● アイテムの取得
  105.   #--------------------------------------------------------------------------
  106.   def item
  107.     return @data[self.index]
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● リフレッシュ
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     if self.contents != nil
  114.       self.contents.dispose
  115.       self.contents = nil
  116.     end
  117.     @data = []
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● アイテム一覧設定
  121.   # command : 選択中のコマンド
  122.   #--------------------------------------------------------------------------
  123.   def set_item(command)
  124.     refresh
  125.     case command
  126.     when 0
  127.       for i in 1...$data_items.size
  128.         if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
  129.           @data.push($data_items[i])
  130.         end
  131.       end
  132.     when 1
  133.         for i in 1...$data_items.size
  134.           if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
  135.             @data.push($data_items[i])
  136.           end
  137.         end
  138.     when 2
  139.       for i in 1...$data_weapons.size
  140.         if $game_party.weapon_number(i) > 0
  141.           @data.push($data_weapons[i])
  142.         end
  143.       end
  144.     when 3
  145.       for i in 1...$data_armors.size
  146.         if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
  147.           @data.push($data_armors[i])
  148.         end
  149.       end
  150.     when 4
  151.       for i in 1...$data_armors.size
  152.         if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
  153.           @data.push($data_armors[i])
  154.         end
  155.       end
  156.     when 5
  157.       for i in 1...$data_armors.size
  158.         if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
  159.           @data.push($data_armors[i])
  160.         end
  161.       end
  162.     when 6
  163.       for i in 1...$data_armors.size
  164.         if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
  165.           @data.push($data_armors[i])
  166.         end
  167.       end
  168.     when 7
  169.       for i in 1...191
  170.         if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
  171.           @data.push($data_items[i])
  172.         end
  173.       end
  174.     end
  175.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  176.     @item_max = @data.size
  177.     if @item_max > 0
  178.       self.contents = Bitmap.new(width - 32, row_max * 32)
  179.       self.contents.clear
  180.       for i in 0...@item_max
  181.         draw_item(i)
  182.       end
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 種類別アイテム数の取得
  187.   #--------------------------------------------------------------------------
  188.   def item_number
  189.     return @item_max
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 項目の描画
  193.   # index : 項目番号
  194.   #--------------------------------------------------------------------------
  195.   def draw_item(index)
  196.     item = @data[index]
  197.     case item
  198.     when RPG::Item
  199.       number = $game_party.item_number(item.id)
  200.     when RPG::Weapon
  201.       number = $game_party.weapon_number(item.id)
  202.     when RPG::Armor
  203.       number = $game_party.armor_number(item.id)
  204.     end
  205.     if item.is_a?(RPG::Item) and
  206.       $game_party.item_can_use?(item.id)
  207.       self.contents.font.color = normal_color
  208.     else
  209.       self.contents.font.color = disabled_color
  210.     end
  211.     x = 4
  212.     y = index * 32
  213.     bitmap = RPG::Cache.icon(item.icon_name)
  214.     opacity = self.contents.font.color == normal_color ? 255 : 128
  215.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  216.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  217.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  218.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● ヘルプテキスト更新
  222.   #--------------------------------------------------------------------------
  223.   def update_help
  224.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  225.   end
  226. end

  227. #==============================================================================
  228. # ■ Harts_Scene_Item
  229. #------------------------------------------------------------------------------
  230. #  アイテム画面の処理を行うクラスです。再定義
  231. #==============================================================================

  232. class Scene_Item
  233.   #--------------------------------------------------------------------------
  234.   # ● メイン処理
  235.   #--------------------------------------------------------------------------
  236.   def main
  237.     # タイトルウィンドウを作成
  238.     @itemtitle_window = Harts_Window_ItemTitle.new
  239.     #コマンドウィンドウを作成
  240.     @itemcommand_window = Harts_Window_ItemCommand.new
  241.     @command_index = @itemcommand_window.index
  242.     #アイテムウィンドウを作成
  243.     @itemlist_window = Harts_Window_ItemList.new
  244.     @itemlist_window.active = false
  245.     #ヘルプウィンドウを作成
  246.     @help_window = Window_Help.new
  247.     @help_window.x = 0
  248.     @help_window.y = 416
  249.     # ヘルプウィンドウを関連付け
  250.     @itemcommand_window.help_window = @help_window
  251.     @itemlist_window.help_window = @help_window
  252.     # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
  253.     @target_window = Window_Target.new
  254.     @target_window.visible = false
  255.     @target_window.active = false
  256.     # アイテムウィンドウ内容表示
  257.     @itemlist_window.set_item(@command_index)
  258.     # ■生成教训窗口
  259.     @lesson_window = Window_Lesson.new
  260.     # トランジション実行
  261.     Graphics.transition
  262.     # メインループ
  263.     loop do
  264.       # ゲーム画面を更新
  265.       Graphics.update
  266.       # 入力情報を更新
  267.       Input.update
  268.       # フレーム更新
  269.       update
  270.       # 画面が切り替わったらループを中断
  271.       if $scene != self
  272.         break
  273.       end
  274.     end
  275.     # トランジション準備
  276.     Graphics.freeze
  277.     # ウィンドウを解放
  278.     @itemtitle_window.dispose
  279.     @itemcommand_window.dispose
  280.     @itemlist_window.dispose
  281.     @help_window.dispose
  282.     @target_window.dispose
  283.     # ■ 释放教训窗口
  284.     @lesson_window.dispose
  285.     # ■(防出错)如果CG书相关窗口和卡片书相关窗口存在,则释放它们
  286.     if @cgbookbg_window != nil
  287.       @cgbookbg_window.dispose
  288.     end
  289.     if @cgbook_window != nil
  290.       @cgbook_window.dispose
  291.     end
  292.     if @cg_window != nil
  293.       @cg_window.dispose
  294.     end
  295.     if @cardbookbg_window != nil
  296.       @cardbookbg_window.dispose
  297.     end
  298.     if @cardbook_window != nil
  299.       @cardbook_window.dispose
  300.     end
  301.     if @card_window != nil
  302.       @card_window.dispose
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● フレーム更新
  307.   #--------------------------------------------------------------------------
  308.   def update
  309.     # ウィンドウを更新
  310.     @itemtitle_window.update
  311.     @itemcommand_window.update
  312.     @itemlist_window.update
  313.     @help_window.update
  314.     @target_window.update
  315.     if @command_index != @itemcommand_window.index
  316.       @command_index = @itemcommand_window.index
  317.       @itemlist_window.set_item(@command_index)
  318.     end
  319.     # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
  320.     if @itemcommand_window.active
  321.       update_itemcommand
  322.       return
  323.     end
  324.     # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
  325.     if @itemlist_window.active
  326.       update_itemlist
  327.       return
  328.     end
  329.    
  330.     # ■CG书窗口被激活的情况下: 调用 update_cgbook
  331.     if @cgbook_window != nil and @cgbook_window.active and @cgbookbg_window != nil and @cgbook_window.active
  332.         update_cgbook
  333.       return
  334.     end      
  335.     # ■CG欣赏窗口被激活的情况下: 调用 update_cg
  336.     if  @cg_window != nil and @cg_window.active
  337.         update_cg
  338.       return
  339.     end  
  340.     # ■卡片书窗口被激活的情况下:
  341.     if @cardbook_window != nil and @cardbook_window.active
  342.       # 如果卡片观赏窗口被激活:调用 update_card
  343.       if @card_window != nil and @card_window.active
  344.         update_card
  345.       # 此外的情况下:调用 update_cardbook
  346.       else
  347.         update_cardbook
  348.       end
  349.       return
  350.     end
  351.     # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
  352.     if @target_window.active
  353.       update_target
  354.       return
  355.     end
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  359.   #--------------------------------------------------------------------------
  360.   def update_itemcommand
  361.   # B ボタンが押された場合
  362.   if Input.trigger?(Input::B)
  363.   # キャンセル SE を演奏
  364.   $game_system.se_play($data_system.cancel_se)
  365.   # メニュー画面に切り替え
  366.   $scene = Scene_Menu.new(0)
  367.   return
  368.   end
  369.   # C ボタンが押された場合
  370.   if Input.trigger?(Input::C)
  371.   # 選択中のコマンドのアイテムがない場合
  372.   if @itemlist_window.item_number == 0
  373.   # ブザー SE を演奏
  374.   $game_system.se_play($data_system.buzzer_se)
  375.   return
  376.   end
  377.   # 決定 SE を演奏
  378.   $game_system.se_play($data_system.decision_se)
  379.   # アイテムウィンドウをアクティブにする
  380.   @itemcommand_window.active = false
  381.   @itemlist_window.active = true
  382.   @itemlist_window.index = 0
  383.   return
  384.   end
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  388.   #--------------------------------------------------------------------------
  389.   def update_itemlist
  390.     # B ボタンが押された場合
  391.     if Input.trigger?(Input::B)
  392.       # キャンセル SE を演奏
  393.       $game_system.se_play($data_system.cancel_se)
  394.       # アイテムウィンドウをアクティブにする
  395.       @itemcommand_window.active = true
  396.       @itemlist_window.active = false
  397.       # ■■■ 物品显示窗口光标位置回到0,使玩家看到该类物品列表的最开始 ■■■
  398.       @itemlist_window.index = 0
  399.       # ■■■ 物品显示窗口光标位置回到-1,使光标消失 ■■■
  400.       @itemlist_window.index = -1
  401.       @itemcommand_window.index = @command_index
  402.       return
  403.     end
  404.     # C ボタンが押された場合
  405.     if Input.trigger?(Input::C)
  406.       # アイテムウィンドウで現在選択されているデータを取得
  407.       @item = @itemlist_window.item
  408.       # 使用アイテムではない場合
  409.       unless @item.is_a?(RPG::Item)
  410.         # ブザー SE を演奏
  411.         $game_system.se_play($data_system.buzzer_se)
  412.         return
  413.       end
  414.       # 使用できない場合
  415.       unless $game_party.item_can_use?(@item.id)
  416.         # ブザー SE を演奏
  417.         $game_system.se_play($data_system.buzzer_se)
  418.         return
  419.       end
  420.       # 決定 SE を演奏
  421.       $game_system.se_play($data_system.decision_se)
  422.       # ■所使用物品是CG书的情况下
  423.       if @item == $data_items[2]
  424.         # 演奏打开书的SE
  425.         Audio.se_play("Audio/SE/打开书", 100, 100)
  426.         # 窗口状态转向CG书模式(过渡)
  427.         Graphics.freeze
  428.         @help_window.active = false
  429.         @help_window.visible = false
  430.         @itemlist_window.active = false
  431.         @itemlist_window.visible = false
  432.         @itemtitle_window.visible = false
  433.         @itemcommand_window.visible = false
  434.         @lesson_window.visible = false
  435.         # ■ 生成CG书背景窗口和CG书窗口,先生成的会被后生成的挡住。
  436.         @cgbookbg_window = Window_Cgbookbg.new
  437.         @cgbook_window = Window_Cgbook.new
  438.         # 设置打开CG图片时的渐变图,不设则自动淡入淡出,下同
  439.         Graphics.transition(20, "Graphics/Transitions/data 000091")
  440.         return
  441.       end
  442.       # ■所使用物品是集卡书的情况下
  443.       if @item == $data_items[5]
  444.         # 演奏打开书的SE
  445.         Audio.se_play("Audio/SE/打开书", 100, 100)
  446.         # 窗口状态转向卡片书模式(过渡)
  447.         Graphics.freeze
  448.         @help_window.active = false
  449.         @help_window.visible = false
  450.         @itemlist_window.active = false
  451.         @itemlist_window.visible = false
  452.         @itemtitle_window.visible = false
  453.         @itemcommand_window.visible = false
  454.         @lesson_window.visible = false
  455.         @cardbookbg_window = Window_Cardbookbg.new
  456.         @cardbook_window = Window_Cardbook.new
  457.         Graphics.transition(20, "Graphics/Transitions/data 000091")
  458.         return
  459.       end
  460.       # 効果範囲が味方の場合
  461.       if @item.scope >= 3
  462.         # ターゲットウィンドウをアクティブ化
  463.         @itemlist_window.active = false
  464.         @target_window.x = 304
  465.         @target_window.visible = true
  466.         @target_window.active = true
  467.         # 効果範囲 (単体/全体) に応じてカーソル位置を設定
  468.         if @item.scope == 4 || @item.scope == 6
  469.           @target_window.index = -1
  470.         else
  471.           @target_window.index = 0
  472.         end
  473.         # 効果範囲が味方以外の場合
  474.       else
  475.         # コモンイベント ID が有効の場合
  476.         if @item.common_event_id > 0
  477.           # コモンイベント呼び出し予約
  478.           $game_temp.common_event_id = @item.common_event_id
  479.           # アイテムの使用時 SE を演奏
  480.           $game_system.se_play(@item.menu_se)
  481.           # 消耗品の場合
  482.             if @item.consumable
  483.               # 使用したアイテムを 1 減らす
  484.               $game_party.lose_item(@item.id, 1)
  485.               # アイテムウィンドウの項目を再描画
  486.               @itemlist_window.draw_item(@itemlist_window.index)
  487.             end
  488.           # マップ画面に切り替え
  489.           $scene = Scene_Map.new
  490.           return
  491.         end
  492.       end
  493.       return
  494.     end
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ■■■刷新画面 (CG书窗口被激活的情况下)
  498.   #--------------------------------------------------------------------------
  499.   def update_cgbook
  500.     @cgbookbg_window.update
  501.     @cgbook_window.update
  502.     if Input.trigger?(Input::B)
  503.       # 演奏合上书的SE
  504.       Audio.se_play("Audio/SE/合上书", 100, 100)
  505.       # 窗口状态转向初期模式(过渡)
  506.       Graphics.freeze
  507.       @help_window.active = true
  508.       @help_window.visible = true
  509.       @itemlist_window.active = true
  510.       @itemlist_window.visible = true
  511.       @itemtitle_window.visible = true
  512.       @itemcommand_window.visible = true
  513.       @lesson_window.visible = true
  514.       # 释放CG书背景窗口
  515.       @cgbookbg_window.dispose  
  516.       # 为避免出错,将CG书背景窗口设为nil
  517.       @cgbookbg_window = nil
  518.       # 释放CG书窗口
  519.       @cgbook_window.dispose
  520.       # 将CG书窗口设为nil,否则在 update 方法中会与
  521.       # if @cgbook_window != nil and @cgbook_window.active 这类的判断出错
  522.       # (会判断该类窗口已经dispose而报错,强退游戏),下同。
  523.       @cgbook_window = nil
  524.       Graphics.transition(20, "Graphics/Transitions/data 00314")
  525.       return   
  526.     end
  527.     # 按下 C 键的情况下
  528.     if Input.trigger?(Input::C)
  529.       if FileTest.exist?("save/cg/cg" + "#{@cgbook_window.index + $page * 9 + 1}" + ".rxdata")
  530.         # 演奏确定 SE
  531.         $game_system.se_play($data_system.decision_se)
  532.         # 打开CG观赏窗口(过渡)
  533.         Graphics.freeze
  534.         @cgbookbg_window.visible = false
  535.         @cgbook_window.active = false
  536.         @cgbook_window.visible = false
  537.         @cg_window = Window_Cg.new(@cgbook_window.index)
  538.         #  如果是第 20 号 CG,则做套图第 1 张标记
  539.         if @cgbook_window.index + $page * 9 + 1 == 20
  540.           @cg_i = 1
  541.         end
  542.         Graphics.transition(10)
  543.       else
  544.         $game_system.se_play($data_system.buzzer_se)
  545.         return
  546.       end
  547.     end
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ■■■刷新画面 (CG欣赏窗口被激活的情况下)
  551.   #--------------------------------------------------------------------------
  552.   def update_cg
  553.     # 如果按下 取消 键,或按下 确定 键时没有套图第1张标记
  554.     if Input.trigger?(Input::B) or (@cg_i != 1 and Input.trigger?(Input::C))
  555.       # 演奏取消 SE
  556.       $game_system.se_play($data_system.cancel_se)
  557.       # 释放CG欣赏窗口(过渡)
  558.       Graphics.freeze
  559.       @cg_window.dispose
  560.       # 将CG欣赏窗口设为nil
  561.       @cg_window = nil
  562.       @cg_i = nil
  563.       # 窗口状态转向CG书模式
  564.       @cgbookbg_window.visible = true
  565.       @cgbook_window.active = true
  566.       @cgbook_window.visible = true
  567.       # 设置关闭CG图片时的渐变图,不设则自动淡入淡出
  568.       Graphics.transition(10)
  569.       return   
  570.     end   
  571.     # 如果按下 确定 键时有套图第 1 张标记
  572.     if Input.trigger?(Input::C) and @cg_i == 1
  573.       # 演奏翻页 SE
  574.       Audio.se_play("Audio/SE/046-Book01", 100, 100)
  575.       # 准备过渡
  576.       Graphics.freeze
  577.       @cg_window.contents.clear
  578.       bitmap =  RPG::Cache.picture("CG-结局-王子之爱版2")
  579.       @cg_window.contents.blt(16, 16, bitmap, Rect.new(0, 0, 640, 480), 255)
  580.       # 套图标记更新为第 2 张
  581.       @cg_i += 1
  582.       Graphics.transition(10)
  583.     end   
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ■■■刷新画面 (仅卡片书窗口被激活的情况下)
  587.   #--------------------------------------------------------------------------
  588.   def update_cardbook
  589.     @cardbookbg_window.update
  590.     @cardbook_window.update
  591.     if Input.trigger?(Input::B)
  592.       # 演奏合上书的SE
  593.       Audio.se_play("Audio/SE/合上书", 100, 100)
  594.       # 窗口状态转向初期模式(过渡)
  595.       Graphics.freeze
  596.       @help_window.active = true
  597.       @help_window.visible = true
  598.       @itemlist_window.active = true
  599.       @itemlist_window.visible = true
  600.       @itemtitle_window.visible = true
  601.       @itemcommand_window.visible = true
  602.       @lesson_window.visible = true
  603.       # 释放卡片书背景窗口
  604.       @cardbookbg_window.dispose
  605.       # 将卡片书背景窗口设为nil
  606.       @cardbookbg_window = nil
  607.       # 释放卡片书窗口
  608.       @cardbook_window.dispose
  609.       # 将卡片书窗口设为nil
  610.       @cardbook_window = nil
  611.       Graphics.transition(20, "Graphics/Transitions/data 00314")
  612.       return   
  613.     end
  614.     # 按下 C 键的情况下
  615.     if Input.trigger?(Input::C)
  616.       # 演奏确定 SE
  617.       $game_system.se_play($data_system.decision_se)
  618.       # 窗口状态转向卡片书与卡片欣赏共存模式(过渡)
  619.       Graphics.freeze
  620.       @card_window = Window_Card.new(@cardbook_window.index + $page * 12)
  621.       @card_window.x = (@cardbook_window.index / 2 + 1 ) % 2 * 294 + 10
  622.       Graphics.transition(5)
  623.     end
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ■■■刷新画面 (卡片书窗口与卡片欣赏窗口同时被激活的情况下)
  627.   #--------------------------------------------------------------------------
  628.   def update_card
  629.     @cardbookbg_window.update
  630.     @cardbook_window.update
  631.     @card_window.x = (@cardbook_window.index / 2 + 1 ) % 2 * 294 + 10
  632.     @card_window.refresh(@cardbook_window.index + $page * 12)
  633.     # 按下 B 键 & C 键的情况下
  634.     if Input.trigger?(Input::B) or Input.trigger?(Input::C)
  635.       # 演奏取消 SE
  636.       $game_system.se_play($data_system.cancel_se)
  637.       # 释放卡片欣赏窗口(过渡)
  638.       Graphics.freeze
  639.       @card_window.dispose
  640.       # 将卡片欣赏窗口设为nil
  641.       @card_window = nil
  642.       Graphics.transition(5)
  643.       return
  644.     end
  645.     if Input.trigger?(Input::R) or Input.trigger?(Input::L)
  646.       # 释放卡片欣赏窗口(不过渡)
  647.       @card_window.dispose
  648.       # 将卡片欣赏窗口设为nil
  649.       @card_window = nil
  650.       return
  651.     end
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  655.   #--------------------------------------------------------------------------
  656.   def update_target
  657.     # B ボタンが押された場合
  658.     if Input.trigger?(Input::B)
  659.       # キャンセル SE を演奏
  660.       $game_system.se_play($data_system.cancel_se)
  661.       # アイテム切れなどで使用できなくなった場合
  662.       unless $game_party.item_can_use?(@item.id)
  663.         # アイテムウィンドウの内容を再作成
  664.         @itemlist_window.refresh
  665.       end
  666.       # ターゲットウィンドウを消去
  667.       @itemlist_window.active = true
  668.       @target_window.visible = false
  669.       @target_window.active = false
  670.       @itemlist_window.set_item(@command_index)
  671.       return
  672.     end
  673.     # C ボタンが押された場合
  674.     if Input.trigger?(Input::C)
  675.       # アイテムを使い切った場合
  676.       if $game_party.item_number(@item.id) == 0
  677.         # ブザー SE を演奏
  678.         $game_system.se_play($data_system.buzzer_se)
  679.         return
  680.       end
  681.       # ターゲットが全体の場合
  682.       if @target_window.index == -1
  683.         # パーティ全体にアイテムの使用効果を適用
  684.         used = false
  685.         for i in $game_party.actors
  686.           used |= i.item_effect(@item)
  687.         end
  688.       end
  689.       # ターゲットが単体の場合
  690.       if @target_window.index >= 0
  691.         # ターゲットのアクターにアイテムの使用効果を適用
  692.         target = $game_party.actors[@target_window.index]
  693.         used = target.item_effect(@item)
  694.       end
  695.       # アイテムを使った場合
  696.       if used
  697.         # アイテムの使用時 SE を演奏
  698.         $game_system.se_play(@item.menu_se)
  699.         # 消耗品の場合
  700.         if @item.consumable
  701.           # 使用したアイテムを 1 減らす
  702.           $game_party.lose_item(@item.id, 1)
  703.           # アイテムウィンドウの項目を再描画
  704.           @itemlist_window.draw_item(@itemlist_window.index)
  705.           @itemlist_window.set_item(@command_index)
  706.         end
  707.         # ■■■■■■■ 如果使用的是[太极图] ■■■■■■■
  708.         if @item.id == 39
  709.           for actor in $game_party.actors
  710.             if actor.sp >= 200
  711.               actor.sp -= 200
  712.               break
  713.             end
  714.           end
  715.         end
  716.         # ■■■■■■■■■■■ END ■■■■■■■■■■
  717.         # ターゲットウィンドウの内容を再作成
  718.         @target_window.refresh
  719.         # 全滅の場合
  720.         if $game_party.all_dead?
  721.           # ゲームオーバー画面に切り替え
  722.           $scene = Scene_Gameover.new
  723.           return
  724.         end
  725.         # コモンイベント ID が有効の場合
  726.         if @item.common_event_id > 0
  727.           # コモンイベント呼び出し予約
  728.           $game_temp.common_event_id = @item.common_event_id
  729.           # マップ画面に切り替え
  730.           $scene = Scene_Map.new
  731.           return
  732.         end
  733.       end
  734.       # アイテムを使わなかった場合
  735.       unless used
  736.         # ブザー SE を演奏
  737.         $game_system.se_play($data_system.buzzer_se)
  738.       end
  739.     return
  740.     end
  741.   end
  742. end

  743. #==============================================================================
  744. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  745. #==============================================================================
复制代码

点评

……虽然原理很简单,但这毕竟也是囧魂的加密原创脚本,请不要破解之后还把它公开发出来吧= =  发表于 2015-12-10 09:56
为了减少版面篇幅,已经将所有的脚本搬到2L,删除了其他的楼层。  发表于 2015-12-6 19:49
回复

使用道具 举报

梦石
0
星屑
50
在线时间
35 小时
注册时间
2011-3-2
回帖
4
 楼主| 发表于 2015-12-7 16:04:16 | 显示全部楼层
绝恋小萧 发表于 2015-12-6 17:08
附:所用到的脚本

[fold=CG背景脚本]

谢谢你。我是新来的,不太懂
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2015-12-8 22:46:02 | 显示全部楼层
测试不能……缺了个叫【Window_Lesson】的脚本,然后各种缺图片音效什么的,
然后看了下脚本,打开CG书和卡片书的话要使用ID2号和ID5物品,其他的ID的物品不会打开。

点评

那个是教训积累的脚本,我复制了。ID2和ID5物品分别是好孩子相册和集卡书,都复制了,测试还是不行。算了,我已经放弃了,谢谢  发表于 2015-12-12 09:45
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部