Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Maliki's Experience Control MZ
- // MalExpControl.js
- // version 1.0a
- //=============================================================================
- /*:
- * @plugindesc ver1.0a - Allows Devs to set specific experience point totals needed for Actors to level up.
- * @author Maliki79
- *
- * @help To use this plugin, you must first set a set of experience point totals.
- * You must use the notetag <expset: x,y,z>
- * The first number is not used.
- * The second is used to set starting exp points.
- * Each following number will set the TOTAL amount of points needed to reach that level.
- * For example, tag <expset: 0,100,205,210> will set the starting exp point at
- * 100, the next nevel will require 105 points to level up and the next level
- * afterwards will need only 5 points.
- * (If you set a point value that is smaller than the previous number, the game
- * will skip that level and the player will level up multiple times.)
- *
- * 1: (Optional) You do not need to set numbers to level 99. If you do not,
- * the functional max level for that class will be whatever number you set.
- * So for the example above, the player using that class will only be able
- * to reach level 3 max. (This plugin does not allow levels to go beyond 99
- * due to the database setup of params.)
- * 2: (Optional) You can add point values to classes to increase the max level.
- * Using the script call
- * DataManager.expandExpSet(class, points needed to lvl up);
- * For example, the call DataManager.expandExpSet($gameParty.members()[0].currentClass(), 200);
- * Will add 200 to the noted actor's class. If added to the class tagged above,
- * it would add a 410 to the end.
- * 3: (Optional) You can also redo the entire point set. Using script call
- * DataManager.resetCustomExp(class, [array of values]);
- * This will NOT reset the amount of point the actor has.
- *
- * Note that if you do not use a exp set for a class, it will utilize the default
- * numbers.
- */
- var MalExpContDatabaseLoad = DataManager.isDatabaseLoaded;
- DataManager.isDatabaseLoaded = function() {
- if (!MalExpContDatabaseLoad.call(this)) return false;
- if (!DataManager._malExCont_DatabaseLoaded) {
- this.processExpCNotetags($dataClasses);
- DataManager._malExCont_DatabaseLoaded = true;
- }
- return true;
- };
- DataManager.processExpCNotetags = function(group) {
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- this.createCustomExp(obj);
- }
- };
- DataManager.createCustomExp = function(obj) {
- var expset = [];
- obj.expSet = [];
- var noteread = obj.note;
- while(noteread.indexOf("expset") > -1)
- {
- var notereg = noteread.split("<expset: ");
- var match = notereg[1].split(">");
- var match2 = match[0];
- expset = match2.split(",");
- noteread = noteread.replace("<expset: ", " ");
- for (var x = 0; x < expset.length; x++) obj.expSet.push(Number(expset[x]));
- }
- };
- var MalExpControlSetupNewGame = DataManager.setupNewGame;
- DataManager.setupNewGame = function() {
- MalExpControlSetupNewGame.call(this);
- this.processExpCNotetags($dataClasses);
- $gameSystem.setExpData();
- };
- DataManager.expandExpSet = function(chosenClass, value) {
- var c = chosenClass;
- c.expSet.push(c.expSet[c.expSet.length-1] + Number(value));
- $gameSystem.setExpData();
- };
- DataManager.resetCustomExp = function(dClass, values) {
- var expset = values;
- dClass.expSet = [];
- for (var x = 0; x < expset.length; x++) dClass.expSet.push(Number(expset[x]));
- $gameSystem.setExpData();
- };
- var malExpControlExtractsvCont = DataManager.extractSaveContents;
- DataManager.extractSaveContents = function(contents) {
- malExpControlExtractsvCont.call(this, contents);
- this.loadExpSets();
- };
- DataManager.loadExpSets = function() {
- for(var x = 1; x < $dataClasses.length; x++){
- $dataClasses[x].expSet = $gameSystem.expData[x];
- }
- };
- Game_System.prototype.setExpData = function() {
- this.expData = [];
- for(var x = 1; x < $dataClasses.length; x++){
- this.expData[x] = $dataClasses[x].expSet;
- }
- };
- Game_Actor.prototype.expForLevel = function(level) {
- const c = this.currentClass();
- if (c.expSet.length != 0) {
- var expset = c.expSet;
- return expset[level];
- }
- const basis = c.expParams[0];
- const extra = c.expParams[1];
- const acc_a = c.expParams[2];
- const acc_b = c.expParams[3];
- return Math.round(
- (basis * Math.pow(level - 1, 0.9 + acc_a / 250) * level * (level + 1)) /
- (6 + Math.pow(level, 2) / 50 / acc_b) +
- (level - 1) * extra
- );
- };
- Window_Status.prototype.expNextValue = function() {
- if (this._actor.isMaxLevel() || isNaN(this._actor.nextRequiredExp())) {
- return "-------";
- } else {
- return this._actor.nextRequiredExp();
- }
- };
Add Comment
Please, Sign In to add comment