yanfly skill core question

What code can I put in the lunatic mode code blocks on a skill note tag?

I'm trying to have a game Variable be altered each time the skill is used, but the game doesn't like me using $gameVariables there.

<After Eval>

$gameVariables.value(41) += 1;

</After Eval>

This should illustrate what i want to do, however this doesn't work.

What would be the correct way of coding this?

__________________________________________________________________________________________________

Edit: Figured it out.

I looked through the documentation and found that the gameVariables object has a setValue function.

Correct code:

<After Eval>

$gameVariables.setValue(41, $gameVariables.value(41) + 1);

</After Eval>

__________________________________________________________________________________________________

Edit 2:

Ok, at this point, I'm trying to get the weapon type through this code. As far as I can tell, items, armours and weapons are all "items". That is, they are defined by the item class. I cannot find any part that would store this information. Is there a sub-class for weapons somewhere?

pseudo (as in it doesn't actually work) code

<After Eval>

$gameVariables.setValue(20+user.actorId()*20+(7+user.weapons.weaponType()), $gameVariables.value(20+user.actorId()*20+user.weapons.weaponType()) + 1);

</After Eval>

I'm trying to make a weapon exp system where the more a character uses a weapon type, the better they get with that weapon type. 

This code starts with 20 as the first two variable arrays are used for other things, adds the actor id times 20 as each actor gets their array, and then adds the weapon type increase the corresponding variable (plus 7 because the first 7 variables are used for other things).
__________________________________________________________________________________________________

Edit 2:

Ok, at this point, I'm trying to get the weapon type through this code. As far as I can tell, items, armours and weapons are all "items". That is, they are defined by the item class. I cannot find any part that would store this information. Is there a sub-class for weapons somewhere?

pseudo (as in it doesn't actually work) code

<After Eval>

$gameVariables.setValue(20+user.actorId()*20+(7+user.weapons.weaponType()), $gameVariables.value(20+user.actorId()*20+user.weapons.weaponType()) + 1);

</After Eval>

I'm trying to make a weapon exp system where the more a character uses a weapon type, the better they get with that weapon type. 

This code starts with 20 as the first two variable arrays are used for other things, adds the actor id times 20 as each actor gets their array, and then adds the weapon type increase the corresponding variable (plus 7 because the first 7 variables are used for other things).
user.weapons();returns an array.

To get the wtypeId you could write something like this:

Code:
var weaponTypeId = user.weapons()[0].wtypeId;
Thank you very much, that is what I was looking for. I didn't know the syntax for arrays here, I was trying stuff like weapons[0] and weapons(0). Where in the documentation is that wtypeId found? I couldn't find it anywhere.

The documentation is the js files just outside of the plugin directory, or the cleaned up, easy to read version found here: http://forums.rpgmakerweb.com/index.php?/topic/47361-rmmv-split-source-files-for-plugin-development/
Thank you very much, that is what I was looking for. I didn't know the syntax for arrays here, I was trying stuff like weapons[0] and weapons(0). Where in the documentation is that wtypeId found? I couldn't find it anywhere.

The documentation is the js files just outside of the plugin directory, or the cleaned up, easy to read version found here: http://forums.rpgmakerweb.com/index.php?/topic/47361-rmmv-split-source-files-for-plugin-development/
The syntax for arrays is the same as in most other languages.

actor.weapons();is not an array but a function that returns one. 😉

wtypeId is no property or function from inside the source code.

It comes from the Weapons.json file.

But I found it through that function in Game_Actor.js from the split source files.

Code:
Game_Actor.prototype.isWtypeEquipped = function(wtypeId) {    return this.weapons().some(function(weapon) {        return weapon.wtypeId === wtypeId;    });};

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-skill-core-question.53136/