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

[转载发布] Terrain Tag Passability - PG_TTagPass.js

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

    连续签到: 2 天

    [LV.7]常住居民III

    8357

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    This plugin gives you the ability to make terrain passable or not by turning switches on or off.  Instead of using regions (which are not related to the tiles used) it uses terrain tags. Up to 6 terrain tags may have their passability controlled. It overides the passability of land tiles with specific terrain tags.

    Spoiler: Why use Terrain Tags to Control Access?
    Terrain Tags are settings that can be made in the "Tilesets" tab of the editor. Individual tiles can be given a terrain tag of 0 to 7. Multiple tiles can have the same terrain tag. By default, all terrain tags are 0.

    Whenever a tile is used, the places it is used have the terrain tag of that tile.   Unlike regions, if you change your mind where a wood or mountain range is, the terrain tag of each place is set automatically.

    Terrain tags are a feature that I haven't previously used, and I suspect, are not used by many other people. Regions are sometimes used by other plugins for various effects. By default, they get used to control which enemies may be encountered in different areas of the same map. With this plugin, you could, for example, make all mountains impassable to the party, until they learn the mountaineering. Using a plugin that controls access by region, means that every time you edit the map you have to check whether the regions need updating. With this plugin, the party can be given access to previous blocked terrain by setting a switch.
    To use a switch to control passability for a terrain tag, put the switch number into the relevant parameter. If the switch is "On", then tiles with that terrain tag are passable for the party, while if the switch is "Off" then they are impassable. [Be aware that when using B to E sheet tiles, the uppermost tile's terrain tag tends to overwrite that of the A sheet tile underneath.] If you don't want to overide the passability of tiles with a particular terrain tag, leave the parameter for the switch controlling it as '0'.

    Version 2

                    JavaScript:       
    1. //=============================================================================
    2. // PG_TTagPass.js
    3. //=============================================================================
    4. /*:
    5. * @plugindesc Allows switched tile passability using terrain tags
    6. *
    7. * @author Piyan Glupak, amended for version 2 by Trihan
    8. *
    9. *
    10. * @help
    11. * This plugin has 6 parameters, for switches to control passability of tiles
    12. * with terrain tags of 2, 3 , 4, 5, 6 and 7. If the switch is 'on', then all
    13. * tiles with that terrain tag are passable. If the switch is 'off', then they
    14. * are impassable. If no switch is chosen for a terrain tag (parameter is '0'),
    15. * the
    16. * tiles with that terrain tag have their default passability.
    17. *
    18. * Terrain tags are '0' by default, but can be set in the editor.
    19. *
    20. * This is intended for land. It is possible to fly over tiles the tiles with
    21. * switched passability with the airship.
    22. *
    23. * This is Version 2.
    24. *
    25. * TERMS OF USE
    26.   **************************************************************************
    27. * TERMS OF USE
    28. * Free for use in commercial and non-commercial games. No liability accepted.
    29. * Credit Piyan Glupak and Trihan
    30. **************************************************************************
    31. *
    32. * COMPATIBILITY
    33. * No issues known
    34. *
    35. * Version 2 - Code improved by Trihan when he wrote a supplementry plugin to
    36. * improve visual aspects.
    37. * Version 1 - Original version by Piyan Glupak
    38. *
    39. * @param Terrain Tag 2 Flag
    40. * @type number
    41. * @min 0
    42. * @desc Number of the flag allowing passability of Terrain Tag 2
    43. * @default 0
    44. *
    45. * @param Terrain Tag 3 Flag
    46. * @type number
    47. * @min 0
    48. * @desc Number of the flag allowing passability of Terrain Tag 3
    49. * @default 0
    50. *
    51. * @param Terrain Tag 4 Flag
    52. * @type number
    53. * @min 0
    54. * @desc Number of the flag allowing passability of Terrain Tag 4
    55. * @default 0
    56. *
    57. * @param Terrain Tag 5 Flag
    58. * @type number
    59. * @min 0
    60. * @desc Number of the flag allowing passability of Terrain Tag 5
    61. * @default 0
    62. *
    63. * @param Terrain Tag 6 Flag
    64. * @type number
    65. * @min 0
    66. * @desc Number of the flag allowing passability of Terrain Tag 6
    67. * @default 0
    68. *
    69. * @param Terrain Tag 7 Flag
    70. * @type number
    71. * @min 0
    72. * @desc Number of the flag allowing passability of Terrain Tag 7
    73. * @default 0
    74. */
    75. window.PG = window.PG || {};
    76. PG.parameters = PluginManager.parameters('PG_TTagPass');
    77. PG.TFlag2 = Number(PG.parameters['Terrain Tag 2 Flag']);
    78. PG.TFlag3 = Number(PG.parameters['Terrain Tag 3 Flag']);
    79. PG.TFlag4 = Number(PG.parameters['Terrain Tag 4 Flag']);
    80. PG.TFlag5 = Number(PG.parameters['Terrain Tag 5 Flag']);
    81. PG.TFlag6 = Number(PG.parameters['Terrain Tag 6 Flag']);
    82. PG.TFlag7 = Number(PG.parameters['Terrain Tag 7 Flag']);
    83. Game_Map.prototype.checkPassage = function(x, y, bit) {
    84.     var flags = this.tilesetFlags();
    85.     var tiles = this.allTiles(x, y);
    86.     var TerTag = $gameMap.terrainTag(x,y);
    87.     for (const tile of tiles) {
    88.         const flag = flags[tile];
    89.         if ((flag & 0x10) !== 0)  //
    90. [*] No effect on passage
    91.             continue;
    92.         for (let i = 2; i <= 7; i++) {
    93.             const propName = `TFlag${i}`;
    94.             if (TerTag === i && PG[propName] > 0) {
    95.                 return $gameSwitches.value(PG[propName]);
    96.             }
    97.         }
    98.         if ((flag & bit) === 0)   // [o] Passable
    99.             return true;
    100.         if ((flag & bit) === bit) // [x] Impassable
    101.             return false;
    102.     }
    103.     return false;
    104. };
    复制代码


    Terms and Conditions:
    Free to use for both free and commercial games.  Please do not publish this elsewhere on the Internet, but link to this thread. (This is in case I ever need to update the plugin; I would want only the latest version to be available.) I would prefer to be credited, either as "Piyan Glupak" or by my real name. Please credit Trihan as well, if using version 2.

    Trihan's Supplementary Plugin may be found in post 7 of this thread.


    本贴来自国际rpgmaker官方论坛作者:Piyan Glupak处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/terrain-tag-passability-pg_ttagpass-js.164894/

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-2 02:18 , Processed in 0.068679 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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