MV Make LimitedUse quantity change in an Event?

Hey all,

So I'm using Yanfly's Limited Use Skills plugin to simulate the ammo function of my guns. I'm working on a common event that will allow players to reload (add limited use charges) in the field on a button press. Making the button use the actual skill seemed to be a dead end, so I've been trying to fake it.

1650994671344.png

So far, all the "if" statements work in making the event work like the skill. And the "change gold" also works in taking the correct amount of ammo.

The problem is that script call. As you can see, I'm just randomly guessing. I've tried a few things, but it's not worth mentioning because I'm pretty sure I'm just flubbing some obvious way to do this and I don't know the correct syntax. I always have such a hard time with changing a value when it's an object I'm unfamiliar with. Which is funny to me because I got the "if" statement above it to work.

What am I missing here?

PS: here's the full if statement:
$gameActors.actor(1).skillLimitedUseCurrent(18) < $gameActors.actor(1).skillLimitedUseMax(18)
Yeah, that entire script box you have in the middle is wrong. In it, you're trying to redefine a prototype of a function for some reason (and you're using the wrong syntax to do that 😛 )

That command should just be:
Code:
$gameActors.actor(1).setSkillLimitedUse(18, X);
where X is the max number of uses.

You could replace X with $gameActors.actor(1).skillLimitedUseMax(18) but I figure there's probably no point in calling another function when you know what you want the max ammo to be.
Yeah, that entire script box you have in the middle is wrong. In it, you're trying to redefine a prototype of a function for some reason (and you're using the wrong syntax to do that 😛 )

Yeah, I knew that one looked bad :hswt: I even contemplated digging up some of the earlier things I tried so I wouldn't look so foolish. But what the hell. A free glimpse into a man's manic flailings at trying to code, haha.

For some reason this command is zero'ing out the limited uses instead of increasing it (I set it to 3). But it definitely is able to change the uses, so it's a start!

EDIT: An epiphany hit me. This command is USING the charges. I set it to a negative number and now it works! Thanks, @ATT_Turan !

Original thread: https://forums.rpgmakerweb.com/threads/make-limiteduse-quantity-change-in-an-event.147106/