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

[转载发布] Random Enemy Hue v1.0

[复制链接]
累计送礼:
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 天前 | 显示全部楼层 |阅读模式
    Introduction
    This plugin allows for randomising enemy hues.

    How to use
    Save it as APHO_RandomEnemyHue.js and put it in your plugin folder.
    If 'use default hue' is checked, a default hue adjustment will be applied at
    random to all enemies, based on the values defined in the plugin parameters.
    This is additive to whatever you have set in-editor.

    Additionally, the following notetags may be used in enemy noteboxes:
    1. <minhue:x>
    2. <maxhue:x>
    复制代码
    This sets the minimum/maximum hue adjustment of the enemy to be x.
    If only one is used, the other is assumed to be the default value specified in the plugin parameters.
    Maxhue must be higher than minhue. Negative numbers may be used.
    These values replace the defaults specified in the plugin parameters and are additive to the value defined in-editor.
    1. <randomhue>
    复制代码
    This sets the hue adjustment to be completely random.
    (i.e. all the possible hue variations from 0 - 359)
    1. <nohue>
    复制代码
    This sets the enemy to not have a hue adjustment, ignoring the defaults specified in the plugin parameters. (In-editor hue adjustments still apply)
    1. <defaulthue>
    复制代码
    If 'use default hue' is set to false, this notetag will override it for that enemy and use the default hue range specified in the plugin parameters.
    1. <keephue>
    复制代码
    This makes the enemy keep the hue adjustment of the previous form after transforming, overriding the plugin setting. Use it on the transformed enemy.

    1. <rerollhue>
    复制代码
    This makes the enemy reroll the hue adjustment after transforming, overriding the plugin setting. Use it on the transformed enemy.
    This does not copy the notetags from the previous enemy; you will need to add them to the transformed enemy as well if you want to re-use the same settings.

    Script
    Spoiler: code
                    JavaScript:       
    1. //==========================================
    2. // APHO_RandomEnemyHue.js
    3. //==========================================
    4. /*:
    5. * @title Random Enemy Hue
    6. * @author Apho
    7. * @plugindesc v1.0 Allows for randomising enemy hues.
    8. *
    9. * @param UseDefaultHue
    10. * @text Use default hue?
    11. * @type boolean
    12. * @desc Use the default hue adjustments specified in this plugin for enemies without a valid notetag?
    13. * @default true
    14. *
    15. * @param DefaultHueMin
    16. * @text Default minimum hue
    17. * @type number
    18. * @desc Default minimum hue adjustment for enemies. This is additive to whatever is specified in-editor.
    19. * @min -360
    20. * @default -15
    21. *
    22. * @param DefaultHueMax
    23. * @text Default maximum hue
    24. * @type number
    25. * @desc Default maximum hue adjustment for enemies. This is additive to whatever is specified in-editor.
    26. * @min -360
    27. * @default 15
    28. *
    29. * @param UseSaveHue
    30. * @text Keep hue on transform?
    31. * @type boolean
    32. * @desc When using Enemy Transform, should enemies keep their previous hue adjustment?
    33. * @default true
    34. *
    35. * @help
    36. * This plugin allows for randomising enemy hues.
    37. * If 'use default hue' is checked, a default hue adjustment will be applied at
    38. * random to all enemies, based on the values defined in the plugin parameters.
    39. * This is additive to whatever you have set in-editor.
    40. *
    41. * Additionally, the following notetags may be used in enemy noteboxes:
    42. *
    43. * <minhue:x>
    44. * <maxhue:x>
    45. * This sets the minimum/maximum hue adjustment of the enemy to be x.
    46. * If only one is used, the other is assumed to be the default value specified in
    47. * the plugin parameters.
    48. * Maxhue must be higher than minhue. Negative numbers may be used.
    49. * These values replace the defaults specified in the plugin parameters and are
    50. * additive to the value defined in-editor.
    51. *
    52. * <randomhue>
    53. * This sets the hue adjustment to be completely random.
    54. * (i.e. all the possible hue variations from 0 - 359)
    55. *
    56. * <nohue>
    57. * This sets the enemy to not have a hue adjustment, ignoring the defaults
    58. * specified in the plugin parameters. (In-editor hue adjustments still apply)
    59. *
    60. * <defaulthue>
    61. * If 'use default hue' is set to false, this notetag will override it for that
    62. * enemy and use the default hue range specified in the plugin parameters.
    63. *
    64. * <keephue>
    65. * This makes the enemy keep the hue adjustment of the previous form after
    66. * transforming, overriding the plugin setting. Use it on the transformed enemy.
    67. *
    68. * <rerollhue>
    69. * This makes the enemy reroll the hue adjustment after transforming, overriding
    70. * the plugin setting. Use it on the transformed enemy.
    71. * This does not copy the notetags from the previous enemy; you will need to add
    72. * them to the transformed enemy as well if you want to re-use the same settings.
    73. *
    74. * TERMS OF USE
    75. * - Free for commercial and non-commercial use, as long as I get a free copy
    76. *   of the game.
    77. * - Edits allowed for personal use.
    78. * - Do not repost or claim as your own, even if edited.
    79. *
    80. * VERSION HISTORY
    81. * v1.0 - 2023/7/1 - Initial release.
    82. */
    83. (function(){
    84.     var parameters = PluginManager.parameters('APHO_RandomEnemyHue');
    85.     var UseDefaultHue = JSON.parse(parameters['UseDefaultHue']);
    86.     var DefaultHueMin = parseInt(parameters['DefaultHueMin']);
    87.     var DefaultHueMax = parseInt(parameters['DefaultHueMax']);
    88.     var DefaultHueRange = Math.max(DefaultHueMax - DefaultHueMin, 0);
    89.     var UseSaveHue = JSON.parse(parameters['UseSaveHue']);
    90.     Sprite_Enemy.prototype.updateBitmap = function() {
    91.         Sprite_Battler.prototype.updateBitmap.call(this);
    92.         var name = this._enemy.battlerName();
    93.         var hue = this._enemy.battlerHue();
    94.         if (this._battlerName !== name || this._battlerHue !== hue || (this._id && this._id !== this._enemy.enemy().id)) {
    95.             this._id = this._enemy.enemy().id
    96.             this._battlerName = name;
    97.             this._battlerHue = hue;
    98.             if(this._savedHue && ((UseSaveHue && !this._enemy.enemy().meta.rerollhue) || this._enemy.enemy().meta.keephue))
    99.             {
    100.                 this.loadBitmap(name, hue + this._savedHue);
    101.             }else if(this._enemy.enemy().meta.minhue || this._enemy.enemy().meta.maxhue)
    102.             {
    103.                 let HueMin = this._enemy.enemy().meta.minhue ? parseInt(this._enemy.enemy().meta.minhue) : DefaultHueMin
    104.                 let HueMax = this._enemy.enemy().meta.maxhue ? parseInt(this._enemy.enemy().meta.maxhue) : DefaultHueMax
    105.                 let HueRange = Math.max(HueMax - HueMin, 0)
    106.                 this._savedHue =  HueMin + Math.randomInt(HueRange)
    107.                 this.loadBitmap(name, hue + this._savedHue);
    108.                
    109.             }else if(this._enemy.enemy().meta.randomhue)
    110.             {
    111.                 this._savedHue = Math.randomInt(360);
    112.                 this.loadBitmap(name, hue + this._savedHue);
    113.             }else if((UseDefaultHue && !this._enemy.enemy().meta.nohue) || this._enemy.enemy().meta.defaulthue)
    114.             {
    115.                 this._savedHue = DefaultHueMin + Math.randomInt(DefaultHueRange);
    116.                 this.loadBitmap(name, hue + this._savedHue);
    117.             }else
    118.             {
    119.                 this.loadBitmap(name, hue);
    120.             }
    121.             this.initVisibility();
    122.         }
    123.     };
    124. })();
    复制代码


    Note
    If you are using YEP_X_AnimatedSVEnemies.js, this plugin needs to be above it, or the game will crash upon attempting to load any enemy which uses img/sv_actors/. Also, this plugin does not work on enemies using sprites from img/sv_actors/.

    Terms of use

    • Free for commercial and non-commercial use, as long as I get a free copy of the game.
    • Edits allowed for personal use.
    • Do not repost or claim as your own, even if edited.
    Version history
    v1.0 - 2023/7/1- Initial release.

    Download link
    GitHub


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 04:49 , Processed in 0.140193 second(s), 57 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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