じ☆ve冰风 发表于 2026-7-29 14:57:45

dopan's prioCharZ.js

dopan's prioCharZ.js​


By default we could only change chars Z anchor by editing the "priorityType"..
This can be done with funny numbers to get the wanted result, but it overwrites the default data which is not stored anywhere else.
By default "priorityTypes" are the trigger for screenZ:

if priorityType = 0 # thats "below chara" and "screenZ_1"

if priorityType = 1 # thats "same as chara" and "screenZ_3"

if priorityType = 2 # thats "above chara" and "screenZ_5"

That happens because of these default rpgMV Functions:
Spoiler                JavaScript:       
Game_CharacterBase.prototype.screenZ = function() {
    return this._priorityType * 2 + 1;
};

//"screenZ()" gets updated with this from the Sprite_Character

Sprite_Character.prototype.updatePosition = function() {
    this.x = this._character.screenX();
    this.y = this._character.screenY();
    this.z = this._character.screenZ();
};






This plugin Provides you with scriptcalls that can replace "priorityType", without overwriting it.
It can be reseted to default with scriptcalls aswell and the "priorityType" wont be Touched/Edited. It will be replaced instead.
(default "priorityType" remains as system default storage)

Basicly "._charZ" the PluginData which replaces "._priorityType", when "._charZ" is not Undefined, is a PlaceHolder & Script Clone of the "._priorityType"-script.

Spoiler: Meme

As soon "._charZ" is activated with the plugin scriptcalls, this works for:
(on these examples Number of eventId & dataId & _charZ must be added)

- $gameMap.event(eventId)._charZ;
# eventId start with 1 #

- $gamePlayer._charZ;
# ._charZ can be any number that returns a valid z.Anchor #

- $gamePlayer._followers._data[dataId]._charZ;   
# dataId start with 0 #


The plugin provides you with more scriptcalls and Infos, i just wanted to show the basic infos here

MIT Licence

Free to Use for any Project

GitHub Link

Plugin Code:
Spoiler                JavaScript:       
//=============================================================================
// 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(, zValue); # dataId starts with 0 (decides which follower is triggered), zValue is the new Z Anchor
*
* - $gamePlayer._followers.resetCharPrio();       # dataId starts with 0 (decides which follower 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.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._charZ = charZ; return this._data._charZ
      return false;
    };

    Game_Followers.prototype.resetCharPrio = function(dataId) {
      var dId = dataId;
      if (dId && this._charZ !== undefined) this._data._charZ = undefined; return this._data.screenZ();
      return false;
    };

//--End:

})();





If anybody finds a Bug, it must be a typo, in such case pls let me know and i will fix it asap..
----
----
SideNote:
if anybody is looking for a free plugin that can manipulate the x/y Anchors of Chars pls visit here:
Character Anchors

Character Anchors 2019.02.13 by ShazIntroduction This plugin allows you to adjust the position of a character's sprite by changing the X and/or Y anchors. This would allow you, for example, to have a sprite that is larger than 48x48 centered both vertically and horizontally on the tile...

                                        forums.rpgmakerweb.com                               






本贴来自国际rpgmaker官方论坛作者:dopan处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/dopans-priocharz-js.152546/
页: [1]
查看完整版本: dopan&#039;s prioCharZ.js