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

Project1

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

[已经解决] 求VX截取全张地图为图片的脚本

[复制链接]

Lv4.逐梦者

梦石
0
星屑
19284
在线时间
3074 小时
注册时间
2013-1-11
帖子
1288
跳转到指定楼层
1
发表于 2017-6-16 21:14:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求VX截取全张地图为图片的脚本

Lv5.捕梦者 (版主)

梦石
1
星屑
23963
在线时间
3338 小时
注册时间
2011-7-8
帖子
3925

开拓者

来自 2楼
发表于 2017-6-17 00:02:27 | 只看该作者
本帖最后由 guoxiaomi 于 2017-6-17 00:08 编辑

https://littledrago.blogspot.com/2013/08/rgss-map-screenshot.html

http://pastebin.com/raw/S1Ln4hJc

http://pastebin.com/raw/Fh9wxYC9

RUBY 代码复制
  1. #==============================================================================
  2. # Map Screenshot
  3. # Version : 1.06
  4. # Author : LiTTleDRAgo
  5. #==============================================================================
  6. #
  7. #  How to Use :
  8. #     
  9. #     Press F6 to take map screenshot
  10. #     Press F7 to take snapshot
  11. #
  12. #==============================================================================
  13.  
  14. ($imported ||= {})[:drg_map_screenshot_xp] = 1.06
  15.  
  16. text = "This Script needs Drago - Core Engine v1.35 or later"
  17. ($imported[:drg_core_engine] || 0) >= 1.35 || raise(text)
  18. #==============================================================================
  19. # ** Spriteset_Map
  20. #------------------------------------------------------------------------------
  21. #  This class brings together map screen sprites, tilemaps, etc.
  22. #  It's used within the Scene_Map class.
  23. #==============================================================================
  24. class Spriteset_Map
  25.   #--------------------------------------------------------------------------
  26.   # * Constant
  27.   #--------------------------------------------------------------------------
  28.   INPUT_MAP_SCREENSHOT = Input::F6   # Change to nil to disable
  29.   INPUT_SCREENSHOT     = Input::F7   # Change to nil to disable
  30.   SCREENSHOT_FOLDER    = "Screenshot"
  31.   #--------------------------------------------------------------------------
  32.   # * Alias Method
  33.   #--------------------------------------------------------------------------
  34.   alias_sec_method :map_screenshot, :update
  35.   #--------------------------------------------------------------------------
  36.   # * Frame Update
  37.   #--------------------------------------------------------------------------
  38.   def update(*args)
  39.     map_screenshot(*args)
  40.     return if @take_screenshot
  41.     snap_map_screenshot if INPUT_MAP_SCREENSHOT && Input.trigger?(INPUT_MAP_SCREENSHOT)
  42.     snap_screenshot     if INPUT_SCREENSHOT && Input.trigger?(INPUT_SCREENSHOT)
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # * snap_map_screenshot
  46.   #--------------------------------------------------------------------------
  47.   def snap_map_screenshot
  48.     old_time = Time.now
  49.     bitmap = collect_snap_map_bitmap
  50.     name = sprintf("Screenshot - Map%03d", $game_map.map_id)
  51.     export_screenshot(bitmap,"#{name}")
  52.     bitmap.dispose
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # * snap_screenshot
  56.   #--------------------------------------------------------------------------
  57.   def snap_screenshot
  58.     bitmap = Graphics.snap_to_bitmap
  59.     Dir.make_dir(SCREENSHOT_FOLDER) if FileTest.not.directory?(SCREENSHOT_FOLDER)
  60.     dir = Dir.new(SCREENSHOT_FOLDER)
  61.     count = dir.entries.select {|s| s.to_s =~ /Screenshot/ }
  62.     name = sprintf("Screenshot - %03d", count.size + 1)
  63.     count.reverse.each_with_index do |s,i|
  64.       temp = sprintf("Screenshot - %03d", i + 1)
  65.       name = temp if File.not.exist?("#{SCREENSHOT_FOLDER}/#{temp}.png")
  66.     end
  67.     export_screenshot(bitmap,"#{name}")
  68.     bitmap.dispose
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # * export_screenshot
  72.   #--------------------------------------------------------------------------
  73.   def export_screenshot(bitmap,name='snapshot')
  74.     exp_time = (bitmap.height * bitmap.width) * 0.00000664
  75.     string = "Taking screenshot please wait.... \n" +
  76.              "Number of pixels: #{bitmap.height * bitmap.width} \n"+
  77.              "Estimated time: #{exp_time} seconds."
  78.     report_screenshot("#{string.to_s}")
  79.     old_time = Time.now
  80.     Dir.make_dir(SCREENSHOT_FOLDER) if FileTest.not.directory?(SCREENSHOT_FOLDER)
  81.     bitmap.export("#{SCREENSHOT_FOLDER}/#{name}.png")
  82.     if File.exist?("#{SCREENSHOT_FOLDER}/#{name}.png")
  83.       string = "#{name}.png was created. \n" +
  84.                 "File size: width #{bitmap.width}, height #{bitmap.height}. \n" +
  85.                 "Time taken: #{Time.now - old_time} seconds."
  86.     else
  87.       string = "Failed to create #{name}.png.\n" +
  88.               "Time taken: #{Time.now - old_time} seconds."         
  89.     end         
  90.     report_screenshot("#{string.to_s}")
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # * report_screenshot
  94.   #--------------------------------------------------------------------------
  95.   def report_screenshot(*args)
  96.     defined?(Window_BattleActor) ? msgbox(*args) : print(*args)
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * collect_snap_map_bitmap
  100.   #--------------------------------------------------------------------------
  101.   def collect_snap_map_bitmap
  102.     bitmap = Bitmap.new($game_map.width * 32, $game_map.height * 32)
  103.     _w = (($game_map.width / 4) % Graphics.width).floor + 1
  104.     _h = (($game_map.height / 4) % Graphics.height).floor + 1
  105.     _x = (0.._w).to_a.collect {|s| s * Graphics.width}
  106.     _y = (0.._h).to_a.collect {|s| s * Graphics.height}
  107.     _dx = $game_map.display_x
  108.     _dy = $game_map.display_y
  109.     _x.each do |x|
  110.       _y.each do |y|
  111.         $game_map.instance_variable_set(:@display_x, x/tilemap_move_multiplier)
  112.         $game_map.instance_variable_set(:@display_y, y/tilemap_move_multiplier)
  113.         @take_screenshot = true
  114.         update
  115.         Graphics.update unless defined?(Window_ActorCommand)
  116.         snap = Graphics.snap_to_bitmap
  117.         bitmap.blt(x,y,snap,snap.rect)
  118.         snap.dispose
  119.       end
  120.     end
  121.     $game_map.instance_variable_set(:@display_x, _dx)
  122.     $game_map.instance_variable_set(:@display_y, _dy)
  123.     update
  124.     @take_screenshot = false
  125.     bitmap
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # * tilemap_move_multiplier
  129.   #--------------------------------------------------------------------------
  130.   def tilemap_move_multiplier
  131.     n = 1.00 / 4
  132.     n = 1.00 / 8  if defined?(Window_ActorCommand)
  133.     n = 1.00 * 32 if defined?(Window_BattleActor)
  134.     return n
  135.   end  
  136. end


评分

参与人数 1星屑 +40 收起 理由
怪蜀黍 + 40 认可答案

查看全部评分

熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19284
在线时间
3074 小时
注册时间
2013-1-11
帖子
1288
3
 楼主| 发表于 2017-6-17 08:37:08 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
23 小时
注册时间
2016-1-3
帖子
2
4
发表于 2017-7-25 19:55:13 | 只看该作者

请问这个是怎么用的,为什么 Map Screenshot 我放在vx里,启动会报错
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-26 00:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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