- Joined
- Apr 1, 2022
- Messages
- 5
- Reaction score
- 2
- First Language
- English
- Primarily Uses
- RMMV
I wanted to make a skill that damages the opponent. and then has a chance to give the user a status effect. How do you do that?
<Post-Damage Eval>
if (Math.random()<.83)
user.addState(X);
</Post-Damage Eval>
Thank you. I just tested it and it worked. Literally was looking at your posts for advice before you messaged me.It is possible to do this in the damage formula. However, if your game ever uses the autobattle Trait or if this skill can go on an enemy, you shouldn't do it that way. For information on that, see:
Damage Formulas 101
Please note: A discussion has already been started about different things you can do with these formulas so please direct those comments and question to the appropriate thread. https://forums.rpgmakerweb.com/index.php?threads/rmmv-damage-formula-ideas-and-help.47099/ A link to the list of...forums.rpgmakerweb.com
The better way to implement this is with Yanfly's Skill Core. Give the skill the notetag:
Code:<Post-Damage Eval> if (Math.random()<.83) user.addState(X); </Post-Damage Eval>
where X is the ID of your state (no leading zeros), and you supply whatever number you want on the line above. So this one has an 83% chance.