12-28-2007, 01:00 PM
Warp Script
Version: 1.1
by Sheol/Slipknot
Last Update
December 28, 2007
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
Script
Instructions
You need paste the code before Main and below SDK, if you're using SDK.
You will need to set the maps:
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!
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.
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!