09-29-2022, 09:08 AM
(This post was last modified: 01-30-2023, 06:46 AM by kyonides.
Edit Reason: XP + VX + ACE + MV
)
KTouchNewMapEvent
XP + VX + ACE + MV
by Kyonides Arkanthes
Introduction
Did you ever want that the engine would autorun events right after being touched by the player or another event?
Especially once it finishes transferring the player to a new map...
Now you can do that! Just copy and past the following snippet on your script editor!
XP Version
Code:
# * KTouchNewMapEvent XP
# Scripter : Kyonides Arkanthes
# 2022-09-29
# * Plug & Play Script * #
# This scriptlet allows you to run an event after being transferred to another
# map. It will run even if the trigger were the Player Touch or Event Touch one.
# * Aliased Method: Game_Event#initialize
class Game_Event
alias :kyon_touch_new_map_event_init :initialize
def initialize(map_id, event)
kyon_touch_new_map_event_init(map_id, event)
check_shared_location
end
def touch_trigger?() [1, 2].include?(@trigger) end
def player_new_x?() $game_temp.player_new_x == @x end
def player_new_y?() $game_temp.player_new_y == @y end
def check_shared_location
start if touch_trigger? and player_new_x? and player_new_y?
end
end
VX Version
Code:
# * KTouchNewMapEvent VX
# Scripter : Kyonides Arkanthes
# 2022-09-29
# * Plug & Play Script * #
# This scriptlet allows you to run an event after being transferred to another
# map. It will run even if the trigger were the Player Touch or Event Touch one.
# * Aliased Method: Game_Event#initialize
class Game_Player
attr_reader :new_x, :new_y
end
class Game_Event
alias :kyon_touch_new_map_event_init :initialize
def initialize(map_id, event)
kyon_touch_new_map_event_init(map_id, event)
check_shared_location
end
def touch_trigger?() [1, 2].include?(@trigger) end
def player_new_x?() $game_player.new_x == @x end
def player_new_y?() $game_player.new_y == @y end
def check_shared_location
start if touch_trigger? and player_new_x? and player_new_y?
end
end
VX ACE Version
Code:
# * KTouchNewMapEvent ACE
# Scripter : Kyonides Arkanthes
# 2022-09-29
# * Plug & Play Script * #
# This scriptlet allows you to run an event after being transferred to another
# map. It will run even if the trigger were the Player Touch or Event Touch one.
# * Aliased Method: Game_Event#setup_page
class Game_Player
attr_reader :new_x, :new_y
end
class Game_Event
alias :kyon_touch_new_map_event_setup_page :setup_page
def touch_trigger?() [1, 2].include?(@trigger) end
def player_new_x?() $game_player.new_x == @x end
def player_new_y?() $game_player.new_y == @y end
def check_shared_location
start if touch_trigger? and player_new_x? and player_new_y?
end
def setup_page(new_page)
kyon_touch_new_map_event_setup_page(new_page)
check_shared_location
end
end
MV Version
Code:
//==================================
// * KTouchNewMapEventMV.js
//==================================
/*:
* @plugindesc This plugin will be triggered if any given event's coordinates
* match the player's and its trigger is either a Player or Event Touch.
* @author Kyonides Arkanthes
* @help Date: 2023-01-29
*
*/
const KTouchNewMap_event_setupPage = Game_Event.prototype.setupPage;
Game_Player.prototype.newMapX = function() {
return this._newX;
}
Game_Player.prototype.newMapY = function() {
return this._newY;
}
Game_Event.prototype.setupPage = function() {
KTouchNewMap_event_setupPage.call(this);
this.checkEventTriggerNewMapTouch();
};
Game_Event.prototype.checkEventTriggerNewMapTouch = function() {
if (this._trigger == 1 || this._trigger == 2) {
if ($gamePlayer.newMapX() == this.x && $gamePlayer.newMapY() == this.y) {
this.start();
}
}
};
Notes
Honestly, there are other ways to trigger events without using scripts. Yet, you can still use my scriptlet to make it possible by setting its trigger as Player Touch or Event Touch.
Terms & Conditions
Free as in beer and as in speech.
Please include my nickname 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