MZ Random int not working

Hello, I'm trying to make a skill gain a small variable amount of TP with a bit of randomness but for some reason it just won't work, and perhaps there is a better way to do it. I am very new to developing on MZ 🙂
Here's a screenshot of the Skill's settings:
1758329763941.png


Here is the code I am using:
Code:
<JS On Action End>
  const tp = 15 + Math.randomInt(21);
  user.gainTp(tp);
</JS On Action End>

I'm using the Visustella core systems and the OTB turn based battle system. Any help is appreciated. 🙂
it just won't work
Could you elaborate? What is the TP before and after the skill?

What plugin is the note tag<js on action end> from?
Could you elaborate? What is the TP before and after the skill?
Sorry, it started at 0 and ended at 0 when the skill finished. It's supposed gain TP, no? Am I doing it completely wrong lol
So what plugin is the note tag from? Can’t find it in OTB wiki.
It's from the Battle Core plugin I thought originally... then I looked and realized I looked and realized it should probably be:

Code:
<JS Post-End Turn>
  const tp = 15 + Math.randomInt(21);
  user.gainTp(tp);
</JS Post-End Turn>

BUT after testing it I still does not add TP.
I'm not opposed to alternatives to adding TP, but I am set on making a good way to give a small variance of TP. Kinda the whole thing of the game I wanna make lol
1758343684679.png

I don’t think that note tag is supposed to work on skills. What exactly do you want to do? Try to describe the desired effects of the skill.
Huh I didn't register that it didn't go on skill tags. I feel silly.

At the end stage I'd like it so that when the user activates the skill, they gain TP. The tp should be randomly gained in a small variance depending on skill. Like in my original skill example the range was supposed to be from 15-25(ish). Then once I got that working the level of TP gain would be increased depending on a State, which could in this example raise the TP level from 25-35 instead of the previous range.

An example could be like:
If user has no State1 then tp gain random(15-25), Add State1.
If user has State1, then tp gain random(25-35), Remove State1, Add State 2.
If user has State2, then tp gain random(25-35), Remove State2, Add State3.
If user has State3, then tp gain random(45-55). //Maximum TP range state.

But like I said I only wanted to try and make the random gain TP part work first before moving onto adding and removing states.

Hope this is all makes sense :/

Original thread: https://forums.rpgmakerweb.com/threads/random-int-not-working.180170/