Can someone help me with damage formula for skill that does more damage to the enemy if the enemy is paralyzed (affected by a state)?
MZ Damage formula with a state condition
Learning Javascriptb.isStateAffected(ID of paralysis state) ? (formula if enemy is paralyzed) : (formula if enemy isn't paralyzed) Just to throw more options out there, in case you don't want to have to put two separate formulas:
Code:
(base formula) + (b.isStateAffected(ID) | 0) * (bonus damage amount)
both work perfectly, thanks a lot!
Just so you know, in case you want to do other interesting things with damage, there is a thread in the tutorial forum that has a lot of info (in fact, your exact question is addressed in the very first post):
forums.rpgmakerweb.com
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
thats awesome! I'm excited to read and apply it to my game. Thankyou!!
I do feel that it's important to point out that you should be somewhat careful with that thread. Some of the information on there is great, but some of it can be very bad (depending on your particular game setup).
In short, your damage formulas should avoid using functions that cause some type of effect. For example, don't add buffs or debuffs through your damage formula. Just keep it strictly for calculating damage, and apply your effects through the actual "Effects" section instead.
The reason is because the auto battle AI has to evaluate the damage formula for each of your skills, in order to figure out which skill it wants to use. So if you've got your damage formulas adding buffs and debuffs and doing all kinds of crazy stuff, all of those things are actually going to get applied while the autobattle AI is trying to figure out which skill to use.
If you're 100% certain that you wont' have any type of auto battle occurring in your game, it's technically alright to do those things in your damage formulas, but it's still a bad practice.
Actually I use Visustella plugin Battle Core and it contain Auto-Battle.
Now, if I'm using function like I'm asking above, it will break only the auto battle system? or just don't add buff and debuff?
also I found the js version :
if (b.isStateAffected(statesid)) (formula); else if (b.isStateAffected(statesid)) (formula); else (baseformula);
better to use the js version or just dont use all of it if my game using auto battle? if do not use all of it, any suggestion to make skill unique for the game?
Checking for the presence of a state in the formula is fine; Arthran was saying to avoid using things like addBuff, addState etc. if you're using autobattle in your game.
The formula you're asking about above is fine, because it doesn't cause any changes in the game. It just retrieves information, and then uses that information to calculate a damage number, which is exactly what the damage formula is meant to do.
You can use any functions you want, as long as all they're doing is retrieving some type of information. So
So a few examples of things that are fine:
You can use any functions you want, as long as all they're doing is retrieving some type of information. So
isStateAffected(stateId) is perfectly fine--it simply retrieves information, without causing any change to occur. But addState(stateId) is *not* fine, because it *does* cause an actual change to happen. So you can check for a state, and do more damage damage if the person has that state... But don't actually add/remove a state from the damage formula.So a few examples of things that are fine:
- Check if the target has a buff/debuff
- Check if the user is wearing a certain item
- Check the user's level
- Check how much HP the user has
- Add or remove a buff/debuff to the target
- Remove the user's item
- Change the user's level
- Change the user's HP
Everything you've been given in this thread is JavaScript. The above is just a more complicated way of writing out what AphoticAmaranth said in the first reply (again, this is explained in the first post of the 101 thread I linked you to).
Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-with-a-state-condition.144683/