/
prioCharZ.js
142 lines (128 loc) · 5.43 KB
/
prioCharZ.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//=============================================================================
// prioCharZ.js
//=============================================================================
/*:
* @plugindesc v1.0 <prioCharZ> Controll the Z_Anchor of Chars & manipulate prioType
* @author dopan
*
*
*
* @help
*
* this plugin allows to change the z data of Chars
*
* it works for $gameMap.event(id) & $gamePlayer & "gameFollowers"
*
* this wont edit the prioType directly, and can be reseted to default prioType
*
* the default prioTypes have following default rpgMV maker system Z data:
*
* # prio0 = screenZ_1 # prio1 = screenZ_3 # prio2 = screenZ_5 #
*
* default rpgMV maker system prio 0 is called "belowChara"
*
* default rpgMV maker system prio 1 is called "sameAsChara"
*
* default rpgMV maker system prio 2 is called "aboveChara"
*
*
* __Plugin ScriptCalls __ ALWAYS INSERT NUMBERS AS DATA TO THE ScriptCall-ARRAYS
*
* # for $gameMap.event(id) # insert eventId number & zValue number
*
* - $gameMap.setCharPrio(eventId, zValue); # eventId of manipulated event ,zValue is the z Achor and can be any Number
*
* - $gameMap.resetCharPrio(eventId); # eventId of event ,that will be reseted to default prioType data
*
* # for $gamePlayer # insert zValue number
*
* - $gamePlayer.setCharPrio(zValue); # zValue is the z Achor and can be any Number, it replaces the prioType data
*
* - $gamePlayer.resetCharPrio(); # reset $gamePlayer to default prioType data
*
* # for $gamePlayer._followers # insert dataId number & zValue number
*
* - $gamePlayer._followers.setCharPrio([dataId], zValue); # dataId starts with 0 (decides which followers is triggered), zValue is the new Z Anchor
*
* - $gamePlayer._followers.resetCharPrio([dataId]); # dataId starts with 0 (decides which followers is triggered)
*
*
*
*
* # default rpgMV maker system Scriptcalls to double check ScreenZ:
* (it cant change data it only shows the final data which is used, its often updated by the system)
*
* # for $gameMap.event(id) # insert eventId
*
* - $gameMap.event(eventId).screenZ(); # shows the Final Z data which is used for eventCharAnchor based on eventId
*
* # for $gamePlayer # insert nothing
*
* - $gamePlayer.screenZ(); # shows the Final Z data which is used for gamePlayer Char Anchor
*
* # for $gamePlayer._followers # insert dataId number
*
* - $gamePlayer._followers._data[dataId].screenZ(); # dataId starts with 0 (decides which follower is triggered)
*---------------------------------------------------------------------------------------------------------------
*
* pls Note: All scriptCalls return the current active Z anchor in Console F8 !
*
*(Plugin scriptCalls return false if any added data/eventId/Number ect is wrong)
*
* CREDITS to Eliaquim who mentioned a similar idea in rpg maker Forum
*
* ============================================================================
* Terms of Use (MIT License)
* ============================================================================
* Free for any commercial or non-commercial project!
* (edits are allowed but pls dont claim it as yours without Credits.thx)
* ============================================================================
* Changelog
* ============================================================================
* Version 1.0:
* - first Release 08.11.2022 for rpg mv!
*/
(function() {
// Plugin param Variables:
var parameters = PluginManager.parameters("prioCharZ") ||
$plugins.filter(function (plugin) {return plugin.description.contains('<prioCharZ>')});
//-----------------------------------------------------------------------------------------
// replace Default function
// dopan add Z controll.. by default=> # prio0 = screenZ 1 # prio1 = screenZ 3 # prio2 = screenZ 5 #
Game_CharacterBase.prototype.screenZ = function() {
// if new Z was installed
if (this._charZ !== undefined) return this._charZ;
// default function usage
return this._priorityType * 2 + 1;
};
// new functions:
Game_Map.prototype.setCharPrio = function(eventId, zValue) {
var evId = eventId; var charZ = zValue;
if (this.event(evId) && charZ) this.event(evId)._charZ = charZ; return this.event(evId)._charZ
return false;
};
Game_Map.prototype.resetCharPrio = function(eventId) {
if (this.event(evId)._charZ !== undefined) this.event(evId)._charZ = undefined; return this.event(evId).screenZ();
return false;
};
Game_Player.prototype.setCharPrio = function(zValue) {
var charZ = zValue;
if (charZ) this._charZ = charZ; return this._charZ
return false;
};
Game_Player.prototype.resetCharPrio = function() {
if (this._charZ !== undefined) this._charZ = undefined; return this.screenZ();
return false;
};
Game_Followers.prototype.setCharPrio = function(dataId, zValue) {
var dId = dataId; var charZ = zValue;
if (dId && charZ) this._data[dId]._charZ = charZ; return this._data[dId]._charZ
return false;
};
Game_Followers.prototype.resetCharPrio = function(dataId) {
var dId = dataId;
if (dId && this._charZ !== undefined) this._data[dId]._charZ = undefined; return this._data[dId].screenZ();
return false;
};
//--End:
})();