The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on August 16, 2008, 07:26:34 PM

Title: Teleport Fade Options
Post by: modern algebra on August 16, 2008, 07:26:34 PM
Teleport Fade Options
Version: 1.0
Author: modern algebra
Date: August 12, 2008

Version History



Description


This script allows you to use different fades from the default fade to black of teleports. You can now choose up to 32 different colours to fade to, as well as an option for no fade at all upon teleport, which allows you to custom fade and transition.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg296.imageshack.us%2Fimg296%2F7748%2Ffadeoptionsuk6.png&hash=1b568ee5c95918bebf340ec3da69c7e15f33947e) (http://imageshack.us)

Instructions

See inside script.

Script


Code: [Select]
#==============================================================================
#  Teleport Fade Options
#  Version 1.0
#  Author: modern algebra (rmrk.net)
#  Date: August 12, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    This script is operated by a single variable, set below at line 26 as
#   FADE_VARIABLE_ID. When you set that, you set the ID of the variable which
#   controls your teleport options. They are simple:
#
#    When that variable is equal to:
#      0 - Default Fade to Black
#      1 - No Fade
#      2-33 - Windowskin colour palette
#
#    Keep in mind that the Windowskin colours do not necessarily go to a solid
#   colour, and so you should experiment with them before using. Also, with
#   different windowskins, you may experience different effects if the palette
#   is changed. Just in case you don't know, the Windowskin colour palette is
#   the same one you access when you use the message code \c[x].
#==============================================================================
# ** Global Constant
#==============================================================================
#  The ID of the variable that controls fade/no fade/fade to colour
FADE_VARIABLE_ID = 1
#==============================================================================
# *** Graphics
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - wait
#==============================================================================
module Graphics
  class << self
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Wait
    #    duration : time in frames
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    alias modalg_override_wait_transfer_n_fad_n43 wait
    def wait (duration)
      return if $game_variables[FADE_VARIABLE_ID] == 1
      modalg_override_wait_transfer_n_fad_n43 (duration)
    end
  end
end

#==============================================================================
# ** Spriteset Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - dispose
#==============================================================================

class Spriteset_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_override_spriteset_disposal_no_fade_7ht2 dispose
  def dispose
    return if $game_variables[FADE_VARIABLE_ID] > 0 && $game_player.transfer?
    modalg_override_spriteset_disposal_no_fade_7ht2
  end
end

#==============================================================================
# ** Scene_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - fadein, fadeout
#==============================================================================

class Scene_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fade In Screen
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_trans_no_fade_teleport_fdin_4nb6 fadein
  def fadein(duration)
    if @transfer && $game_variables[FADE_VARIABLE_ID].between? (1, 33)
      # Dispose of Spriteset
      @old_spriteset.dispose unless @old_spriteset == nil
      @old_spriteset = nil
      # Cancel Fade if turned off
      if $game_variables[FADE_VARIABLE_ID] > 1
        $game_map.screen.start_tone_change (@original_tone, duration)
        # Update Basic functions until fade is complete
        for i in 0..duration-1
          update_basic
        end
      end
    else
      # Run Original Method
      modalg_trans_no_fade_teleport_fdin_4nb6 (duration)
    end
    # Restore Transfer data
    @transfer = $game_player.transfer?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fade Out Screen
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_fde_n_telepot_fdout_5ny5 fadeout
  def fadeout(duration)
    @transfer = $game_player.transfer?
    if @transfer && $game_variables[FADE_VARIABLE_ID].between? (1, 33)
      # Save spriteset to be disposed manually
      @old_spriteset = @spriteset
      if $game_variables[FADE_VARIABLE_ID] > 1
        # Save Original Tone
        @original_tone = $game_map.screen.tone.clone
        # Create Tone from Color
        colour = @message_window.text_color ($game_variables[FADE_VARIABLE_ID] - 2)
        tone = Tone.new (colour.red, colour.green, colour.blue)
        $game_map.screen.start_tone_change (tone, duration)
        # Update Basic functions until fade is complete
        for i in 0..duration-1
          update_basic
        end
      end
    else
      # Run Original Method
      modalg_fde_n_telepot_fdout_5ny5 (duration)
    end
  end
end

Credit



Support


Post in this topic at rmrk.net for the swiftest response

Author's Notes


This script began as the No Fade Teleport script, posted here earlier. However, that has been deleted since.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Teleport Fade Options
Post by: Grafikal on November 19, 2008, 08:12:05 AM
Hah, so I was looking for your no fade script and discovered ya got rid of it and threw up a newer one. :)

I have a problem though. It's still fading. I plugged the script in just as it is. The variable is set as 1 as well but it still fades. I'm not sure what else I'm supposed to change, and also, when I get this to work is there a call script of some sort I could use to make certain transfers have a fade instead of not?

Sigh... Never mind, I fixed it. It's just been too long since I've done anything with a script. Lol.