I don't know what I'm doing at all, but gosh darn I'm a big proponent of throwing yourself into the deep end, so I'm trying to write a plugin pretty much without any understanding of what I'm actually accomplishing. I think I'm close to making it so that you get skill experience every time you use a skill, but so far I'm getting nothing. If somebody could help point me towards the right direction (if I'm even doing it right), I'd really appreciate it.
Quick addendums: I'm currently using the skill cost spot to show me the skill experience, and I know you can integrate functions into already existing code, so I do plan on cleaning up the Game_Action.prototype.apply function.
JavaScript:
// Skill System //
(function() {
//======================================================================//
var _Scene_Boot_start = Scene_Boot.prototype.start;
Scene_Boot.prototype.start = function() {
_Scene_Boot_start.call(this);
DataManager.processSkillEXP();
};
DataManager.processSkillEXP = function() {
for (var i = 1; i < $dataSkills.length; i++) {
var skill = $dataSkills[i];
skill._skillEXP = Number();
}
};
Game_BattlerBase.prototype.Skill_EXP = function(skill) {
return skill._skillEXP
};
Game_BattlerBase.prototype.Current_Skill_Exp = function(skill) {
return this.Skill_EXP(skill);
};
Game_BattlerBase.prototype.Change_Skill_EXP = function(skill) {
return this._skillEXP += 16;
};
// =============
// Apply Skill Experience
// =============
Game_Action.prototype.Apply_Change_Skill_EXP = function(target) {
return this.subject().Change_Skill_EXP
};
Game_Action.prototype.apply = function(target) {
const subject = this.subject()
const result = target.result();
this.subject().clearResult();
result.clear();
result.used = this.testApply(target);
result.missed = result.used && Math.random() >= this.itemHit(target);
result.evaded = !result.missed && Math.random() < this.itemEva(target);
result.physical = this.isPhysical();
result.drain = this.isDrain();
if (result.isHit()) {
if (this.item().damage.type > 0) {
result.critical = Math.random() < this.itemCri(target);
const value = this.makeDamageValue(target, result.critical);
this.executeDamage(target, value);
this.Apply_Change_Skill_EXP(subject)
}
for (const effect of this.item().effects) {
this.applyItemEffect(target, effect);
}
this.applyItemUserEffect(target);
}
this.updateLastTarget(target);
};
// =============
// Draw Skill level
// =============
const SLvl = ["", "Lvl. 1", "Lvl. 2", "Lvl. 3", "Lvl. 4",
"Lvl. 5", "Lvl. 6", "Lvl. 7", "\u2605 MAX!"];
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
return this.drawText(this._actor.Current_Skill_Exp(skill), x, y, width, "right");
};
//======================================================================//
})();
Quick addendums: I'm currently using the skill cost spot to show me the skill experience, and I know you can integrate functions into already existing code, so I do plan on cleaning up the Game_Action.prototype.apply function.