Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Maliki's DM_Independent Items Extension - Random Parameters
- // Mal_DMII_RandomParams.js
- // version 1.0 MZ
- //=============================================================================
- /*:
- * @target MZ
- *
- * @plugindesc ver1.0 MZ - Allows users of DM's Independent Items to set random params to weapons and Armor Equips.
- * @author Maliki79
- *
- * @help You need three steps to use this plugin:
- * 1: Make sure DM_IndependentItems is added to your project properly.
- * 2: Make sure desired weapons and armors are tagged to be Independent Items.
- * 3: Tag Weapon/Items with <maliiRandomParams: x, y> with x being the param number and y being the max range.
- *
- * Param numbers are as followed: 0 = MaxHP, 1 = MaxMP, 2 = Atk, 3 = Def,
- * 4 = MAT, 5 = MDF, 6 = AGI, 7 = Luk
- *
- * You may use as many of this tag as needed and the plugin will add all the same params together to get the max range of randomness.
- *
- * So for example, if you use the tag <maliiRandomParams: 2, 20> on a weapon or armor with 70 atk,
- * The plugin will randomly give the equip an atk value between 50 and 90. (70 +-20)
- * The value can potentially go into the negative.
- */
- var MalDMIIDatabaseLoad = DataManager.isDatabaseLoaded;
- DataManager.isDatabaseLoaded = function() {
- if (!MalDMIIDatabaseLoad.call(this)) return false;
- if (!DataManager._MalDMII_DatabaseLoaded) {
- this.processDMIINotetags($dataWeapons);
- this.processDMIINotetags($dataArmors);
- DataManager._MalDMII_DatabaseLoaded = true;
- }
- return true;
- };
- DataManager.processDMIINotetags = function(group) {
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- obj.instanceParams = [0,0,0,0,0,0,0,0];
- this.createIIrandomParams(obj);
- }
- };
- DataManager.createIIrandomParams = function(obj) {
- var noteread = obj.note;
- while(noteread.indexOf("maliiRandomParams") > -1)
- {
- var notereg = noteread.split("<maliiRandomParams: ");
- var match = notereg[1].split(">");
- match = match[0].split(", ");
- obj.instanceParams[parseInt(match[0])] += parseInt(match[1]);
- noteread = noteread.replace("<maliiRandomParams: ", " ");
- }
- };
- var DMIIgainItem = Game_Party.prototype.gainItem;
- Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
- DMIIgainItem.call(this, item, amount, includeEquip);
- if(item && item.meta.independentItem) $gameParty.applyRandomStats(item);
- };
- Game_Party.prototype.applyRandomStats = function(item) {
- for (var i=0; i < 8; i++) {
- if(item.instanceParams[i] != 0) {
- var numb = Math.randomInt(item.instanceParams[i]+1);
- if (Math.randomInt(2) == 1) numb *= -1;
- item.params[i] += numb;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement