RMMV Money-based hit rate skill?

Good evening! This is my first time making a post / thread on here so forgive me if I get anything wrong with
terminology.

I'm attempting to create a skill that uses the party's Gold as a means of attack. When the user attacks using the skill, which will be referred to as "Pocket Change," the game checks to see if the party has 30 or more Gold. If so, the attack goes through and you lose that 30 Gold; if not, then the attack fails and you keep what Gold you have.

- At least, that's what should happen. If I have more than 30 G then the attack works as normal, but if I have less than 30 G then the attack still goes through? I'm not sure what I'm doing wrong. I have the Skill use the Effect of a Common Event which has the script shown below. (Also I set the Skill to use the Physical Attack modifier of the character)

Any ideas on how to get this to work?


1658372110870.png
Let me see if I understand it well.

The attack skill you want to use always consume 30 G? Or it's powers depends of how much money you have? (something like Setzer's special skill, from Final Fantasy VI)

It's important to have your skill idea very clear, so we can implement the programing logic the right way from scratch.
Let me see if I understand it well.

The attack skill you want to use always consume 30 G? Or it's powers depends of how much money you have? (something like Setzer's special skill, from Final Fantasy VI)

It's important to have your skill idea very clear, so we can implement the programing logic the right way from scratch.
It's always 30 G 😀
@Corealys , In this case, you can have two skills. One is to do the check in the Common Event (if 30G { do this} else { ... ), the other one is the actual skill that will deal damage (and it will be called if the conditions are met).

You can use the event command "Force Action" for this, or, since you seem to have knowledge with javascript, call this second skill through the script itself, but you need to put it in the "upper part" of the Conditional Branch. 😉
@Corealys , In this case, you can have two skills. One is to do the check in the Common Event (if 30G { do this} else { ... ), the other one is the actual skill that will deal damage (and it will be called if the conditions are met).

You can use the event command "Force Action" for this, or, since you seem to have knowledge with javascript, call this second skill through the script itself, but you need to put it in the "upper part" of the Conditional Branch. 😉
Oh my goodness, thank you so much! I've been struggling with this for nearly a month XD

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-money-based-hit-rate-skill.149668/