Introduction Adds some new features to some familiar event commands as well as restored lost functionality from outdated RPG Maker engines.
Features *Diagonal Map Scrolling: Easily scroll maps diagonally instead of in only one direction at a time. *Advanced Screen Tones: Memorize, restore, and save screen tones as well as define easy-to-use presets. *Vertical Screen Shake: Shake the screen instead of, or at the same time as, shaking it horizontally. *Advanced Picture Placement: Place pictures beneath characters instead of on top of them for advanced visual effects. *Scroll Panorama: Move the panorama or set it to move automatically.
Script
Script
CODE
#=============================================================================== # ** SAI Custom Event Commands #------------------------------------------------------------------------------- # Author: Bishop Myers ("Sailerius") # Version: 1.0 # Date: 2011.06.10 # SDK Version: 2.4 - Part II #=============================================================================== # Instructions # ------------------------------------------------------------------------------ # Call any of these new methods in a Call Script event to use them. # ------------------------------------------------------------------------------ # Advanced Map Scrolling # ------------------------------------------------------------------------------ # scroll_down_left(x) # scroll_down(x) # scroll_down_right(x) # scroll_left(x) # scroll_right(x) # scroll_up_left(x) # scroll_up(x) # scroll_up_right(x) # Calling any of these methods will scroll the map screen by x tiles in the # respective direction. You can optionally give a second parameter to specify # a scroll speed. If none is given, it will default to 4. # Example: scroll_up_left(10, 6) will scroll the map up and to the left by 10 # tiles at a speed of 6. # ------------------------------------------------------------------------------ # Advanced Screen Tones # ------------------------------------------------------------------------------ # save_tone(name) # Calling this method will save the current screen tone and remember it with # the name you gave it. In order to use that tone again, call show_tone and # supply it with the same name you used to save it. # # restore_tone(x) # Calling this method will restore the memorized screen tone. The transition # will take x frames. # # show_tone(name, x) # Calling this method will bring back a saved screen tone with the name you # supply it with. The transition will take x frames. # # memorize_tone # Calling this method will memorize the current screen tone without saving it. # The memorized screen tone will be overwritten the next time this method is # called. # # black(x) # This method is a shortcut that will fade the screen to black. The transition # will take x frames. # # white(x) # This method is a shortcut that will fade the screen to white. The transition # will take x frames. # # darken(strength, x) # Calling this method will darken the current screen tone by the strength # given, which must be a number between 0-255. The transition will take x # frames. # # lighten(strength, x) # Calling this method will lighten the current screen tone by the strength # given, which must be a number between 0-255. The transition will take x # frames. # ------------------------------------------------------------------------------ # Advanced Screen Shake # ------------------------------------------------------------------------------ # shake(x, y, speed, duration) # Calling this method will shake the screen horizontally with a power of x and # vertically with a power of y at the given speed and for the given duration. # x, y and speed should be from 1-9 with 9 being the strongest. # ------------------------------------------------------------------------------ # Pictures Under People # ------------------------------------------------------------------------------ # pup(x) # Calling this method will cause picture number x to appear beneath characters. # ------------------------------------------------------------------------------ # Move Panorama # ------------------------------------------------------------------------------ # move_pan(x, y) # Calling this method will cause the map's panorama to begin moving at a # horizontal speed of x and a vertical speed of y. # # auto_move_pan(x, y) # Calling this method will cause the map's panorama to automatically move at a # horizontal speed of x and a vertical speed of y. To stop a panorama from # moving, just call this with an x and y value of 0. # You can set a map to automatically scroll its panorama by adding an entry # manually to the Configuration section below. #===============================================================================
#----------------------------------------------------------------------------- # Move Panorama # Specify which maps automatically have a scrolling panorama here. # Entries should follow this format: # map ID => [horizontal speed, vertical speed] # For example, 3 => [2, 1] means that map #3 will scroll its panorama at a # speed of 2 horizontally and 1 vertically. #----------------------------------------------------------------------------- MOVING_PANORAMA_MAPS = { #3 => [2, 1] 1 => [3, 2] } MOVING_PANORAMA_MAPS.default = [0, 0] end
#=============================================================================== # ** Game_Map #=============================================================================== class Game_Map #----------------------------------------------------------------------------- # * Alias Listings #----------------------------------------------------------------------------- alias_method :sailerius_saicec_gamemap_setup, :setup alias_method :sailerius_saicec_gamemap_update, :update
#----------------------------------------------------------------------------- # * Update Scrolling #----------------------------------------------------------------------------- def update_scrolling # If scrolling if @scroll_rest > 0 # Change from scroll speed to distance in map coordinates distance = 2 ** @scroll_speed # Execute scrolling case @scroll_direction when 1 # Down-left scroll_down(distance) scroll_left(distance) when 2 # Down scroll_down(distance) when 3 # Down-right scroll_down(distance) scroll_right(distance) when 4 # Left scroll_left(distance) when 6 # Right scroll_right(distance) when 7 # Up-left scroll_up(distance) scroll_left(distance) when 8 # Up scroll_up(distance) when 9 # Up-right scroll_up(distance) scroll_right(distance) end # Subtract distance scrolled @scroll_rest -= distance end end
#----------------------------------------------------------------------------- # * Update #----------------------------------------------------------------------------- def update sailerius_saicec_gamemap_update move_panorama(SAI::MOVING_PANORAMA_MAPS[@map_id][0], SAI::MOVING_PANORAMA_MAPS[@map_id][1]) end end
#----------------------------------------------------------------------------- # * Save Screen Tone # name : New screen tone name #----------------------------------------------------------------------------- def save_tone(name) SAI::TONES[name] = @tone.clone return true end
#----------------------------------------------------------------------------- # * Restore Screen Tone # duration : Duration of screen tone transition #----------------------------------------------------------------------------- def restore_tone(duration) start_tone_change(@memorized_tone, duration) return true end
#----------------------------------------------------------------------------- # * Show Stored Screen Tone # name : Name of saved screen tone to restore # duration : Duration of screen tone transition #----------------------------------------------------------------------------- def show_tone(name, duration) tone = SAI::TONES[name] unless tone.nil? start_tone_change(tone, duration) end return true end
#----------------------------------------------------------------------------- # * Memorize Screen Tone #----------------------------------------------------------------------------- def memorize_tone @memorized_tone = @tone.clone return true end
#----------------------------------------------------------------------------- # * Darken Screen Tone # amount : Amount to darken the screen (0-255) # duration : Duration of screen tone transition #----------------------------------------------------------------------------- def darken_tone(amount, duration) tone = @tone.clone tone.red -= amount tone.green -= amount tone.blue -= amount start_tone_change(tone, duration) return true end
#----------------------------------------------------------------------------- # * Pictures Under People # picture : Number of the picture to push down #----------------------------------------------------------------------------- def pup(picture) @pupped_pictures.push(picture) end
#----------------------------------------------------------------------------- # * Frame Update #----------------------------------------------------------------------------- def update sailerius_saicec_gamescreen_update # Vertical shaking support if @shake_duration >= 1 or @shake_vert != 0 delta = (@shake_vert_power * @shake_speed * @shake_vert_direction) / 10.0 if @shake_duration <= 1 and @shake_vert * (@shake_vert + delta) < 0 @shake_vert = 0 else @shake_vert += delta end if @shake_vert > @shake_vert_power * 1.5 @shake_vert_direction = -1 end if @shake_vert < - @shake_vert_power * 1.5 @shake_vert_direction = 1 end end end end
#=============================================================================== # ** Scene_Map #=============================================================================== class Scene_Map #----------------------------------------------------------------------------- # * Public Instance Variables #----------------------------------------------------------------------------- attr_accessor :spriteset end
#=============================================================================== # ** Spriteset_Map #=============================================================================== class Spriteset_Map #----------------------------------------------------------------------------- # * Alias Listings #----------------------------------------------------------------------------- alias_method :sailerius_saicec_spritesetmap_update, :update alias_method :sailerius_saicec_spritesetmap_initialize, :initialize
#----------------------------------------------------------------------------- # * Initialize #----------------------------------------------------------------------------- def initialize sailerius_saicec_spritesetmap_initialize for i in $game_screen.pupped_pictures @picture_sprites[i - 1].dispose @picture_sprites[i - 1] = Sprite_Picture.new(@viewport1, $game_screen.pictures[i]) end end
#----------------------------------------------------------------------------- # * Push Picture Down # picture : Number of the picture to push down #----------------------------------------------------------------------------- def push_picture_down(picture) @picture_sprites[picture - 1].dispose @picture_sprites[picture - 1] = Sprite_Picture.new(@viewport1, $game_screen.pictures[picture]) end end
#=============================================================================== # ** Spriteset_Battle #=============================================================================== class Spriteset_Battle #----------------------------------------------------------------------------- # * Alias Listings #----------------------------------------------------------------------------- alias_method :sailerius_saicec_spritesetbattle_update, :update
#----------------------------------------------------------------------------- # * Update #----------------------------------------------------------------------------- def update @viewport1.oy = $game_screen.shake_vert sailerius_saicec_spritesetbattle_update end end
#=============================================================================== # ** Sprite_Picture #=============================================================================== class Sprite_Picture < Sprite #----------------------------------------------------------------------------- # * Alias Listings #----------------------------------------------------------------------------- alias_method :sailerius_saicec_spritepicture_update, :update
#----------------------------------------------------------------------------- # * Update #----------------------------------------------------------------------------- def update sailerius_saicec_spritepicture_update if $game_screen.pupped_pictures.include?(@picture.number) self.z = 0 end end end
#----------------------------------------------------------------------------- # * Save Current Screen Tone #----------------------------------------------------------------------------- def save_tone(name) $game_screen.save_tone(name) end
#----------------------------------------------------------------------------- # * Restore Memorized Screen Tone #----------------------------------------------------------------------------- def restore_tone(name, duration) $game_screen.restore_tone(name, duration) end
#----------------------------------------------------------------------------- # * Show Saved Screen Tone #----------------------------------------------------------------------------- def show_tone(name, duration) $game_screen.show_tone(name, duration) end
#----------------------------------------------------------------------------- # * Memorize Current Screen Tone #----------------------------------------------------------------------------- def memorize_tone $game_screen.memorize_tone end
#----------------------------------------------------------------------------- # * Fade to Black #----------------------------------------------------------------------------- def black(duration) $game_screen.show_tone('black', duration) end
#----------------------------------------------------------------------------- # * Fade to White #----------------------------------------------------------------------------- def white(duration) $game_screen.show_tone('white', duration) end
#----------------------------------------------------------------------------- # * Darken Screen Tone #----------------------------------------------------------------------------- def darken(amount, duration) $game_screen.darken_tone(amount, duration) end
#----------------------------------------------------------------------------- # * Lighten Screen Tone #----------------------------------------------------------------------------- def lighten(amount, duration) $game_screen.darken_tone(-amount, duration) end
#----------------------------------------------------------------------------- # * Pictures Under People #----------------------------------------------------------------------------- def pup(picture) $scene.spriteset.push_picture_down(picture) end
#----------------------------------------------------------------------------- # * Automatically Move Panorama #----------------------------------------------------------------------------- def auto_move_pan(x, y) SAI::MOVING_PANORAMA_MAPS[$game_map.map_id][0] = x SAI::MOVING_PANORAMA_MAPS[$game_map.map_id][1] = y end end
Customization The configuration section explains how to add preset screen tones as well as how to set maps to have automatically scrolling panoramas. Simply add your own entries like the examples do.
Compatibility Requires SDK v2.4 to function. As such, it should be compatible with any other SDK script.
DEMO Coming soon!
Installation Paste below the SDK script.
FAQ Q: How do I use this? A: Simply add a Call Script action to an event and use one of the event commands as detailed in the Instructions section of the script. For example, to use the advanced screen shake method, just enter shake(6, 8, 9, 9) or with whatever numbers you want to use. When in doubt, read the instructions!
Terms and Conditions This script is free for all use, including commercial.
Credits Please give credit to Bishop Myers ("Sailerius") if you use this script.
This post has been edited by Sailerius: Jun 13 2011, 03:02 PM