gambitben

Veteran
Veteran
Joined
Jun 8, 2013
Messages
181
Reaction score
148
First Language
Spanish English
Primarily Uses
RMMV
How would I reference the variables for a reseted skill? I'm not a super advanced javascript user :rswt
 

SomeFire

Veteran
Veteran
Joined
May 27, 2016
Messages
132
Reaction score
142
First Language
Russian
Primarily Uses
How would I reference the variables for a reseted skill? I'm not a super advanced javascript user :rswt
Replace this function
Code:
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;
};
 
Last edited:

gambitben

Veteran
Veteran
Joined
Jun 8, 2013
Messages
181
Reaction score
148
First Language
Spanish English
Primarily Uses
RMMV
Works like a charm, thank you! If I could like this post five times I would ;D
 
Last edited:

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,231
First Language
English
Primarily Uses
RMMV
Hey @SomeFire, is it possible for one tree to be wider than another tree? Like if an actor has 3 trees, but I want 1 of those trees to have/show more skills in the row. In referring to this parameter:
1639039477086.png
I basically need the 1st tree to show 11 skills in a row instead of 7.
 

SomeFire

Veteran
Veteran
Joined
May 27, 2016
Messages
132
Reaction score
142
First Language
Russian
Primarily Uses
It requires some coding. You need to replace usages of SkillTreesSystem.skillWindowMaxCols and SkillTreesSystem.skillWindowDrawCols by condition with your tree. For example:
Code:
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;
};
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,231
First Language
English
Primarily Uses
RMMV
@SomeFire Is there a way to add a custom background image for the skill trees? Thx.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,231
First Language
English
Primarily Uses
RMMV
Cool, but can it be a different image for each tree? For example, I only want to add a background to the section highlighted in red and I'd need it to be a different image for each tree. Thx

1643482812539.png
 

raffle

Veteran
Veteran
Joined
Oct 25, 2020
Messages
103
Reaction score
39
First Language
English
Primarily Uses
RMMV
You can always try reducing the transparency of only that small window either manually or using something like SumRndmDde's Super Tools Engine, and then doing a show image command with the background you want right before the script call to open the skill tree scene, then an erase image command right after the script call
 

StarMaker

Villager
Member
Joined
Sep 14, 2021
Messages
11
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
Hi. Can someone provide more specific instructions? I am constantly getting different errors. In this case, I can completely change the skill and everything works, another time just change its name and catch the error. Maybe it's because of my low skills, but this plugin seems simple.
 

vorfeed

Villager
Member
Joined
Sep 14, 2021
Messages
7
Reaction score
2
First Language
Chinese
Primarily Uses
RMMV
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.:LZSsmile:thanks~
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,231
First Language
English
Primarily Uses
RMMV
So I'm trying to change the text shown for the skill requirements section near the bottom of the skill description window. I want it to say "x points spent in [name of tree]" instead. I know this is the code block to edit:
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) {
        return tree.points >= this.points;
    }

    text() {
        return this.points + " points in " + tree.symbol;
    }
}

But I'm getting an error cuz the "tree" in 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.
1645916311476.png
 
Last edited:

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,231
First Language
English
Primarily Uses
RMMV
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):

1646183770350.png

Edit2: I was able to remove the text, but the space where the text was remains...help!
1646184586386.png
 
Last edited:

SomeFire

Veteran
Veteran
Joined
May 27, 2016
Messages
132
Reaction score
142
First Language
Russian
Primarily Uses
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
Find this function in SkillTreesSystem.json and add condition to continue without drawing line.
Code:
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());
};
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.:LZSsmile:thanks~
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.
]);
 
Last edited:

vorfeed

Villager
Member
Joined
Sep 14, 2021
Messages
7
Reaction score
2
First Language
Chinese
Primarily Uses
RMMV
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.
]);
cool! I get it ! Thanks very much!
And How can I get the different Actor's learned skillpoints?
 
Last edited:

SomeFire

Veteran
Veteran
Joined
May 27, 2016
Messages
132
Reaction score
142
First Language
Russian
Primarily Uses
I'm not sure that I correctly understand what do you want. Skillpoints can't be learned, they are "money" for skills.
 

vorfeed

Villager
Member
Joined
Sep 14, 2021
Messages
7
Reaction score
2
First Language
Chinese
Primarily Uses
RMMV
I'm not sure that I correctly understand what do you want. Skillpoints can't be learned, they are "money" for skills.
Sorry>.<
I want to get one character's used skillpoints in a skilltree. Actually It is the value that has displayed,but i'm poor in the codes. I want to make a variable equal to the character's learnedskills points in a skilltree, or I could say that I want to get the value of “money” for the learned skills. *.*:LZSproud:
 

SomeFire

Veteran
Veteran
Joined
May 27, 2016
Messages
132
Reaction score
142
First Language
Russian
Primarily Uses
Code:
actor.skillTrees.getTree('tree_symbol').points
Where actor is Game_Actor object, and 'tree_symbol' is tree identificator. This code can be used in scripts only. Not sure about formulas.
 

SifDoge

Veteran
Veteran
Joined
Jun 30, 2014
Messages
37
Reaction score
15
First Language
English
Primarily Uses
RMMV
Hi @SomeFire, is there any script call or command to show skill tress for a specific actor that is not at the party? something like this script SceneManager.push(Scene_SkillTrees) but for a specific actor.
 

Iiiik

Warper
Member
Joined
Dec 26, 2017
Messages
1
Reaction score
0
First Language
French
Primarily Uses
RMMV
Holà,

I've been looking through both the code of this plugin via VisualCode and the GitHub tutorial for hours on end but I just don't get it at all. I've got basically no experience with actual coding, so that really doesn't help there.

So here's my main issue:
I planned on each character in my game having a core "character tree" with exclusive skills, and then a bunch of more generic trees (Like supporting/defensive/aggressive ones) that are global to all characters, but I can't figure for the life of me how the trees are distributed by default, and how I can change them.
For instance, my third character (By ID order) has basically every single sample tree unlocked but I just can't figure why and where I'm supposed to edit that. Meanwhile my 1st character only has 3?

I'd be very grateful if anyone more experienced could guide me through this a bit,

Thanks in advance!
 

Latest Threads

Latest Profile Posts

I hate it when people instigate fights or conflicts and then use us, the security guards, as shields or as means to resolve their conflicts. Especially since we at times have to be unfair due to our duty of preserving peace.
Fortunately it doesn't happen very often.
The lucky person will get the choco.
Time to continue my game dev journey, for those who want to see how not to use RM. :LZSlol:

This is the second time in less than a week that somebody tells me something doesn't work out of the box, but when I go playtest it... it certainly does!!
I don't have experience with PixelArt, I just made it to have a cool icon for the tool I created, if anyone can give an opinion it would help me a lot:

Option A:

CrystalBall-A-32-24-16.png

Option B:
CrystalBall-B-32-24-16.png

Forum statistics

Threads
128,573
Messages
1,195,553
Members
169,158
Latest member
Merix
Top