じ☆ve冰风 发表于 2026-8-2 07:38:55

ARK's Screenshot Parallax & Picture Z Manipulation

In advance, I ask excuses for my english. I try to sound natural, but it is not my first language, so... Anyway, there it goes...

This script takes a Screenshot from the curret map and transforms it in a Parallaxfor the next map provided it has the term "~scback" writen in its name.

It also manipulates the Viewports for the Pictures and the Parallax, so every Map that has the term "~evOVpic" in its name will display the pictures behind the events - except the Pictures with numbers from 90 to 100: these ones will still be displayed over events for convinience.

So, please: READ THE TERMS OF USE AND RESPECT THEM.
The most important of them is: GIVE ME A FREE PLAYEABLE COPY OF YOUR GAME.
And read the header's user manual, too.
I acept donnations and make Comissioned Scripts, just send me a PM or e-mail so we can talk about.

So long!

Spoiler# -*- coding: utf-8 -*-
=begin
#======================================================================================#
#================= ARK's Screenshot Parallax & Picture Z Manipulation =================#
#======================================================================================#
* Version : 1.0
* Release Date : 26/July/2018
* License : http://creativecommons.org/licenses/by-nc-nd/4.0/
* Contact : leomjusto@hotmail.com
* Terms of Use :
    - Contact me for commercial use and send me a free copy of your game. (demos and complete)
    - No real support. The script is provided as-is
    - No bug fixes, no compatibility patches
    - Preserve this header
#======================================================================================#
# ABOUT: This script allows the Dev to use the last map image as a Parallax,
   simulating a smooth scene background for those who like to make evented scenes
   instead of scripted ones or just don't know or don't want to script one, but
   still wants the the background to look as nice as a scripted one.

   This script also manipulates the Viewports for Pictures and Parallaxes, so you can use
   it to use pictures behind events. Every Picture with Number from 90 to 100 when this
   Script functions are active will still be displayed over events as a workarround for
   special looking scenes.

# LIMITATIONS: When you teleport from a map to another, events go back to their original
   positions and events that were erased or exited before the telport come back when you
   come back to it. But you can use evented tricks to overcome this problem with Set Position
   commands, Game Variables and Game Switches.
#======================================================================================#
#HOW TO USE:

* SCREENSHOT PARALLAX : To use a last map ScreenShot as Prallax, name the map you wanna
   use as your scene with a "~scback" anywere in its name. Normally it would automatically
   add Blur and Dim to the Screenshot when turning it into a Parallax, but you can deactivate
   those functions adding these lines to the Map Name: "~no_Blur" "~no_Dim"

* PICTURES UNDER EVENTS : Just add "~evOVpic" to your scene map name and this map will
   change the viewports for the Pictures and the Parallax. Pictures with numbers from
   90 to 100 will still be displayed over everything else.

* MAP NAME TAGS:

    ~scback: Use a Screenshot from the last map as Parallax
    ~no_Blur : Deactivate the Blur effect applied to the Screenshot when truning it into Parallax.
    ~no_Dim: Deactivate the Dim effect applied to the Screenshot when turning it into Parallax.
    ~evOVpic : Activates the Viewports manipulation so every picture with numbers from 1 to 89
               will be displyed behind Events and Animations.
#======================================================================================#
#======================================================================================#
#COMPATIBILITY:

* Alias methods
   class Spriteset_Map
   def create_viewports
   def dispose_viewports
   def update_viewports
   def update_parallax

* Overwriten methods
   class Game_Interpreter
   def command_201
   class Spriteset_Map
   def update_pictures
#======================================================================================#
#====================================END OF NOTES======================================#
#======================================================================================#
=end



class Game_Interpreter
#--------------------------------------------------------------------------
# * Transferência do jogador
#--------------------------------------------------------------------------
def command_201
    return if $game_party.in_battle
    Fiber.yield while $game_player.transfer? || $game_message.visible
    if @params == 0                      # Definição direta
      map_id = @params
      x = @params
      y = @params
    else                                    # Definição por variáveis
      map_id = $game_variables[@params]
      x = $game_variables[@params]
      y = $game_variables[@params]
    end   
    $game_system.yield_bitmap_snapshot = nil if $game_system.yield_bitmap_snapshot!=nil

   if $data_mapinfos.name =~ /~scback/
         $game_map.interpreter.wait(7) if $game_message.visible
         $game_system.yield_bitmap_snapshot = Graphics.snap_to_bitmap            
   end      
    $game_player.reserve_transfer(map_id, x, y, @params)
    $game_temp.fade_type = @params
    Fiber.yield while $game_player.transfer?
end
end


class Spriteset_Map
#--------------------------------------------------------------------------
# * Criação do viewport
#--------------------------------------------------------------------------
alias :create_viewports_zero :create_viewports
def create_viewports
    @viewport0 = Viewport.new
    @viewport0.z = -2
    create_viewports_zero
end

#--------------------------------------------------------------------------
# * Disposição dos viewports
#--------------------------------------------------------------------------
alias :dispose_viewports_zero :dispose_viewports
def dispose_viewports
    dispose_viewports_zero
    @viewport0.dispose
end

#--------------------------------------------------------------------------
# * Atualização dos viewports
#--------------------------------------------------------------------------
alias :update_viewports_zero :update_viewports
def update_viewports
      update_viewports_zero   
    @viewport0.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
    @viewport0.update
end

#--------------------------------------------------------------------------
# * Atualização das imagens
#--------------------------------------------------------------------------
def update_pictures
    $game_map.screen.pictures.each do |pic|
      if $data_mapinfos[$game_map.map_id].name =~ /~evOVpic/ && pic.number>=90
            @picture_sprites ||= Sprite_Picture.new(@viewport3, pic)      
            @picture_sprites.update
      else
      @picture_sprites ||= Sprite_Picture.new(@viewport2, pic)
      @picture_sprites.update
      end
    end
end


alias :update_parallax_screenshot :update_parallax
def update_parallax
if$data_mapinfos[$game_map.map_id].name =~ /~scback/
   return if @parallax_name == 'screenshot'
   @viewport2.z = -1 if $data_mapinfos[$game_map.map_id].name =~ /~evOVpic/
   @parallax_name = 'screenshot'
   @parallax.bitmap.dispose if @parallax.bitmap
   source = $game_system.yield_bitmap_snapshot
   $game_system.yield_bitmap_snapshot = nil   
   bitmap = Bitmap.new(Graphics.width,Graphics.height)
@parallax = Plane.new(@viewport0)
      bitmap.stretch_blt(bitmap.rect, source, source.rect)
      @parallax.bitmap = bitmap
      @parallax.bitmap.blur unless $data_mapinfos[$game_map.map_id].name =~ /~noBlur/
      @parallax.color.set(0, 0, 0, 40) unless $data_mapinfos[$game_map.map_id].name =~ /~noDim/
      @parallax.z = -100            
   Graphics.frame_reset
else
    if $data_mapinfos[$game_map.map_id].name =~ /~evOVpic/
            @viewport2.z = -1
         if @parallax_name != $game_map.parallax_name
            @parallax_name = $game_map.parallax_name
            @parallax.bitmap.dispose if @parallax.bitmap
@parallax = Plane.new(@viewport0)
            @parallax.bitmap = Cache.parallax(@parallax_name)
            Graphics.frame_reset
      end
            @parallax.ox = $game_map.parallax_ox(@parallax.bitmap)
            @parallax.oy = $game_map.parallax_oy(@parallax.bitmap)
    else
      @viewport2.z = 50
      update_parallax_screenshot
    end

end
end
end






本贴来自国际rpgmaker官方论坛作者:ArkDG处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/arks-screenshot-parallax-picture-z-manipulation.98192/
页: [1]
查看完整版本: ARK's Screenshot Parallax & Picture Z Manipulation