设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 59|回复: 0

[转载发布] dopan's prioCharZ.js

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29925
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38778

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    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:       
    1. Game_CharacterBase.prototype.screenZ = function() {
    2.     return this._priorityType * 2 + 1;
    3. };
    4. //"screenZ()" gets updated with this from the Sprite_Character
    5. Sprite_Character.prototype.updatePosition = function() {
    6.     this.x = this._character.screenX();
    7.     this.y = this._character.screenY();
    8.     this.z = this._character.screenZ();
    9. };
    复制代码






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





    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 Shaz  Introduction 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/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 02:32 , Processed in 0.096137 second(s), 57 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表