Teleportation
Authors: shdwlink1993
Version: 1.1
Type: Game Addon
Key Term: Movement Add-on
IntroductionYou guys remember RPG Maker 2003, right? I didn't think so. :^_^': There was an event command in RM2k3 called "Manage Teleport Locations" (or something to that effect). Using this allowed you to add and remove locations from a list. A skill called Teleport allowed you to go to any of these locations. This script is my variation of this functionality.
Features
- Easy control of teleportable locations.
- Automatic duplicate control.
- Backup and restore the list of locations.
- Scene made that allows for easy player selection.
- Temporarily disable and enable different locations.
ScreenshotsNone, really. The Teleport Menu isn't really shiny enough to need it's own screen.
DemoSee here (http://files.filefront.com/Teleport+Demoexe/;13154683;/fileinfo.html).
Script
#==============================================================================
# Teleportation
# Author: Shdwlink1993
# Version: 1.1
# Type: Game Addon
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Teleport Date 1.0b: 1/31/2009
# Teleport Date 1.01b: 1/31/2009
# Teleport Date 1.1: 2/5/2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# # This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
# #
# # Note that if you share this file, even after editing it, you must still
# # give proper credit to shdwlink1993.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# ~= Functions =~
#
# This script allows you to teleport to predefined locations, not unlike RPG
# Maker 2003's similar function.
#
# $game_player.add_location(name, map, x, y, face, description)
# Adds a location to the list of teleportable locations. You cannot add a
# location if it's name is already in use (limit duplicates). Face refers to
# the direction the player will be facing. If you don't know, look at a number
# pad. 2 is down, 4 left, etc.
#
# $game_player.add_here(name, description)
# Adds a location to the list where you are with the designated name and
# description.
#
# $game_player.remove_location(name)
# Removes a location with the name from the list of teleportable locations.
#
# $game_player.disable_location(name)
# Disallows you to teleport to the location with the name. This should be
# used only in instances where the teleport is to be temporarily disabled. If
# it should be permanently disabled, use the remove_location command to free
# space.
#
# $game_player.enable_location(name)
# Allows you to teleport to the disabled location with the name.
#
# $game_player.toggle_location(name)
# Changes if the location with the name can be teleported to or not.
#
# $game_player.backup_locations
# Makes a backup of all known locations and deletes them.
#
# $game_player.restore_locations
# Restores the locations from the backup. All locations learned in the backup
# are added to the list.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# ~= Version History =~
#
# Version 1.0b ---------------------------------------------------- [1/31/2009]
# Version 1.01b --------------------------------------------------- [1/31/2009]
# - Fixed a fatal error in $game_player.remove_location
# - Added a variable to $game_system.
# Version 1.1 ------------------------------------------------------ [2/5/2009]
# - Added in ability to disable individual teleports.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# ~= Customization =~
#
# The only bit of customization occurs in the Sound module. The script asks for
# you to make a sound effect for the file. Replace name with the name of the
# file (Like 'teleport'), volume with the volume of the file (80 by default),
# and pitch with, you guessed it, the pitch of the file (default to 100).
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# ~= Compatability =~
#
# - Should work perfectly with just about anything.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Sound
def self.play_tele
RPG::SE.new('Item1', 80, 100).play
end
end
class Game_System
attr_accessor :teleport_disabled
alias teleinit initialize
def initialize
teleinit
@teleport_disabled = false
end
end
class Game_Player
attr_reader :known_locs
alias teleinit initialize
def initialize
teleinit
@known_locs = []
@backup_locs = []
end
def add_here(name, desc = '')
return add_location(name, $game_map.map_id, @x, @y, @direction, desc)
end
def add_location(name, map, x, y, face, desc = '')
unless @known_locs == []
@known_locs.each_index {|i| return if name == @known_locs[i][0] }
end
@known_locs.push([name, map, x, y, face, desc, true])
end
def remove_location(name)
@known_locs.each_index {|i|
if name == @known_locs[i][0]
@known_locs.delete(@known_locs[i])
return
end}
end
def disable_location(name)
@known_locs.each_index {|i|
if name == @known_locs[i][0]
@known_locs[i][6] = false
return
end}
end
def enable_location(name)
@known_locs.each_index {|i|
if name == @known_locs[i][0]
@known_locs[i][6] = true
return
end}
end
def toggle_location(name)
@known_locs.each_index {|i|
if name == @known_locs[i][0]
@known_locs[i][6] = !@known_locs[i][6]
return
end}
end
def backup_locations
@backup_locs = @known_locs
@known_locs = []
end
def restore_locations
@known_locs & @backup_locs
@backup_locs = []
end
end
class Window_Teleport < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 2
self.index = 0
refresh
end
def item
return @data[self.index]
end
def refresh
@data = []
$game_player.known_locs.each {|t| @data.push(t) }
@item_max = @data.size
create_contents
@item_max.times {|i| draw_tele(i) }
end
def draw_tele(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
rect.width -= 4
self.contents.font.color = normal_color
self.contents.font.color.alpha = item[6] ? 255 : 128
self.contents.draw_text(rect.x + 2, rect.y, 172, WLH, item[0])
end
end
def update_help
@help_window.set_text(item == nil ? '' : item[5])
end
end
class Scene_Teleport < Scene_Base
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@teleport_window = Window_Teleport.new(0, 56, 544, 360)
@teleport_window.viewport = @viewport
@teleport_window.help_window = @help_window
end
def terminate
super
dispose_menu_background
@viewport.dispose
@help_window.dispose
@teleport_window.dispose
end
def return_scene
$scene = Scene_Menu.new(4)
end
def update
super
update_menu_background
@help_window.update
@teleport_window.update
update_item_selection
end
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @teleport_window.item
Sound.play_decision
if @item[6]
go_tele
else
Sound.play_buzzer
return
end
end
end
def go_tele
Sound.play_tele
$game_player.reserve_transfer(@item[1], @item[2], @item[3], @item[4])
$scene = Scene_Map.new
end
end
InstructionsRead the script for this.
CompatibilityShould be compatible with just about everything.
Credits and Thanks
- Shdwlink1993 for making the script.
Author's NotesOne little thing that might be new to some of you is that you need to change the scene to view the Teleport Menu. To do this, use the script( call) '$scene = Scene_Teleport.new'.
demo please
and isn't teleport like transfer?
Yea I was going to say the same thing... teleport and transfer are the same, choose the map and location on that map then when the event is active the player transfers/teleports to that map... So what's the point of this script again? Also you say this function was removed from rmxp and you made it for vx :O.o:
For clarification purposes:
Transfer Player is an event command that automatically moves the player to a predesignated or varying location.
Using this script, you can Add a Location, which saves a location in a list. Using said list, the player can automatically transfer themselves to that place whenever they want to. It makes moving around much easier in most games (an example being to move between two different towns via the menu, as opposed to moving their by leaving one city, walking through the map, and entering the other).
Demo coming momentarily.
Oh I get it :) It's a nice script now tha I know WTF it is :haha:
I think Blizzard uses something like this in his game...
I "think" (I don't remember) it's only available from the world map, but it lets you return to any place you have previously been simply by selecting it from a pop up menu...
If this is similar to that, then this is a cool script =)
I will wait for the DEMO.
Quote from: Calintz16438 on January 31, 2009, 03:39:32 pm
I think Blizzard uses something like this in his game...
I "think" (I don't remember) it's only available from the world map, but it lets you return to any place you have previously been simply by selecting it from a pop up menu...
If this is similar to that, then this is a cool script =)
I will wait for the DEMO.
Indeed. Chaos Project does use a similar feature. The only major difference is that teleporting costs some HP and SP. Also, the demo is up.
and was a few hours before your post.
Ahh!!
Kudos...
This is a nice script.
Mind if I try to convert it to xp? Add ons are giving me a maor headache right now. This would be really neat for my Star Wars game when selecting levels/planets
Oh looovvvve.... <3333 I do remember this feature. :haha:
I would like this for XP. :D Although I never knew why XP and VX were different. :|
Quote from: shdwlink1993 on January 31, 2009, 09:52:13 pm
Indeed. Chaos Project does use a similar feature. The only major difference is that teleporting costs some HP and SP.
33% of the current HP and 50% of the max SP/MP. Also, it doesn't cost anything after you get the Teleporter device... <_<;
I like the way that Blizz's only lets you return to places you have already been. Is that how this teleport script is handled??
@game_guy: I was about to do the same thing... :^_^':
@reno: The reason XP and VX are so different is because they use resources much differently. Scripts especially, because all the scripts have been changed, so most of them have to be altered to work for the other one. That's why there isn't a Blizz-ABS VX version yet.
@Calintz: It depends on when you add the location. If you felt generous, you could add all the locations at the beginning of the game, but that would be pretty useless and make your game much easier. :<_<: Usually you don't want to add a location until you've gotten there.
Very nice, so what syntax is used to add locations?
Quote$game_player.add_location(name, map, x, y, face, description)
Adds a location to the list of teleportable locations. You cannot add a location if it's name is already in use (limit duplicates). Face refers to the direction the player will be facing. If you don't know, look at a number pad. 2 is down, 4 left, etc.
So can I convert it to XP?
Very nice =)
@game_guy: Sorry... I just did :^_^':
Updated to version 1.1 (Correctly, I might add. I renumbered the last version to the correct number of 1.01b. This is the REAL 1.1.)! :D
Now you can disable and enable individual teleports.