Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // ** CustomVariableCommandsBETA.js
- //-----------------------------------------------------------------------------
- // Rafael_Sol_Maker's Custom Commands for built-in Variables MV (BETA)
- // This work is licensed under a Creative Commons
- // Attribution 4.0 International License.
- //=============================================================================
- /*:
- * @plugindesc (BETA) Custom Commands for built-in Variables MV. (BETA)
- * WARNING: This plugin is experimental and very sensible to wrong values!
- * @author Rafael_Sol_MAKER (www.condadobraveheart.com)
- *
- * @help
- * (This plugins has no parameters to configure)
- *
- * Plugin Commands:
- *
- * ConditionalBranchActor <actor_id> <condition> <value> <switch>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <condition> OnGroup?, Name, Class, Skill, Weapon, Armor or State
- * <value> true/false, "Some Text" or item id (use wisely!)
- * <switch> Id of the switch activated, if the condition is met
- *
- * ChangeAllItems <item_type> <item_id> <ammount> <includeEquips?>
- * Where: <item_type> Items, Weapons or Armors
- * <item_id> Id of the item, weapon or armor you want to manipulate
- * <ammount> Put the quantity here (including negative)
- * <includeEquips?> If equiped items are considered (for removal)
- *
- * ChangePartyMember <actor_id> <operation> <reset?>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <operation> Add or Remove
- * <reset> If you want to reset the hero to initial conditions
- *
- * ChangeEquipment <actor_id> <type> <equip_id>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <id_equip_type> Put the id of the type of equipment
- * <equip_id> Id of weapon or armor to equip in the given hero
- *
- * ChangeName <actor_id> <data>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <data> The text that will be the new name
- *
- * ChangeClass <actor_id> <class_id> <keep_exp?>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <class_id> Id of the class that you want
- * <keep_exp?> If you want to keep the exp. the hero already have
- *
- * ChangeNickname <actor_id> <data>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <data> The new nickname you desire for your character
- *
- * ChangeProfile <actor_id> <data>
- * Where: <actor_id> Represents the variable to store the actor's id
- * <data> The new profile text you would like to set
- *
- * Just make sure that you're using the correct IDs by checking them in
- * Database before trying to use, in order to avoid unexpected errors.
- *
- */
- // IMPORTANT: TO_DO, KNOWN ISSUES AND MISC
- // TO-DO: We can do it better for the 3 text functions. Maybe next time!
- // TO-DO: Error checking on variables, give error or default values
- // KNOWN ISSUE: Actor name branch only accept a single name...
- //==============================================================================
- // ** PARAMETERS, COMMANDS & MISC
- //------------------------------------------------------------------------------
- // Let's handle it here and now!
- //==============================================================================
- (function() {
- // Dealing with our commands here
- var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- _Game_Interpreter_pluginCommand.call(this, command, args);
- // Unless I say otherwise...
- var actor = $gameActors.actor(Number($gameVariables.value(args[0])) || 1);
- //Plugin Commands Goes Here
- switch (command) {
- case 'ConditionalBranchActor': // Conditional Branch for Actors
- var value = args[2];
- var result = false;
- switch (args[1]) {
- case 'OnGroup?': // In the Party
- result = $gameParty.members().contains(actor);
- break;
- case 'Name': // Name
- result = (actor.name() === value);
- break;
- case 'Class': // Class
- result = actor.isClass($dataClasses[value]);
- break;
- case 'Skill': // Skill
- result = actor.isLearnedSkill(value);
- break;
- case 'Weapon': // Weapon
- result = actor.hasWeapon($dataWeapons[value]);
- break;
- case 'Armor': // Armor
- result = actor.hasArmor($dataArmors[value]);
- break;
- case 'State': // State
- result = actor.isStateAffected(value);
- break;
- }
- $gameSwitches.setValue(args[0], result);
- break;
- case 'ChangeItems': // Change Items, Weapons and Armors
- if (args[0] === 'Items'){
- var data = $dataItems[args[1]];
- } else if (args[0] === 'Weapons'){
- var data = $dataWeapons[args[1]];
- } else if (args[0] === 'Armors'){
- var data = $dataArmors[args[1]];
- }
- var ammount = args[2]
- var inclEquips = args[3];
- $gameParty.gainItem(data, ammount, inclEquips);
- break;
- case 'ChangePartyMember':
- // Change Party Member
- if (args[1] === 'Add') { // Add
- $gameParty.addActor(args[0]);
- } else if (args[1] === 'Remove') { // Remove
- $gameParty.removeActor(args[0]);
- }
- if (args[2] === true) { // Initialize, aka Reset
- $gameActors.actor(args[0]).setup(args[0]);
- }
- break;
- case 'ChangeEquipment': // Change Equipment
- actor.changeEquipById(args[1], args[2]);
- case 'ChangeClass': // Change Class
- actor.changeClass(args[1], false); // Keep EXP?
- break;
- case 'ChangeName': // Change Name
- var c = 0; for (var t in args){ c++; }; c -= 3
- var text = args[1]; // Starting filling
- for (var t = 2; t < c; t++){
- text += ' ' + args[t]; // Fill the remaning
- }
- actor.setName(text);
- break;
- case 'ChangeNickname': // Change Nickname
- var c = 0; for (var t in args){ c++; }; c -= 3
- var text = args[1]; // Starting filling
- for (var t = 2; t < c; t++){
- text += ' ' + args[t]; // Fill the remaning
- }
- actor.setNickname(text);
- break;
- case 'ChangeProfile': // Change Profile
- var c = 0; for (var t in args){ c++; }; c -= 3
- var text = args[1]; // Starting filling
- for (var t = 2; t < c; t++){
- text += ' ' + args[t]; // Fill the remaning
- }
- actor.setProfile(text);
- break;
- } // end of: switch(command)
- }; //end of: function
- //==============================================================================
- // ** END OF CODE
- //==============================================================================
- })(); //Don't remove this!
Advertisement
Add Comment
Please, Sign In to add comment