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

[转载发布] WiggleLib - Variable Encounters & Random Encounter Formula

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

    连续签到: 2 天

    [LV.7]常住居民III

    7977

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    WiggleLib - Encounter Plugins
    Author: JumbocactuarX27 (aka Wiggle)


    *NOTE*
    These are old scripts and were for the early versions of RPG Maker MV. I have not tested them on more recent versions!


    Introduction
    In creating my first RPG Maker MV game, I found myself looking for a few specific plugins. Not able to find them, I decided to create them myself. Now I am happy to offer them for download and use by the greater RPG Maker community. In this post I'll introduce two seperate, but related, plugins: Variable Encounter and Random Encounter Formula.

    Features
    Random Encounter Formula

    This plugin allows you to customize the way that the number of steps until the next random encounter is triggered. By default, RPG Maker looks at the map's encoutnerStep property and does the following calculation:

    Math.randomInt(encounterStep) + Math.randomInt(encounterStep) + 1But with this plugin, you can have access to that encounterStep variable and change it to whatever you want. For example, if you wanted to have the encounter length be no less than half the encounter step but no more than 1.5 times the encounter step, you could change it to:

    Math.ceil(encounterStep / 2) + Math.randomInt(encounterStep)Variable Encounter

    With this plugin, you can use plugin commands to alter the weight or regionSet of a troop on a map, the available troops for a map, or even the encounter step, changing how often battles occur on a map!



    Using script or plugin commands with this plugin you can:


    • Add a troop to a map's encounter list
    • Remove a troop from a map's encounter list
    • Clear all troops from a map's encounter list
    • Set the regions a troop appears on in a map
    • Change the probability a given troop will appear on a map's random encounter
    • Change the encounterStep property for a given map.

    How to Use
    Install the plugins and turn them on. For the Random Encounter Formula, configure the formula you'd like by changing the Formula parameter. For the Variable Encounter plugin you can configure the Storage ID parameter which defines which game variable the encounter data will be stored in (this allows the changes in encounter lists to be persisted in the save file between play sessions). At this point you are ready to start using plugin commands.

    Below is the variable encounter plugin help text inside a spoiler. The random encounter formula plugin has no help text.
    Spoiler: Variable Encounter Help Text
                    Code:       
    1. // ============================================================================
    2. * Introduction
    3. * ============================================================================
    4. * No matter how much time you spend in an area killing monsters in an RPG
    5. * Maker game's random encounters, the enemies just keep coming. What if you
    6. * could alter the encounter list for maps though? What if your actions in a
    7. * dungeon caused the creatures you could encounter in that dungeon, or even
    8. * another dungeon, to change? What if you could hunt a monster to extinction?
    9. * If these ideas excite you, then the Variable Encounter plugin is for you.
    10. *
    11. * With this plugin, you can use plugin commands to alter the weight or
    12. * regionSet of a troop on a map, the available troops for a map, or even the
    13. * encounter step, changing how often battles occur on a map!
    14. *
    15. * ============================================================================
    16. * Important Information!
    17. * ============================================================================
    18. * If you try to perform an operation listed below on a map that your player
    19. * has not visited yet, generally nothing will happen. You will not be able
    20. * to modify their encounter list until the player has visited that map!
    21. * However, there is a workaround for this. If you wish to modify a map's
    22. * encounter list before it is visited by the player, you must use a script
    23. * command to create empty map data for that map.
    24. * The command for this is: WiggleLib.VariableEncounter._createMapEntry(mapId)
    25. *
    26. * For example, if you wanted to alter encounter data for map #8 and the
    27. * player has not visited map #8 yet, you would have to create a script event
    28. * and enter the following:
    29. * WiggleLib.VariableEncounter._createMapEntry(8);
    30. *
    31. * Perhaps your player may have visited map #8 already or perhaps they have
    32. * not. If they have, the command listed above will overwrite any encounter
    33. * data that already exists for map #8. In this case please check if the map
    34. * data exists first. The following code will only create map data if it
    35. * does not already exist:
    36. * if (WiggleLib.VariableEncounter._getMapData(8) === undefined) {
    37. *     WiggleLib.VariableEncounter._createMapEntry(8);
    38. * }
    39. * ============================================================================
    40. * Parameters
    41. * ============================================================================
    42. * Storage ID (Default: 1)
    43. * The Storage ID parameter is what lets the changes you make persist between
    44. * play sessions. This plugin keeps its data in a game variable and references
    45. * that data as the player travels through the game. Without being able to
    46. * store the altered encounter data in a variable, the changes you make would
    47. * be reset every time a player loads a game.
    48. * Do not overwrite the specified variable in the game events, or this plugin
    49. * will, at worst, crash or, at best, stop working.
    50. *
    51. * ============================================================================
    52. * Plugin Commands
    53. * ============================================================================
    54. *
    55. * All plugin commands begin with "VariableEncounter".
    56. *
    57. * Add <troopId> <weight> <mapId>
    58. * Adds a troop to a map's encounter list. You must specify the ID of the enemy
    59. * troop you want to add and you must specify a weight for that troop, just
    60. * like if you were adding them to the encounter list in the editor via map
    61. * properties. The mapId parameter is optional, and if omitted will add the
    62. * encounter to the map that is currently loaded when the command is run. No
    63. * regionSet data will be added with this command, meaning that the encounter
    64. * will be available everywhere on the map. If you want to add regionSet data
    65. * for an encounter, add it with this command and then run the Region
    66. * command (see below).
    67. * Example Use: VariableEncounter Add 1 5 8
    68. *     (Adds troop #1 to the encounter list of map #8 with a weight of 5)
    69. *
    70. * Remove <troopId> <mapId>
    71. * Removes a troop from a map's encounter list. You must specify the ID of the
    72. * enemy troop you want to remove. The mapId parameter is optional, and if
    73. * omitted will remove the troop from the map that is currently loaded when the
    74. * command is run. If the troop specified is not in the specified map's
    75. * encounter list, nothing will happen.
    76. * Example Use: VariableEncounter Remove 1 8
    77. *     (Removes troop #1 from the encounter list of map #8)
    78. *
    79. * Update <troopId> <weight> <mapId>
    80. * Updates the weight of a troop on a map's encounter list. You must specify
    81. * the ID of the enemy troop you want to update and you must specify a new
    82. * weight for them. If your weight is not a valid number, it will be set to 0.
    83. * The mapId parameter is optional, and if omitted will update the troop on
    84. * the map that is currently loaded when the command is run. If the troop
    85. * specified is not in the specified map's encounter list, nothing will
    86. * be updated.
    87. * Example Use: VariableEncounter Update 1 40 8
    88. *     (Updates the weight of troop #1 on map #8 to 40)
    89. *
    90. * Region <troopId> <regionSet> <mapId>
    91. * Sets the regions that an enemy troop can appear in on a map. You must
    92. * specify the ID of the enemy troop you want to set region data for. The
    93. * regionSet parameter must also be set, and must be an array of region IDs
    94. * seperated by commas without any spaces. The mapId parameter is optional,
    95. * and if omitted will set the region for the specified troop on the map that
    96. * is currently loaded when the command is run. If the troop specified is not
    97. * in the specified map's encounter list, nothing will happen.
    98. * Example Use: VariableEncounter Region 1 [1,2,3] 8
    99. *     (This command makes troop 1 appear only in regions 1, 2, and 3 on map 8)
    100. * Another Example: VariableEncounter Region 1 [] 8
    101. *     (This command makes troop 1 appear anywhere on map 8)
    102. * One More Example: VariableEncounter Region 1 [1, 2, 3] 8
    103. *     (This command will *not* work! You cannot have spaces in the array!)
    104. *
    105. * Clear <mapId>
    106. * Clears the encounter list for the specified map. The mapId parameter is
    107. * optional, and if omitted will set the region for the specified troop on the
    108. * map that is currently loaded when the command is run.
    109. * Example Use: VariableEncounter Clear 8
    110. *     (The encounter list for map #8 is empty and no random encounters will
    111. *      occur there until you use the Add command for that map (see above))
    112. *
    113. * Step <encounterStep> <mapId>
    114. * Sets the average number of steps that it will take to trigger a random
    115. * battle on the specified map. The mapId parameter is optional, and if
    116. * omitted will set the region for the specified troop on the map that
    117. * is currently loaded when the command is run.
    118. * If you would like to change the default method of calculating when to
    119. * trigger a random battle, please look for my Random Encounter Formula
    120. * plugin.
    121. * Example Use: VariableEncounter Step 60 8
    122. *     (Sets the encounter step parameter for map #8 to 60)
    123. *
    124. * ============================================================================
    125. * Script Commands
    126. * ============================================================================
    127. * I won't provide too much information here, but if you want to use scripts
    128. * commands instead of plugin commands, here is a quick table of equivalent
    129. * commands. If you'd like more detail, please look at the functions below or
    130. * feel free to ask me directly by PM-ing me at the rpgmakerweb forums. My
    131. * username is: JumbocactuarX27
    132. *
    133. * Plugin | Script Function
    134. * ======================================
    135. * Add    | WiggleLib.VariableEncounter.addEncounter(troopId, weight, mapId)
    136. * Remove | WiggleLib.VariableEncounter.removeEncounter(troopId, mapId)
    137. * Update | WiggleLib.VariableEncounter.updateEncounter(troopId, weight, mapId)
    138. * Region | WiggleLib.VariableEncounter.updateRegionSet(troopId, regionSet, mapId)
    139. * Clear  | WiggleLib.VariableEncounter.clearEncounterList(mapId)
    140. * Step   | WiggleLib.VariableEncounter.changeEncounterStep(encounterStep, mapId)
    141. */
    142. //=============================================================================
    复制代码


    Demo
    I don't have a demo that uses these plugins right now. I can put one together if there's demand.

    Download
    Both files are attached below.

    Known Issues
    I don't know of any bugs in this plugin, but if you find some report them here and I'll fix it.

    Important development considerations for the Variable Encounter plugin

    This can be found in the Variable Encounter help file as well with more information, but it's very important to consider this if you're getting really into using the plugin:

    If you try to perform an operation listed below on a map that your player has not visited yet, generally nothing will happen. You will not be able to modify their encounter list until the player has visited that map!However, there is a workaround for this. If you wish to modify a map's encounter list before it is visited by the player, you must use a script command to create empty map data for that map. The command for this is:                                 Code:       
    1. WiggleLib.VariableEncounter._createMapEntry(mapId)
    复制代码


    Terms of Use

    Please feel free to use these scripts commercially or non-commercially. If you use it commercially please credit me in your game's credits and let me know about your game's release! I'd love to link to it here.


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 08:36 , Processed in 0.117106 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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