Introduction
Designed solely for MGC's (MGCaladtogel's) FPLE Version 1.5 system, this add-on gives the game designer the ability to raise or lower the apparent camera height while within a labyrinth map.
Understand that this is a 'cheat' and actively stretches the game viewport beyond the confines of the visible game window to allow the scrolling or camera adjusting effect.
Script
"Yep, the script is here"
Code:
#==============================================================================
# ** FPLE Camera Height
# FPLE Add-on
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.3
# 11-30-2016
# RGSS / RPGMaker XP
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
# Designed solely for MGC's (MGCaladtogel's) FPLE Version 1.5 system, this
# add-on gives the game designer the ability to raise or lower the apparent
# camera height while within a labyrinth map.
#
# Understand that this is a 'cheat' and actively stretches the game viewport
# beyond the confines of the visible game window to allow the scrolling or
# camera adjusting effect.
#
#
#
#------------------------------------------------------------------------------
#
# CONFIGURATION:
#
# The DVV_FPLE module has only two values. The first governs how much of
# the game screen is zoomed. By default, it is set to 120. And that means
# the viewport has been stretched an additional 120px on all sides. And the
# second value indicates how default speed of the camera slide effect. The
# camera slide effect is the effect when the camera's viewport slides up or
# down to match the height requested by the 'fple_ht_slide' script call.
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS:
#
# * fple_ht_set(value)
# This script call sets the camera height. It doesn't raise or lower the
# camera by increments, but assumes the value entered to be the height
# itself. A value of 0 indicates the default camera height.
#
# * fple_ht_change(value)
# This script call adjusts the camera height by an incremental value. The
# change itself is instantaneous. There is no gradual raising or lowering
# of the viewport, and may appear jarring. However, the jarring effect
# may work out for effects like pseudo-3D steps or the like.
#
# * fple_ht_slide(value)
# This script call adjusts the camera height by an incremental value. The
# change itself is gradual, and the speed of the camera height change is
# based upon the $game_system.fple_htspd value (defaulted to the setting
# in the DVV_FPLE module).
#
# * $game_system.fple_htspd = (value)
# With this script call, you can change the speed in which the camera
# slides the viewport height. Recommended speed is 5.
#
#
#==============================================================================
#
# TERMS AND CONDITIONS:
#
# Free for use, even in commercial games. And as this script was requested
# by PepperTrooper, you have to give both of us credit for this script.
#
#==============================================================================
module DVV_FPLE
Ht_Zoom = 120 # Increase buffer around viewport in pixels
Ht_Speed = 3 # Default speed of height change (Default 5)
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fple_ht # View Height Value for FPLE
attr_accessor :fple_htspd # Speed of Height View Adjustment
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias initialize_fple_dvv_game_system initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Perform the original call
initialize_fple_dvv_game_system
# Add the basic height value
@fple_ht = 0
@fple_htspd = DVV_FPLE::Ht_Speed
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fple_ht # Temporary Ht Adjustment for FPLE
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias initialize_fple_dvv_game_temp initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Perform the original call
initialize_fple_dvv_game_temp
# Add the basic height value
@fple_ht = nil
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Set Height
# value : height change to value in pixels
#--------------------------------------------------------------------------
def fple_ht_set(value=nil)
return if value.nil?
# Ensure cannot change beyond heights
value = DVV_FPLE::Ht_Zoom if value > DVV_FPLE::Ht_Zoom
value = -DVV_FPLE::Ht_Zoom if value < -DVV_FPLE::Ht_Zoom
# Set height to value
$game_temp.fple_ht = nil
$game_system.fple_ht = value
end
#--------------------------------------------------------------------------
# * Height Change by Increment
# value : height adjustment in pixels performed immediately
#--------------------------------------------------------------------------
def fple_ht_change(value=nil)
# No invalid value
return if value.nil?
# Ensure cannot change beyond heights
if -(value + $game_system.fple_ht) > DVV_FPLE::Ht_Zoom
value = DVV_FPLE::Ht_Zoom + $game_system.fple_ht
end
if -($game_system.fple_ht + value) <= -DVV_FPLE::Ht_Zoom
value = DVV_FPLE::Ht_Zoom - $game_system.fple_ht
end
# Ensure ht change based on current height
$game_temp.fple_ht = nil
$game_system.fple_ht += value
end
#--------------------------------------------------------------------------
# * Height Shift by Increment
# value : height adjustment in pixels performed incrementally
#--------------------------------------------------------------------------
def fple_ht_slide(value=nil)
# No invalid value
return if value.nil?
# Ensure cannot change beyond heights
if -(value + $game_system.fple_ht) > DVV_FPLE::Ht_Zoom
value = DVV_FPLE::Ht_Zoom + $game_system.fple_ht
end
if -($game_system.fple_ht + value) <= -DVV_FPLE::Ht_Zoom
value = DVV_FPLE::Ht_Zoom - $game_system.fple_ht
end
# Ensure ht change based on current height
$game_temp.fple_ht = $game_system.fple_ht
$game_temp.fple_ht += value
end
end
#==============================================================================
# ** FPLE_Render
#------------------------------------------------------------------------------
# Container of bitmaps used to render FPLE, calls DLL functions with specific
# parameters so that player's movements can be rendered
#==============================================================================
class FPLE_Render
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias update_fple_dvv_render update
#--------------------------------------------------------------------------
# * Initialize Bitmaps
#--------------------------------------------------------------------------
def initialize_bitmaps
case $game_system.fple_resolution
when 0
width = 640 + (DVV_FPLE::Ht_Zoom*2)
height = 480 + (DVV_FPLE::Ht_Zoom*2)
coefficient_resolution = 1
when 1
width = 480 + (DVV_FPLE::Ht_Zoom*2)
height = 360 + (DVV_FPLE::Ht_Zoom*2)
coefficient_resolution = 1.334
when 2
width = 320 + (DVV_FPLE::Ht_Zoom*2)
height = 240 + (DVV_FPLE::Ht_Zoom*2)
coefficient_resolution = 2
when 3
width = 240 + (DVV_FPLE::Ht_Zoom*2)
height = 180 + (DVV_FPLE::Ht_Zoom*2)
coefficient_resolution = 2.667
end
if $game_system.fple_always_same_res
self.sprite_screen.bitmap = Bitmap.new(width, height)
self.sprite_screen.zoom_x = coefficient_resolution
self.sprite_screen.zoom_y = coefficient_resolution
else
self.sprite_screen.bitmap = Bitmap.new( 640 + (DVV_FPLE::Ht_Zoom*2),
480 + (DVV_FPLE::Ht_Zoom*2) )
end
self.sprite_move.bitmap = Bitmap.new(width, height)
self.sprite_move.zoom_x = coefficient_resolution
self.sprite_move.zoom_y = coefficient_resolution
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_fple_height
update_fple_dvv_render
end
#--------------------------------------------------------------------------
# * Frame Update (when adjusting fple height
#--------------------------------------------------------------------------
def update_fple_height
return if $game_temp.fple_ht.nil?
return unless $game_system.fple_htspd.is_a?(Numeric)
return if $game_system.fple_htspd == 0
if $game_system.fple_ht > $game_temp.fple_ht
$game_system.fple_ht -= $game_system.fple_htspd
# Do not go beyond
if $game_system.fple_ht < $game_temp.fple_ht
$game_system.fple_ht = $game_temp.fple_ht
end
elsif
$game_system.fple_ht += $game_system.fple_htspd
# Do not go beyond
if $game_system.fple_ht > $game_temp.fple_ht
$game_system.fple_ht = $game_temp.fple_ht
end
else
# Must be done
$game_temp.fple_ht = nil
end
end
end
#==============================================================================
# ** FPLE_Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class FPLE_Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias update_fple_dvv_spriteset update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Make Temporary Primary Viewport
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# Make initial Planes: Panorama / Fog / Weather*
# * Weather now in viewport2 along with the fog
@panorama = Plane.new(@viewport1)
@fog = Plane.new(@viewport1)
@weather = RPG::Weather.new(@viewport2)
# Add Depth to viewport planes
@panorama.z = -1000
@fog.z = 1000
# Make character surfaces
@character_surfaces = []
for i in $game_map.events.keys.sort
@character_surfaces.push(FPLE_Surface_Character.new(self,
$game_map.events[i]))
end
# Make picture sprites
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# Create Variables for adjustable viewport
vx = 0 - DVV_FPLE::Ht_Zoom
vy = 0 - DVV_FPLE::Ht_Zoom
vwd = 640 + DVV_FPLE::Ht_Zoom
vht = 480 + DVV_FPLE::Ht_Zoom
# Make viewports - now adjustable
@viewport1 = Viewport.new(vx, vy, vwd, vht)
@viewport2 = Viewport.new(vx, vy, vwd, vht)
@viewport3 = Viewport.new(vx, vy, vwd, vht)
@viewport2.z = 200
@viewport3.z = 5000
# Initialize FPLE rendering
@fple_render = FPLE_Render.new(self, @viewport1)
# Make timer sprite
@timer_sprite = Sprite_Timer.new
# Frame update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Ensure origin height matches game system
@viewport1.oy = $game_system.fple_ht
@viewport2.oy = $game_system.fple_ht
@viewport3.oy = $game_system.fple_ht
# Perform the Original call
update_fple_dvv_spriteset
end
end
Thanks to rzrcoon for pointing out the two variables that control the effect
If one is wishing to use a background panorama in their FPLE maps, they may be in for a shock as the panorama shows 'through' the map as a sort of ghost image as you can see below:
But thanks to rzrcoon, one can control the ghosting effect as he discovered two values which MGC added to the Game_System class which can be adjusted. Within the initialize method (as shown below), they are fple_view_distance and fple_light_distance
What these values do, insofar as the map's panorama, is to set how close the panorama image is to the player and how much it fades the closer it gets. If you notice, maps without a panorama have a black background behind the tiles. MGC used this to make the tunnels go dark the further down they go. So these values control how deep the tunnels go before they go dark, and how much it fades.
But if you want to use a background panorama for a sky-like effect, the default settings won't do. Your panorama would bleed into the scenery.
The first value, fple_view_distance, controls how far away the panorama will be from the player before it intersects or blends in with the walls or the like. The higher this number, the further the panorama will be.
The second value, fple_light_distance, controls how much the panorama fades. The higher the number, the more it blurs. However a setting of 0 will make the panorama appear solid.
Now you can do two things to change these values. You can either perform a direct edit to the initialize method in MGC's "FPLE Game_System" script as rzrcoon did (below):
Code:
def initialize
initialize_fple_game_system
self.fple = false
self.fple_view_distance = 10 # was 6
self.fple_light_distance = 0 # was 5
self.fple_resolution = 1
self.fple_always_same_res = true
end
OR... you can merely add a parallel process in your map(s) that can alter/set your values (below):
With that, you can eliminate the dreaded paranorama ghosting effect as rzrcoon had done like so:
Thank you.
Compatibility
Designed solely for MGC's (MGCaladtogel's) FPLE Version 1.5 system.
Terms and Conditions
Free for use, even in commercial games. And as this script was requested by PepperTrooper, you have to give both of us credit for this script.
This is... Wow. I'm not sure I can ever thank you enough. I won't be able to test it right away but glancing over some parts and pointedly reading others, this seems fantastic. So far I had only been able to make minor changes to the original FPLE script or handle how it operated, both in terms of x/y offsets for event distance and assorted image wizardry, but this is far beyond what I could hope to achieve alone.
I'll be forever in your debt, DerVVulfman. My heartfelt thanks :) :)
Hello! Thank you again for the suport, however, I have a small issue: yesterday I tried to test the code, but I fear there's some html problem when copying and pasting the code. I pasted in a notepad, then a Word document, and saw a lot of space blocks. I had to manually delete several so as to reduce the issue (the program wasn't registering things like 'def', 'end' and 'initialize').
However, once I thought everything was clear, the program keeps bugging me in two places. One, at the last line, it keeps telling me it was expecing $end and not a keyword_end (though I've read the code and it seems to be ok). Two, it tells me it can't initialize the update for class FPLE_Render. I made sure to clear out all weird formatting blocks but it keeps telling me that.
I'm very sorry to ask this, since I've already asked so much, but do you think it's possible to upload the code to something like pastebin? Just so I can copy it from somewhere that doesn't have any formatting issues, so that I can make sure it's not something on my side.
Okay, I made an attachment of a .txt file with the script. But I think you did a few extra steps. I woulda just copied the script here and just pasted it straight into the RPGMaker script editor. I think it was your wordpad or something that added the bugs.
Hi once again DerVVulfman! Thank you. I only did that extra step because usually, any code I find in an html page usually carries some added formatting that causes some issue, and I try to clean the formatting so there's no problem. It's working now, thank you once again :)
I like this, it's a really nice script, and gets around the idea of offsetting your viewport and changing fundamental math for the FPLE engine. Really nice, thanks DerVVulfman!
Thanks guys. I guess I have some knowledge how MGC's mind works. Great minds think alike ya know, and I did write the help file for his HMode7 Textures. But I have no knowledge of his .dll code, otherwise I'd be having SO much fun.
Though I primarily use FPLE2 instead of FPLE, I just found this and had to register to congratulate you on a job well done :) Still hoping a similar script or set of functions can one day be made for the 2, though as I've been desperately trying to go ahead with a project where I'd like to do something like this... Anyway, great work ;)
Hello! It is wonderful addon you did, I congratulate you, but has a problem , is not so bad but when placing panoramas and fogs , these are unlevels frame 640x480 screen , leaving something like this:
That was made with the FPLE? I have to admit, I'm impressed. And better it being FPLE than FPLE2. As while FPLE2 is more advanced, there are fewer (if any) bugs with FPLE.... except apparently this.
As I am not the creator of FPLE, I am not an expert. However, MGC hasn't been around to mess with any RPGMaker XP scripts for a while. If time permits, I may work out what is happening with this panorama. To be honest, I didn't consider panoramas when I saw the demo. But panoramas are controlled by the plane class (I think).
It would be a separate thread if any results appear.