Replace this functionHow would I reference the variables for a reseted skill? I'm not a super advanced javascript user![]()
SkillTreesSystem.resetSkillTree = function(actor, tree) {
let points = 0;
for (let skill of tree.skills) {
if (!skill || skill.type !== "skill" || skill.level === 0)
continue;
for (let i = 0; i < skill.level; i++) {
for (let req of skill.reqs[i]) {
if (req.type === "points")
points += req.price;
}
if (!skill.learnActions || !skill.learnActions[i])
continue;
for (let learnAction of skill.learnActions[i]) {
if (learnAction.type === "game_variable") {
let oldVal = $gameVariables.value(learnAction.varId);
$gameVariables.setValue(learnAction.varId, oldVal - learnAction.inc)
}
}
}
skill.forget(actor);
skill.level = 0;
}
tree.points = 0;
actor.refresh();
return points;
};
Skills_Window.prototype.maxCols = function() {
return SkillTreesSystem.skillWindowMaxCols;
};
Skills_Window.prototype.maxCols = function() {
if (this._tree != null && this._tree.symbol == `SymbolOfYourSpecificTree`) {
return 11;
}
return SkillTreesSystem.skillWindowMaxCols;
};
Skills_Window.prototype.windowWidth = function() {
return this.itemWidth() * SkillTreesSystem.skillWindowDrawCols + this.standardPadding() * 2;
};
Skills_Window.prototype.windowWidth = function() {
if (this._tree != null && this._tree.symbol == `SymbolOfYourSpecificTree`) {
this.itemWidth() * 11 + this.standardPadding() * 2;
}
return this.itemWidth() * SkillTreesSystem.skillWindowDrawCols + this.standardPadding() * 2;
};
Use plugin SRD_MenuBackground@SomeFire Is there a way to add a custom background image for the skill trees? Thx.
class TreePointsRequirement extends Requirement {
constructor(points) {
if (!points)
points = 1;
else if (points < 1)
throw new RangeError("Points must be an integer greater than 0.");
super("tree_points");
this.points = points;
}
meets(actor, tree) {
return tree.points >= this.points;
}
text() {
return this.points + " points in " + tree.symbol;
}
}
tree.symbol
isn't defined. I just don't know what to put in order to reference the name/symbol of the current skill tree in question.class TreePointsRequirement extends Requirement {
constructor(points) {
if (!points)
points = 1;
else if (points < 1)
throw new RangeError("Points must be an integer greater than 0.");
super("tree_points");
this.points = points;
}
meets(actor, tree) {
this.treeSymbol = tree.symbol;
return tree.points >= this.points;
}
text() {
return this.points + " points in " + this.treeSymbol;
}
}
Find this function in SkillTreesSystem.json and add condition to continue without drawing line.I found a solution!!
JavaScript:class TreePointsRequirement extends Requirement { constructor(points) { if (!points) points = 1; else if (points < 1) throw new RangeError("Points must be an integer greater than 0."); super("tree_points"); this.points = points; } meets(actor, tree) { this.treeSymbol = tree.symbol; return tree.points >= this.points; } text() { return this.points + " points in " + this.treeSymbol; } }
Edit: But I have another issue. I want to get rid of the text that shows up stating how many points a skill costs. Since all the nodes in my skill trees always cost 1 point, it seems redundant/superfluous to have that line there. Here's what I'm talking about (the "1 Skill Point" text):
View attachment 217940
Edit2: I was able to remove the text, but the space where the text was remains...help!
View attachment 217942
Description_Window.prototype.drawRequirements = function(reqs, y) {
for (let i = 0; i < reqs.length; i++) {
let req = reqs[i];
if (req.text() == null)
continue;
if (req.meets(this._actor, this._tree))
this.changeTextColor(this.powerUpColor());
else
this.changeTextColor(this.powerDownColor());
this.drawText(req.text(), 0, y);
y += this.lineHeight();
}
this.changeTextColor(this.normalColor());
};
Check demo and see SkillTreesConfig.js. There is "guard2" skill, which increment game variable when learned.Hi,It's me again. How could I make some variables related with the learned skillpoints or get the value when a new skill is learned , so that I can make the damage increasing while a skill is learned.thanks~
guard2 = skill('guard2', [2], [
[cost(1), switchReq(1)], // Requires switch 1 to be true.
], [
[changeVar(1, 2)] // On learn action, which increase the game variable 1 by 2.
]);
cool! I get it ! Thanks very much!Check demo and see SkillTreesConfig.js. There is "guard2" skill, which increment game variable when learned.
Code:guard2 = skill('guard2', [2], [ [cost(1), switchReq(1)], // Requires switch 1 to be true. ], [ [changeVar(1, 2)] // On learn action, which increase the game variable 1 by 2. ]);
Sorry>.<I'm not sure that I correctly understand what do you want. Skillpoints can't be learned, they are "money" for skills.
actor.skillTrees.getTree('tree_symbol').points
actor
is Game_Actor object, and 'tree_symbol'
is tree identificator. This code can be used in scripts only. Not sure about formulas.