KRandomTeleport XP
by Kyonides
Introduction
Did you ever feel like you wanted your character to randomly teleport to another location?
Are you sick of manually setting up such an event at every single open space in a given area?
Well, now you can just use some useful script calls to let it handle the teleportation for you!
Don't worry! You might only need one or two script calls at any given time.
The Script
Code:
# * KRandomTeleport XP
# Scripter : Kyonides Arkanthes
# v0.2.0 - 2022-11-13
# v0.1.0 - 2021-08-22
# This scriptlet allows you to transfer a player to a random location on a given
# map. The condition is that you need to define a rectangular area first.
# You would no longer need to setup several event commands in a row there.
# * Script Calls * #
# - Send to Same Map -
# $game_player.random_transfer(MIN_X, MAX_X, MIN_Y, MAX_Y)
# - Send to Another Map -
# $game_player.random_transfer(MIN_X, MAX_X, MIN_Y, MAX_Y, MAPID)
# - Undo Random Transfer (Clears Transfer Data)
# $game_player.undo_random_transfer
# - Clear Random Transfer Data Manually!
# $game_player.clear_pre_teleport_coords
class Game_Player
def clear_pre_teleport_coords
@tp_x = nil
@tp_y = nil
@tp_map_id = nil
end
def save_last_xy_map
@tp_x = @x
@tp_y = @y
@tp_map_id = $game_map.map_id
end
def random_transfer(min_x, max_x, min_y, max_y, map_id=$game_map.map_id)
save_last_xy_map
$game_temp.player_transferring = true
$game_temp.player_new_x = rand(max_x + 1 - min_x) + min_x
$game_temp.player_new_y = rand(max_y + 1 - min_y) + min_y
$game_temp.player_new_map_id = map_id
end
def undo_random_transfer
return unless @tp_x
$game_temp.player_transferring = true
$game_temp.player_new_x = @tp_x
$game_temp.player_new_y = @tp_y
$game_temp.player_new_map_id = @tp_map_id
clear_pre_teleport_coords
end
end
Terms & Conditions
You can freely use this script, even if you are called Silly or Joe Biden, a werewolf or even Count Dracula.
Nope, Jack Dorsey, Miguel Díaz-Canel, Xi Jinping and Kim Jong-un are not allowed to even take a look at it.
I just can't bear those guys.
Include me in your game credits!
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE