01-23-2016, 01:17 AM
FPLE Camera Height
FPLE Add-on
Version: 1.3
FPLE Add-on
Version: 1.3
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
FPLE Camera Height.txt (Size: 14 KB / Downloads: 17)
Instructions
In the script as always.
Panorama Insight
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):
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.
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
Code:
def initialize
initialize_fple_game_system
self.fple = false
self.fple_view_distance = 6
self.fple_light_distance = 5
self.fple_resolution = 1
self.fple_always_same_res = true
end
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
Code:
@>Script: $game_system.fple_view_distance = 10
: : $game_system.fple_light distance = 0
@>Erase event
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.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links