Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Submission: FFX World Map Teleporter, by Prexus
Prexus
post Oct 15 2005, 03:08 AM
Post #1


Level 3
Group Icon

Group: Member
Posts: 31
Type: Event Designer
RM Skill: Masterful




Alright essentially the script works that if you explore a map with a * in the name, it uncovers it in the list in Scene_WorldMap and you can now teleport to its location by selecting it in the list. The location is determined by an event on the key maps (maps with a * in the name) called WorldMap which should just be a blank event with nothing on it but make sure its named WorldMap. If its not there, the teleport will never be uncovered.

Code:
CODE
#-------------------------------#
# FF10 World Map System #
#-------------------------------#
# Written by: Prexus #
# Special Thanks: Fuso #
# www.prexus.rmxponline.com #
#-------------------------------#
# Instructions: #
#-------------------------------#
# Step 1: #
# Make sure to put an image #
# called Map in the picture's #
# folder. #
#-------------------------------#
# Step 2: #
# To make a map part of the key #
# maps list (ones you can go #
# to from the menu), put a * in #
# the map name. Also be sure to #
# put an event called WorldMap #
# on every map with a * in the #
# name. This is where you will #
# appear after teleporting. #
#-------------------------------#

class Game_Map

# Defines map variables for maps to teleport to.
#Added:
attr_accessor :map_infos
attr_accessor :teleport_enabled
attr_accessor :teleport_name
attr_accessor :teleport_map_id
attr_accessor :teleport_x
attr_accessor :teleport_y
# End Added.

# Sets up all the 'key' maps that you can teleport to based on the
# * in the map name.
def initialize
@map_id = 0
# Added:
@teleport_enabled = []
@teleport_name = []
@teleport_map_id = []
@teleport_x = []
@teleport_y = []
# End Added.
@display_x = 0
@display_y = 0
# Added:
@map_infos = load_data("Data/MapInfos.rxdata")
for key in @map_infos.keys
@map_infos[key] = @map_infos[key].name
if @map_infos[key].include?("*")
@teleport_enabled[key] = false
@teleport_map_id[key] = key
@teleport_name[key] = "???"
@teleport_x[key] = 0
@teleport_y[key] = 0
end
end
# End Added.
end
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
tileset = $data_tilesets[@map.tileset_id]
@tileset_name = tileset.tileset_name
@autotile_names = tileset.autotile_names
@panorama_name = tileset.panorama_name
@panorama_hue = tileset.panorama_hue
@fog_name = tileset.fog_name
@fog_hue = tileset.fog_hue
@fog_opacity = tileset.fog_opacity
@fog_blend_type = tileset.fog_blend_type
@fog_zoom = tileset.fog_zoom
@fog_sx = tileset.fog_sx
@fog_sy = tileset.fog_sy
@battleback_name = tileset.battleback_name
@passages = tileset.passages
@priorities = tileset.priorities
@terrain_tags = tileset.terrain_tags
@display_x = 0
@display_y = 0
@need_refresh = false
@events = {}
# When a new map loads, if it is in the key maps array, this
# checks to see if there is an event called WorldMap to teleport
# to. If there isn't it'll cause a problem so make sure there is!
for i in @map.events.keys
@events[i] = Game_Event.new(@map_id, @map.events[i])
# Added:
if @teleport_enabled[@map_id] == false
if @events[i].name == "WorldMap"
@teleport_enabled[@map_id] = true
@teleport_name[@map_id] = self.name
@teleport_x[@map_id] = @events[i].x
@teleport_y[@map_id] = @events[i].y
end
end
# End Added.
end
@common_events = {}
for i in 1...$data_common_events.size
@common_events[i] = Game_CommonEvent.new(i)
end
@fog_ox = 0
@fog_oy = 0
@fog_tone = Tone.new(0, 0, 0, 0)
@fog_tone_target = Tone.new(0, 0, 0, 0)
@fog_tone_duration = 0
@fog_opacity_duration = 0
@fog_opacity_target = 0
@scroll_direction = 2
@scroll_rest = 0
@scroll_speed = 4
end
# Returns the map name (gets rid of the * in the name)
# Added:
def name
new_name = @map_infos[@map_id].tr("*", "")
return new_name
end
# End Added.
end

class Window_MapName < Window_Base
def initialize
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 250, 32, "Current Location:")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 250, 32, $game_map.name.to_s)
end
end

class Window_MapList < Window_Selectable
def initialize
super(480, 0, 160, 480)
@column_max = 1
self.opacity = 0
refresh
self.index = 0
end
def map_name
return @data_name[self.index]
end
def map_enabled
return @data_enabled[self.index]
end
def map_id
return @data_id[self.index]
end
def map_x
return @data_x[self.index]
end
def map_y
return @data_y[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data_name = []
@data_enabled = []
@data_id = []
@data_x = []
@data_y = []
for i in 1...$game_map.teleport_enabled.size
@data_name.push($game_map.teleport_name[i])
@data_enabled.push($game_map.teleport_enabled[i])
@data_id.push($game_map.teleport_map_id[i])
@data_x.push($game_map.teleport_x[i])
@data_y.push($game_map.teleport_y[i])
end
@item_max = @data_name.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
name = @data_name[index].tr("*","")
if @data_enabled[index]
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
self.contents.draw_text(x, y, 120, 32, name.to_s, 2)
end
end

class Scene_WorldMap
def main
@bgsprite = Sprite.new
@bgsprite.bitmap = RPG::Cache.picture("Map")
@maplist = Window_MapList.new
@mapname = Window_MapName.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@mapname.dispose
@maplist.dispose
@bgsprite.dispose
end
def update
@mapname.update
@maplist.update
if @maplist.active
update_maplist
return
end
end
def update_maplist
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if not @maplist.map_enabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @maplist.map_id
$game_temp.player_new_x = @maplist.map_x
$game_temp.player_new_y = @maplist.map_y
$game_temp.player_new_direction = 2
$game_temp.transition_processing = true
transfer_player
return
end
end
def transfer_player
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
case $game_temp.player_new_direction
when 2
$game_player.turn_down
when 4
$game_player.turn_left
when 6
$game_player.turn_right
when 8
$game_player.turn_up
end
$game_player.straighten
$game_map.update
$scene = Scene_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end
end
class Game_Event
attr_reader :name
def initialize(map_id, event)
super()
@map_id = map_id
@event = event
@name = @event.name
@id = @event.id
@erased = false
@starting = false
@through = true
moveto(@event.x, @event.y)
refresh
end
end


If you wish to implement it into your code, look in Game_Map for the parts which are surrounded by the comments:
# Added:
[stuff]
# End Added.
And add that to your Game_Map in (ideally) the same location.

Here is an image you guys can use for Map.png (put it in pictures folder)


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies (1 - 7)
myownfriend
post Jul 15 2006, 03:06 PM
Post #2


"Forever Love"
Group Icon

Group: Revolutionary
Posts: 375
Type: Event Designer
RM Skill: Undisclosed




Can this script be modified so that if your in an airship, you can press a button to bring up the map, select a location, and then see the ship auto-pilot to the area you wanted?


__________________________


If you need to contact me, contact me there. ^
Go to the top of the page
 
+Quote Post
   
Mute
post Jul 23 2006, 05:54 AM
Post #3


HOW I LOVE THE HOBO LIFE, SHIVVIN' FOLKS WITH MAH HOBO KNIFE
Group Icon

Group: Revolutionary
Posts: 173
Type: Event Designer
RM Skill: Advanced




yeah, i agree with these 2, can we have a demo, and does it do that? if it does, this is exactly what im looking for. i made a map for my game, go to oh god help me plz (a topic in resource discussion) and have a look, its really good, but i want it so each red dot is a teleport thing to that place, when you open it. but, alas, i dont know how to do this. =(

CK :rockon:


__________________________
Go to the top of the page
 
+Quote Post
   
jens009
post Jul 23 2006, 07:19 AM
Post #4


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Dude, its not really hard to operate.. You just have to read the comments inside the script and understand them to operate it..


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
CzarDragon
post Jul 23 2006, 07:00 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 63
Type: Developer
RM Skill: Beginner




sweet I'ma use this one.


__________________________


Czar's Weapon Forge

98% of teens have tried smoking pot, if you are one of the 2%, post this in ur siggy.
Go to the top of the page
 
+Quote Post
   
GrantDolesky
post Jun 1 2007, 06:08 PM
Post #6



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




I'm just seeing a whole bunch of question marks (?) in this script, could anybody please help me out?
Go to the top of the page
 
+Quote Post
   
Rockman
post Jun 2 2007, 09:38 AM
Post #7


welcome to the rad sunglasses zone. you will never escape
Group Icon

Group: Revolutionary
Posts: 1,240
Type: Musician
RM Skill: Advanced




The script has a bunch of question marks anyway. Are you seeing just question marks?
Go to the top of the page
 
+Quote Post
   
GrantDolesky
post Jun 3 2007, 06:09 PM
Post #8



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




QUOTE
class Game_Map
?
? # Defines map variables for maps to teleport to.
? #Added:
? attr_accessor :map_infos
? attr_accessor :teleport_enabled
? attr_accessor :teleport_name
? attr_accessor :teleport_map_id
? attr_accessor :teleport_x
? attr_accessor :teleport_y
? # End Added.


That isn't going to work as a script for me, at all. Isn't anyone else gettin' this problem?

All fixed - NR
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 04:13 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker