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
1,660
Reaction score
1,111
First Language
EN
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
◆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

lunarrosecrow wrote on hiddenone's profile.
please don't lurk hiddenone I'm quarantining!!!
lunarrosecrow wrote on Edward.T's profile.
Hello Edward sorry to bother you and didn't start a conversation cause I thought i'd be a little weird or disrespectful but I was wondering do you still have your Generator resources you posted as the links on the page are dead?
Stream will be live shortly! It is my birthday, and thus I am doing an extended stream! I will be doing a variety of things. Among the activities I will be doing: Playing Oceanhorn: Monster of the Uncharted Seas, art, and some Text Adventure~ Feel free to drop by!
It would be cool if you could "copy as code" event commands :< .
Just managed to recover my Yahoo e-mail that i lost 3 months ago. Turns out an IP from U.S had hacked it and set the pass back to normal.. Like WTF ?

Forum statistics

Threads
99,485
Messages
965,924
Members
131,111
Latest member
HannyBee21
Top