How do I get the amount of skill points?

Ultra-Maximum

Villager
Member
Joined
Jun 3, 2020
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMV
I have an Item listed as SkillPoint and I am Using a plugin that would let me display the amount of skill points the player has.
However, I don't know to get the number of skill points the player has. The plugin wants me to use javascript and I havent learned it yet. Thanks in Advance.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
:kaohi: I think this is what you're seeking:
JavaScript:
$gameParty.numItems($dataItems[5]);
Just replace 5 with the ID of your Skill Point item. :kaophew:

Since this is in Learning JavaScript...note that with event commands, you can get the inventory count of a given item using Control Variables > Game Data > Item, e.g.
Code:
◆Control Variables:#0001 Count = The number of Potion
◆Text:None, Window, Bottom
:    :You have \v[1] potions!
You might think that's irrelevant here because you need a script. However, the game interprets all event commands as scripted functions! If you open up rpg_objects.js and search for "Control Variables" you'll find yourself looking at something like this:
JavaScript:
// Control Variables
Game_Interpreter.prototype.command122 = function() {
    var value = 0;
    switch (this._params[3]) { // Operand
        case 0: // Constant
            value = this._params[4];
            break;
        case 1: // Variable
            value = $gameVariables.value(this._params[4]);
            break;
        case 2: // Random
            value = this._params[5] - this._params[4] + 1;
            for (var i = this._params[0]; i <= this._params[1]; i++) {
                this.operateVariable(i, this._params[2], this._params[4] + Math.randomInt(value));
            }
            return true;
            break;
        case 3: // Game Data
            value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]);
            break;
        case 4: // Script
            value = eval(this._params[4]);
            break;
    }
    for (var i = this._params[0]; i <= this._params[1]; i++) {
        this.operateVariable(i, this._params[2], value);
    }
    return true;
};

Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) {
    switch (type) {
    case 0:  // Item
        return $gameParty.numItems($dataItems[param1]);
// ~ snip ~ //
Here we can see that the "Game Data" branch of command122 leads to gameDataOperand, the first branch of which is for item count. And there's the script call you were after! :kaopride:

(Not all commands convert so easily to script, but in most cases it's worth checking out~)
 

Ultra-Maximum

Villager
Member
Joined
Jun 3, 2020
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMV
:kaohi: I think this is what you're seeking:
JavaScript:
$gameParty.numItems($dataItems[5]);
Just replace 5 with the ID of your Skill Point item. :kaophew:

Since this is in Learning JavaScript...note that with event commands, you can get the inventory count of a given item using Control Variables > Game Data > Item, e.g.
Code:
◆Control Variables:#0001 Count = The number of Potion[/INDENT]
[INDENT]◆Text:None, Window, Bottom[/INDENT]
[INDENT]:    :You have \v[1] potions!
You might think that's irrelevant here because you need a script. However, the game interprets all event commands as scripted functions!
That is Exactly what I needed thanks!!! also thanks for the bonus tip, I didn't know commands got interpreted as scripted functions! Thank you!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top