Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Warp Script
#1
Warp Script
Version: 1.1
by Sheol/Slipknot
Last Update
December 28, 2007

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Version Log
Version 1.2 - January 28, 2008
Version 1.1 - December 28, 2007
Version 1.0 - October 8, 2006

Introduction
This script lets you use a warp system like in Zelda: Oracle of Ages, Soul Reaver, Zelda: A Link to the Past, ...

Features
  • You can use more than one "world".
  • Returns to the last map if the new place is not passable.
  • If the warp is succesful, a variable is increased.

Script
Code:
============================================================
# ** Warp Script
#------------------------------------------------------------------------------
# Sheol / Slipknot (www.creationasylum.net)
# Version 1.2
# Jenuary 28, 2008
#============================================================

module Warp
  #--------------------------------------------------------------------------
  # * Maps
  #--------------------------------------------------------------------------
  Maps = {
    1 => 2,
    2 => 1
  }
  #--------------------------------------------------------------------------
  # * Transition
  #--------------------------------------------------------------------------
  Transition = 48
  File = '007-Line01' # nil = normal transition
  #--------------------------------------------------------------------------
  # * Variable ID
  #--------------------------------------------------------------------------
  Variable = nil
  #--------------------------------------------------------------------------
  # * Can Warp?
  #--------------------------------------------------------------------------
  def Warp.can?
    Maps[$game_map.map_id] != nil
  end
  #--------------------------------------------------------------------------
  # * Transition
  #--------------------------------------------------------------------------
  def Warp.transition
    File ? Graphics.transition(Transition, 'Graphics/Transitions/'+File) :
      Graphics.transition(Transition)
  end
end

#============================================================
# ** Game_Temp
#============================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :warp
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_warp_init initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    slipknot_warp_init
    @warp = false
  end
end

#============================================================
# ** Interpreter
#============================================================

class Interpreter
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias slipknot_warp_upd update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_temp.warp
      Graphics.freeze
      $game_map.setup($game_temp.warp)
      $game_player.center($game_player.x, $game_player.y)
      $game_temp.warp = false
      $scene.warp_spriteset_refresh
          $game_map.autoplay
      Warp.transition
    else
      slipknot_warp_upd
    end
  end
  #--------------------------------------------------------------------------
  # * Warp
  #--------------------------------------------------------------------------
  def warp
    return true if ! $scene.is_a?(Scene_Map) || ! Warp.can?
    map = $game_map.map_id
    Graphics.freeze
    $game_map.setup(Warp::Maps[map])
    $game_player.center($game_player.x, $game_player.y)
    $game_temp.warp = $game_map.passable?($game_player.x, $game_player.y, 0) ?
      false : map
    $game_variables[Warp::Variable] += 1 if Warp::Variable && ! $game_temp.warp
    $scene.warp_spriteset_refresh
    Warp.transition
        $game_map.autoplay
    return true
  end
end

#============================================================
# ** Scene_Map
#============================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Warp: Spriteset Refresh
  #--------------------------------------------------------------------------
  def warp_spriteset_refresh
    @spriteset.dispose
    @spriteset = Spriteset_Map.new
  end
end



Instructions

You need paste the code before Main and below SDK, if you're using SDK.
You will need to set the maps:

Code:
Maps = {
    1 => 2,
    2 => 3,
    3 => 1
  }

1 => 2: if warp is called on map 1, the player will be warped to the map 2.
To call the script, just use warp in the call script command.
If you want to increase a variable when the warp is succesful, change this value with an integer:
CODE
Variable = nil

See the demo to see how it works.

Compatibility

This script must work with or without SDK.

Author's Notes

Enjoy it and credit me!
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Emotion Script Ánemus 0 2,161 08-29-2008, 01:00 PM
Last Post: Ánemus
  Beran's iPod script Sniper308 0 2,571 08-09-2008, 01:00 PM
Last Post: Sniper308
  NeoABS & NeoSABS ()enemy processes script azrith001 0 2,331 04-04-2008, 01:00 PM
Last Post: azrith001
  Blur Effect Script Hadriel 0 2,527 01-30-2008, 01:00 PM
Last Post: Hadriel
  AIM Script Pack vgvgf 0 2,805 09-13-2007, 01:00 PM
Last Post: vgvgf
  Audio Encryption Script InfiniteSpawn 0 2,211 05-09-2007, 01:00 PM
Last Post: InfiniteSpawn
  Credits Script Remake avatarmonkeykirby 0 2,227 03-10-2007, 01:00 PM
Last Post: avatarmonkeykirby
  Leon Blade's Percent Script Leon Blade 0 2,223 03-05-2007, 01:00 PM
Last Post: Leon Blade
  Cogwheels original pixelmovement script!!! mechacrash 0 2,152 01-14-2007, 01:00 PM
Last Post: mechacrash
  Beran's Interactive Drumkit Script Sniper308 0 1,854 10-22-2006, 01:00 PM
Last Post: Sniper308



Users browsing this thread: