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

[转载发布] Custom Class Change V1.0.0

[复制链接]
累计送礼:
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 天前 | 显示全部楼层 |阅读模式
    Custom Class Change v1.0.0

    ArcherBanish

    Introduction
    A simple script that lets the developer have more control over the changing of an actor's class.

    Features
    This script provides a way to alter how the "Change Class..." event command works.
    It adds three options.


    • Keep the current exp when changing to the new class.
    • Forgeting the skills from the old class.
    • Learning the skills from the new class that would have been learned that level or the previous levels.
    It also provides a Plugin Command to call a class change with these options if the user does not wish to alter the "Change Class..." event command.
    Information on how this works is provided in the Help section of the plugin.

    How to Use
    - Copy the plugin code into a .js file or download the CustomClassChange.js file from the link (was deleted) and add it to the "js/plugins/" folder.
    - Load the plugin into the plugin manager.
    - Use change the plugin settings are desired or simply call the desired Script Command from an event.

    Plugin

    Spoiler                Code:       
    1. var Sterling = Sterling || {};
    2. /*:
    3. * @plugindesc v1.0.0 This plugin allows you to customize the Change Class command to some extent.
    4. * @author ArcherBanish
    5. *
    6. * @param --Class Change--
    7. * @default
    8. *
    9. * @param Keep Exp
    10. * @desc If you wish to keep the current Exp of the Actor on class change. [default = false]
    11. * YES - true NO - false
    12. * @default false
    13. *
    14. * @param Forget Old Skills
    15. * @desc If you wish to keep the skills from the old class. [default = false]
    16. * YES - true NO - false
    17. * @default false
    18. *
    19. * @param Get New Skils
    20. * @desc If you want the skills from the new class that could have been learned to be added. [default = true]
    21. * YES - true NO - false
    22. * @default true
    23. * @help
    24. * ====================
    25. * Class Change Options
    26. * ====================
    27. * This script is free for commercial or non-commercial projects, no credit necesary.
    28. *
    29. * IMPORTANT: This script changes the Class Change command. (command321) So any script that changes this command will not work.
    30. * Scripts that change the changeClass method from Game_Actor may also break this script.
    31. *
    32. * Parameter Description:
    33. * Keep Exp:
    34. * This is the main reason I made this plugin.
    35. * This parameter makes it so that when you change an actor's class he does not return to Level 1 but instead he retains the level he had in the first class.
    36. *
    37. * Forget Old Skills:
    38. * When you change an actor's class, by default he keeps all the skills from the old class. Set this to true if you wish the actor to forget his old skills.
    39. *
    40. * Get New Skills:
    41. * This is only aplicable if using the Keep Exp parameter. It makes it so that the skills that an actor could have learned are added to the actor after class change.
    42. * For Example if a Level 10 Warrior becomes a Level 10 Cleric he will not get the skill Heal that Cleric learns at Level 1 if you don't have this option set to true.
    43. *
    44. * PLUGIN COMMANDS:
    45. * IF you dont wish to atlter the old Change Class Event you can also use plugin commands to do what you want.
    46. *
    47. * Structure:
    48. * ChangeClass <command_option> <actorId> <newClassId>
    49. *
    50. * Options:
    51. *  keepExp                      -> changes the level only keeping Exp.
    52. *  forgetOld                    -> forgets skils from the old class.
    53. *  learnNew                     -> learns skills from the new class.
    54. *  keepExp_learnNew             -> keeps the Exp and learns skills from the new class.
    55. *  keepExp_forgetOld            -> keeps the Exp and forgets skils from the old class.
    56. *  keepExp_forgetOld_learnNew   -> keeps the Exp, forgets skills from the old class and learns skills from the new class.
    57. */ //=============================================================================
    58. Sterling.Parameters = PluginManager.parameters('CustomClassChange');
    59. Sterling.ClassChange = Sterling.ClassChange || {};
    60. Sterling.ClassChange.KeepExp = String(Sterling.Parameters['Keep Exp']);
    61. Sterling.ClassChange.ForgetOldSkills = String(Sterling.Parameters['Forget Old Skills']);
    62. Sterling.ClassChange.GetNewSkils = String(Sterling.Parameters['Get New Skils']);
    63. var customChangeClass = function(actorId, classId, keepExp, forgetOld, learnNew) {
    64.     var actor = $gameActors.actor(actorId);
    65.     if (actor && $dataClasses[classId]) {
    66.         if (forgetOld) {
    67.             actor._skills = [];
    68.         }
    69.         if (keepExp) {
    70.             actor.changeClass(classId, true);
    71.         } else {
    72.             actor.changeClass(classId, false);
    73.         }
    74.         if (learnNew) {
    75.             actor.currentClass().learnings.forEach(function(learning) {
    76.                 if (learning.level <= actor._level) {
    77.                     actor.learnSkill(learning.skillId);
    78.                 }
    79.             }, actor);
    80.         }
    81.     }
    82.     return true;
    83. }
    84. Game_Interpreter.prototype.command321 = function() {
    85.     customChangeClass(this._params[0], this._params[1], eval(Sterling.ClassChange.KeepExp), eval(Sterling.ClassChange.ForgetOldSkills), eval(Sterling.ClassChange.GetNewSkils));
    86.     return true;
    87. }
    88. Game_Actor.prototype.changeClass = function(classId, keepExp) {
    89.     if (keepExp) {
    90.         this._exp[classId] = this.currentExp();
    91.     }
    92.     this._classId = classId;
    93.     this.changeExp(this._exp[this._classId] || 0, false);
    94.     this.refresh();
    95. };
    96. var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    97. Game_Interpreter.prototype.pluginCommand = function(command, args) {
    98.     _Game_Interpreter_pluginCommand.call(this, command, args);
    99.     if (command === 'ChangeClass') {
    100.         var actorId = args[1];
    101.         var classId = args[2];
    102.         switch (args[0]) {
    103.             case 'keepExp':
    104.                 customChangeClass(actorId, classId, true, false, false);
    105.                 break;
    106.             case 'keepExp_learnNew':
    107.                 customChangeClass(actorId, classId, true, false, true);
    108.                 break;
    109.             case 'keepExp_forgetOld_learnNew':
    110.                 customChangeClass(actorId, classId, true, true, true);
    111.                 break;
    112.             case 'keepExp_forgetOld':
    113.                 customChangeClass(actorId, classId, true, true, false);
    114.                 break;
    115.             case 'forgetOld':
    116.                 customChangeClass(actorId, classId, false, true, false);
    117.                 break;
    118.             case 'learnNew':
    119.                 customChangeClass(actorId, classId, false, false, true);
    120.                 break;
    121.             case 'forgetOld_learnNew':
    122.                 customChangeClass(actorId, classId, false, true, true);
    123.                 break;
    124.         }
    125.     }
    126. };
    复制代码





    Change Log:
    Spoiler27/10/2015 - v1.0.0: First Release



    Credit and Thanks
    - ArcherBanish
    - Thanks to Yanfly since I used their plugins to learn how to make one.


    本贴来自国际rpgmaker官方论坛作者:ArcherBanish处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/custom-class-change-v1-0-0.47747/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    简体中文
    繁體中文
    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.126411 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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