Often times you want to create event conditions for when the player leaves a particular tile.
For example, if the player is standing on a push button, you want to check whether the player has left or not.
This script provides extended position-tracking information, such as the last x,y position a character was on and the last region ID.
- Get the player's previous position and region
- Get an event's previous position and region
These are mainly for events.
You can access position information by the standard
$game_player.x $game_player.y $game_player.region_id $game_player.last_x $game_player.last_y $game_player.last_region_id $game_map.events[event_id].x $game_map.events[event_id].last_yYou can also use some methods that make this easier
player_pos player_last_pos event_pos(event_id) event_last_pos(event_id)These return a list of values corresponding to your position information
player_pos ==> returns [x, y] player_last_pos ==> returns [last_x, last_y]The "last position" is updated whenever you successfully move to a new position. So if you're walking against a wall, your last position doesn't change (and it shouldn't cause you haven't moved yet).
Suppose you really were making a push-button which is activated when you stand on it, and deactivated when you leave. Actually, you don't need this script for it lol
Anyways you'd have two event pages
The first page has a conditional branch
if player_pos == event_pos(@event_id) #turn it on self-switch ONSecond page has a conditional branch
if player_pos != event_pos(@event_id) #turn it off self-switch OFFWhile you can do this without using a script, you must agree that it's much more compact.
Another example is the ground-breaking request which I wrote this script for, where you are checking arbitrary tiles and arbitrary player positions.
Script: Download here
Edited by Tsukihime, 02 August 2016 - 01:54 PM.