-
Notifications
You must be signed in to change notification settings - Fork 5
/
Kru_PreviousPosition.js
49 lines (43 loc) · 1.08 KB
/
Kru_PreviousPosition.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//=============================================================================
// Kru_PreviousPosition.js
//=============================================================================
/*:
* @plugindesc Stores the player's position and can return the player there.
* @author Krusynth
*
* @help
*
* Usage: Before running a transfer within an event, run this custom script to
* store the current location: Kru.PP.store();
*
* To return to that location, run Kru.PP.recall(); You may automatically
* change the direction of the player by passing it as an argument.
*/
var Kru = Kru || {};
Kru.PP = {
location: {}
};
Kru.PP.store = function() {
this.location = {
map: $gameMap.mapId(),
x: $gamePlayer._x,
y: $gamePlayer._y,
d: $gamePlayer.direction
};
}
Kru.PP.transfer = function(map, x, y, d, fade) {
fade = fade || 0;
if(map != null) {
$gamePlayer.reserveTransfer(map, x, y, d, fade);
}
}
Kru.PP.recall = function(d, fade) {
d = d || this.location.d;
Kru.PP.transfer(
this.location.map,
this.location.x,
this.location.y,
d,
fade
);
}