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

[转载发布] (Relatively) Simple Steal System Plugin for MZ

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

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-16 16:33:55 | 显示全部楼层 |阅读模式
    Update 05/09/2023 - This plugin is outdated and superceded by my much less buggy and much easier to use new steal plugin AUTMOUSE_Steal.js. Please use it instead.
    ---------------------------

    Hello everyone. This is the first plugin I am releasing. I made it using CoffeeScript and have tested it on both an active project and a fresh project.

    This plugin allows you to set up a steal skill that is powered by a common event. You create you steal lists per enemy using note tags. I went looking for a steal system but couldn't find any that were not part of larger systems so I decided to make my own.

    It was hard! I learned so much, and I think it is a pretty useful little plugin. Let me know if you have questions. I am going to make a video tutorial for it this weekend. I am also thinking of making a video for those who are interested in making plugins using CoffeeScript. CoffeeScript is Ruby like and may be easier for some than js. It is for me.

                    JavaScript:       
    1. // Generated by CoffeeScript 2.7.0
    2. //=============================================================================
    3. // Simple Steal System for RPG Maker MZ
    4. // penny_steal.js
    5. // Copyright (c) 2022
    6. //=============================================================================
    7. /*:
    8. * @target MZ
    9. * @plugindesc Allows for the creation of a steal or mug skill.
    10. * @author Penny Gautreaux
    11. *
    12. * @help AMMZ_Steal.js
    13. *
    14. * This plugin is some assembly required.
    15. * Create a steal skill and configure it however you like.
    16. * In the damage formula use the following:
    17. * $gameVariables.setValue(20, b.enemyId()); ammzSteal.target = b; ammzSteal.user = a; (a.atk * 4 - b.def * 2) * 0.5
    18. * Replace the number 20 with the number you set to targetVariable parameter
    19. * The damage at the end (a.atk * 4 - b.def * 2) * 0.5 is optional.
    20. * Change or remove it to change or remove damage output from the skill.
    21. * the stuff before the final semicolon is required!
    22. * Under actions have the skill run a common event.
    23. *
    24. * The Common Event should be set to Trigger None
    25. * In the common event set the variable you used for Parameter targetItemVariable
    26. * to choose a random number between 0 and 3
    27. * The add a script event on page three with the following in the script:
    28. * ammzSteal.steal()
    29. *
    30. * Next create two states a rareStealState and a alreadyStolenFrom state.
    31. * You can call them whatever but make sure they correspond to the id you set in
    32. * the parameters, e.g. if parameter says 32 it needs to be state 32.
    33. *
    34. * Rare stealing is ignored by default but you can enable by having an item or equip
    35. * apply the state to the character using the steal skill.
    36. *
    37. * Lastly put notetags on every entry in your Enemies database.
    38. * Even things that are not really enemies. It will crash if you don't
    39. *
    40. * <stealList:x,x,x,x> where x is a database id for an item.
    41. * or
    42. * <rareStealList:y,y,y,y> where y is a database id for an item that you want to be on the rare steal list.
    43. *
    44. * Examples
    45. * <stealList:-1,-1,-1,-1> means nothing to steal
    46. * <stealList:7,7,7,7> means only stealable item is item 7 in the database
    47. * <rareStealList:23,23,24,24> means item 23 or 24 in the database may be stolen but only if rare steal is on.
    48. *
    49. *
    50. *
    51. * -License
    52. * This plugin is distributed under the MIT license.
    53. * Feel free to use it.
    54. * http://opensource.org/licenses/mit-license.php
    55. *
    56. * @param targetVariable
    57. * @type number
    58. * @desc Choose a variable that will hold the id of the target of the skill.
    59. * @text Variable to store target ID to.
    60. * @default 20
    61. *
    62. * @param targetItemVariable
    63. * @type number
    64. * @desc Choose a variable that will hold the id of item being stolen.
    65. * @text Variable to store stolen item ID to.
    66. * @default 19
    67. *
    68. * @param rareStealState
    69. * @type number
    70. * @desc State that enables stealing from the rare steal list.
    71. * @text Rare Steal State
    72. * @default 33
    73. *
    74. * @param alreadyStolenFromState
    75. * @type number
    76. * @desc state for enemies that says they have already been stolen from.
    77. * @text Already stolen from state
    78. * @default 32
    79. */
    80. var ammzSteal;
    81. ammzSteal = ammzSteal || {};
    82. ammzSteal.parameters = PluginManager.parameters('AMMZ_Steal');
    83. ammzSteal.stealList = [null];
    84. ammzSteal.rareStealList = [null];
    85. ammzSteal.tempArray = [null];
    86. ammzSteal.tempArray2 = [null];
    87. ammzSteal.rareStealState = 33;
    88. ammzSteal.alreadyStolenFromState = 32;
    89. (function () {
    90.   ammzSteal.setupSteal = function () {
    91.     var counter, enemy, i, j, k, len, len1, len2, purse, ref, ref1, results;
    92.     // Create an array of strings from meta tags in database
    93.     counter = 1;
    94.     for (i = 0, len = $dataEnemies.length; i < len; i++) {
    95.       enemy = $dataEnemies[i];
    96.       if (enemy !== null) {
    97.         ammzSteal.tempArray.push(enemy.meta.stealList.split(','));
    98.         ammzSteal.tempArray2.push(enemy.meta.rareStealList.split(','));
    99.       }
    100.     }
    101.     ref = ammzSteal.tempArray;
    102.     // Add enemy purses to Steal List
    103.     for (j = 0, len1 = ref.length; j < len1; j++) {
    104.       purse = ref[j];
    105.       if (purse !== null) {
    106.         ammzSteal.stealList.push(purse);
    107.       }
    108.     }
    109.     ref1 = ammzSteal.tempArray2;
    110.     // Add enemy purses to Rare Steal List
    111.     results = [];
    112.     for (k = 0, len2 = ref1.length; k < len2; k++) {
    113.       purse = ref1[k];
    114.       if (purse !== null) {
    115.         results.push(ammzSteal.rareStealList.push(purse));
    116.       } else {
    117.         results.push(void 0);
    118.       }
    119.     }
    120.     return results;
    121.   };
    122.   ammzSteal.steal = function () {
    123.     // Get steal list from enemy
    124.     ammzSteal.whichMonster = $gameVariables.value(parseInt(ammzSteal.parameters.targetVariable));
    125.     ammzSteal.whichItem = $gameVariables.value(parseInt(ammzSteal.parameters.targetItemVariable));
    126.     ammzSteal.rareStealState = parseInt(ammzSteal.parameters.rareStealState);
    127.     ammzSteal.alreadyStolenFromState = parseInt(ammzSteal.parameters.alreadyStolenFromState);
    128.     if (ammzSteal.user.isStateAffected(ammzSteal.rareStealState)) {
    129.       ammzSteal.item = ammzSteal.rareStealList[ammzSteal.whichMonster][ammzSteal.whichItem];
    130.     } else {
    131.       ammzSteal.item = ammzSteal.stealList[ammzSteal.whichMonster][ammzSteal.whichItem];
    132.     }
    133.     ammzSteal.stealChance = Math.randomInt(101);
    134.     if (ammzSteal.target.isStateAffected(ammzSteal.alreadyStolenFromState)) {
    135.       $gameMessage.add("The enemy doesn't have anything else to steal.");
    136.     } else if (ammzSteal.stealChance <= 50) {
    137.       if (ammzSteal.item !== -1) {
    138.         $gameParty.gainItem($dataItems[parseInt(ammzSteal.item)], 1);
    139.         $gameMessage.add('You stole a ' + $dataItems[parseInt(ammzSteal.item)].name + '!');
    140.         ammzSteal.target.addState(ammzSteal.alreadyStolenFromState);
    141.       } else {
    142.         $gameMessage.add("Nothing to steal...");
    143.       }
    144.     } else {
    145.       $gameMessage.add('You were unable to grab anything.');
    146.     }
    147.   };
    148. }).call(this);
    复制代码




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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-4 21:31 , Processed in 0.108967 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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