Hi, so I'm making a skill in my game that has a 30% chance to consume 0 MP when a particular state is active, but I've been running into some errors with the Skill Cost not appearing or appearing wrong when it's applied. The Skill Cost shows up perfectly fine when the state isn't applied, but when it is applied, sometimes it just won't show up altogether, or it'll show up as 0 MP, which I don't the player knowing for obvious reasons. Also, it'll allow the use of the skill even though the user doesn't have sufficient MP, which I also don't want.
What I want the skill to do is, if the state is applied, the user has a chance to consume 0 MP when using the skill, but they still will require the needed MP to actually perform the skill. Also, the player shouldn't be able to see if the skill will consume 0 MP beforehand since that completely defeats the purpose of the "chance" mechanic if the player knows if it'll consume 0 MP or not.
Could I get some help? Here's the code! And I'll also add some screenshots to give you an example.
What I want the skill to do is, if the state is applied, the user has a chance to consume 0 MP when using the skill, but they still will require the needed MP to actually perform the skill. Also, the player shouldn't be able to see if the skill will consume 0 MP beforehand since that completely defeats the purpose of the "chance" mechanic if the player knows if it'll consume 0 MP or not.
Could I get some help? Here's the code! And I'll also add some screenshots to give you an example.
Code:
<Custom MP Cost>
if(user.isStateAffected(106) && Math.random() < 0.3)
{
cost=0;
} else
cost=1;
</Custom MP Cost>