Simple Map Screenshot
Version: 1.0
Author: cozziekuns, Zeus91
Date: September 5th, 2011
Version History
- <Version 1.0> 2011.05.09 - Original Release
Planned Future Versions
- Will look into adding support for events and characters.
Description
This script allows you to take a screenshot of a whole map, depending on the map id. The screenshot will not include the characters.
Features
- Configurable screenshot key
- Changable path for where you want to save the screenshot
- Can force a screenshot from Scene_Map.
Instructions
See script. This script requires my
Tilemap to Bitmap Converter.
Script
#
# This script requires my Tilemap to Bitmap Converter, which can be found at:
# http://pastebin.com/raw.php?i=Jmqcn5rq
#
#===============================================================================
# Simple Map Screenshot
#-------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns (rmrk)
# Last Date Updated: 9/5/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# This script allows you to take a screenshot of a whole map, depending on the
# map id. The screenshot will not include the characters.
#===============================================================================
# Updates
# ------------------------------------------------------------------------------
# o 9/5/2011 - Started Script.
#===============================================================================
# To-do List
#-------------------------------------------------------------------------------
# o May include support for characters and events.
#===============================================================================
# Instructions
#-------------------------------------------------------------------------------
# Copy and paste this script above Main Process but below Materials. Change the
# modules as you wish.
#
# You can force a screenshot on the current map by using an event script call
# (split into three lines).
#
# id = $game_map.map_id
# b = $game_system.tilemap_to_bitmap(id)
# $scene.take_tilemap_screenshot(b)
#
# Scripters can force a screenshot from Scene_Map by using method
# take_tilemap_screenshot($game_system.tilemap_to_bitmap(map_id)), where map_id
# is the id of the map you want to force a screenshot of.
#===============================================================================
module COZZIEKUNS
module MAP_SCREENSHOT
SCREENSHOT_BUTTON = Input::F5
SCREENSHOT_PATH = "Tilemap" # What the screenshot saves as
end
end
#=============================================================================
# ** Bitmap Export by Zeus81
#=============================================================================
class Bitmap
RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
def address
RtlMoveMemory_pi.call(a = "\0" * 4, __id__ * 2 + 16, 4)
RtlMoveMemory_pi.call(a, a.unpack('L')[0] + 8, 4)
RtlMoveMemory_pi.call(a, a.unpack('L')[0] + 16, 4)
a.unpack('L')[0]
end
def make_png(filename)
file = File.open(filename, 'wb')
def file.write_chunk(chunk)
write([chunk.size-4].pack('N'))
write(chunk)
write([Zlib.crc32(chunk)].pack('N'))
end
file.write("\211PNG\r\n\32\n")
file.write_chunk("IHDR#{[width,height,8,6,0,0,0].pack('N2C5')}")
RtlMoveMemory_pi.call(data="\0"*(width*height*4), address, data.size)
(width*height).times {|i| data[i<<=2,3] = data[i,3].reverse!}
deflate, null_char, w4 = Zlib::Deflate.new(9), "\0", width*4
(height-1).downto(0) {|i| deflate << null_char << data[i*w4,w4]}
file.write_chunk("IDAT#{deflate.finish}")
deflate.close
file.write_chunk('IEND')
file.close
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
alias coz_terrainzoom_sm_update update
def update(*args)
coz_terrainzoom_sm_update(*args)
if Input.trigger?(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_BUTTON)
take_tilemap_screenshot($game_system.tilemap_to_bitmap($game_map.map_id)) rescue raise("This script requires Tilemap to Bitmap Convereter, which can be found at http://pastebin.com/raw.php?i=Jmqcn5rq")
end
end
def take_tilemap_screenshot(bitmap)
raise "#{bitmap} is not a bitmap" if not bitmap.is_a?(Bitmap)
i = 1
while FileTest.exist?(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_PATH + i.to_s + ".png")
i += 1
end
bitmap.make_png(COZZIEKUNS::MAP_SCREENSHOT::SCREENSHOT_PATH + i.to_s + ".png")
end
end
Credit
- cozziekuns
- Zeus91, for the Bitmap Exporter script
Support
Post down below.
Known Compatibility Issues
Will not work with parallax maps.