ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
407
Reaction score
333
First Language
English
Primarily Uses
RMMV
I think I may not have properly explained what the goal was, but I may have gotten the answer I needed.

If the attack hits, it's supposed to deal damage, then apply a debuff to evasion. However, I didn't think to use a state to lower evasion, which would make doing this a bit easier (unless I'm wrong, but I'm open to learning). I'm gonna try going with applying a state that changes the evasion rate of the affected enemy.
I actually misspoke when I said the state would be added to the target and then the damage would be calculated.

If you check out the flow chart above, you'll see how each step is processed and when. States are added/removed after the damage is done, but must be processed before the actual damage calculation.

The above code:
b.addState(369); 200 + a.mat * 2 - b.mdf * 2
should work, just replace 369 with the ID of your evasion reducing state.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
I actually misspoke when I said the state would be added to the target and then the damage would be calculated.

If you check out the flow chart above, you'll see how each step is processed and when. States are added/removed after the damage is done, but must be processed before the actual damage calculation.

The above code:
b.addState(369); 200 + a.mat * 2 - b.mdf * 2
should work, just replace 369 with the ID of your evasion reducing state.
Yeah I used the code you provided and it works fine. Is there a way to add to it further, like including a state with a percentage chance to be applied?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,117
Reaction score
3,367
First Language
English
Primarily Uses
RMMZ
Yeah I used the code you provided and it works fine. Is there a way to add to it further, like including a state with a percentage chance to be applied?
If you wanted to do that, you could include a check against a random number. For example say you wanted a 15% chance of applying the state:

JavaScript:
if (Math.randomInt(100) >= 85) b.addState(369); 200 + a.mat * 2 - b.mdf * 2

One thing to note about this method which people tend to not know/forget (and Yanfly wrote an article about it a long time ago) is that if you use Autobattle at all in your game, it's better to do it a different way. The reason being when a battler is determining which of their actions to use, they actually evaluate the damage formula to figure out what's best, meaning in this case that their "test" enemies would end up having the state applied even if that action ends up not being used.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
If you wanted to do that, you could include a check against a random number. For example say you wanted a 15% chance of applying the state:

JavaScript:
if (Math.randomInt(100) >= 85) b.addState(369); 200 + a.mat * 2 - b.mdf * 2

One thing to note about this method which people tend to not know/forget (and Yanfly wrote an article about it a long time ago) is that if you use Autobattle at all in your game, it's better to do it a different way. The reason being when a battler is determining which of their actions to use, they actually evaluate the damage formula to figure out what's best, meaning in this case that their "test" enemies would end up having the state applied even if that action ends up not being used.
1638713361034.png

What I currently have going is the skill has two effects to it. A chance to stun, and a guaranteed evasion debuff. The stun effect is in the effects part, but I saw no way to apply an evasion debuff there. That's why I originally came here to figure out how to get my skill to apply an evasion debuff if it succeeds. I was curious if it was possible to include both the guaranteed evasion debuff and a chance to stun in the damage formula. As far as auto-battle goes, I don't know if the game I'm going for will include it, since a lot of the game will be based on choices you make throughout it, so not too concerned about that. I'll give that formula a try though, and see how it works.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
407
Reaction score
333
First Language
English
Primarily Uses
RMMV
You should be able to add both through the effects of the skill.
You can also add additional effects through linking a common event to the usage of the skill.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,117
Reaction score
3,367
First Language
English
Primarily Uses
RMMZ

What I currently have going is the skill has two effects to it. A chance to stun, and a guaranteed evasion debuff. The stun effect is in the effects part, but I saw no way to apply an evasion debuff there. That's why I originally came here to figure out how to get my skill to apply an evasion debuff if it succeeds. I was curious if it was possible to include both the guaranteed evasion debuff and a chance to stun in the damage formula. As far as auto-battle goes, I don't know if the game I'm going for will include it, since a lot of the game will be based on choices you make throughout it, so not too concerned about that. I'll give that formula a try though, and see how it works.
Yeah, debuffs only apply to base parameters. You'll have to add a state that inflicts an evasion reduction.
 

UmbrotheUmbreon

Legendary Umbreon
Veteran
Joined
Jan 25, 2015
Messages
37
Reaction score
3
First Language
English
Primarily Uses
RMMV
I appreciate the help guys. I'm still so new to coding and such. It's quite intimidating but I really wanna learn
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
679
Reaction score
282
First Language
English
Primarily Uses
RMMV
If you wanted to do that, you could include a check against a random number. For example say you wanted a 15% chance of applying the state:

JavaScript:
if (Math.randomInt(100) >= 85) b.addState(369); 200 + a.mat * 2 - b.mdf * 2
I think for readability it's better to reverse that conditional:
JavaScript:
if(Math.randomInt(100) < 15) b.addState(369); 200 + a.mat * 2 - b.mdf * 2
 

mkrudesign

Villager
Member
Joined
Jun 11, 2019
Messages
27
Reaction score
1
First Language
English
Primarily Uses
RMMV
Is there a way to set that the minimum amount of damage for a skill as a percent instead of a fixed amount?

For the standard attack skill, the formula I use is: Math.max(a.atk * 4 - b.def * 2,1) So the minimum this skill can do is 1 damage.

The thing is, it gets pretty dumb when enemies who are meant to be intimidating end up hitting for 1 HP if the player becomes over powered. Is there a formula that I can use to make the minimum damage for this skill be, let's say 5% of the target's total health? It would be way easier than having to rebalance the entire game, since mine is open ended.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,152
Reaction score
1,863
First Language
English
Primarily Uses
RMMV
Is there a way to set that the minimum amount of damage for a skill as a percent instead of a fixed amount?
Just replace the "1" with whatever equation you want. So, mathematically, 5% of your target's total health is b.mhp*.05

Thus, Math.max(a.atk*4-b.def*2, b.mph*.05)
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
675
Reaction score
969
First Language
German
Primarily Uses
RMMV
Is there a formula that I can use to make the minimum damage for this skill be, let's say 5% of the target's total health?

You basically just do the exact thing as before, but replace the "1" with the minimum damage you wish for.

e.g.
Math.max(a.atk * 4 - b.def * 2, b.mhp*0.05)

Now, if you asked me, I wouldn't use a % amount because that could get wonky at some points, but rather a flat amount of the attackers stats.
Something like:
Math.max(a.atk * 4 - b.def * 2, a.atk * 0.5)

Edit: Ninja'd
 

mkrudesign

Villager
Member
Joined
Jun 11, 2019
Messages
27
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thank you! I wasn't sure if it was that easy!
 

mkrudesign

Villager
Member
Joined
Jun 11, 2019
Messages
27
Reaction score
1
First Language
English
Primarily Uses
RMMV
You basically just do the exact thing as before, but replace the "1" with the minimum damage you wish for.

e.g.
Math.max(a.atk * 4 - b.def * 2, b.mhp*0.05)

Now, if you asked me, I wouldn't use a % amount because that could get wonky at some points, but rather a flat amount of the attackers stats.
Something like:
Math.max(a.atk * 4 - b.def * 2, a.atk * 0.5)

Edit: Ninja'd
Could you explain the downside to using a % amount? You mentioned things could get wonky. Is there something I'm missing here?
 

Quack

Villager
Member
Joined
Dec 13, 2015
Messages
21
Reaction score
8
Primarily Uses
Could you explain the downside to using a % amount? You mentioned things could get wonky. Is there something I'm missing here?
I don't think he was objecting to using a percentage amount, but that it was a percentage of the target's hp.
Sometimes bosses have very high hp so you could potentially end up in a situation where 5% of the target is actually more than the normal attack value before being reduced by target's defense.
If you just want to prevent attack value from getting too low, it might be better to set your "minimum" damage value to a percentage of the normal attack value before it is reduced by defense rather than a percentage of the target's hp.
JavaScript:
Math.max(a.ath * 4 - b.def, a.atk * 4 * 0.05)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,152
Reaction score
1,863
First Language
English
Primarily Uses
RMMV
I don't think he was objecting to using a percentage amount, but that it was a percentage of the target's hp.
Sometimes bosses have very high hp so you could potentially end up in a situation where 5% of the target is actually more than the normal attack value
I don't know what ScorchedGround's objection was, but the original post for this formula did indicate it's for an enemy skill, so killing bosses too quickly wouldn't be a concern :wink:
 

Latest Threads

Latest Profile Posts

Just tested latest update (Map transfers, Credits scene etc...) on MV (with RETRO) and everything thing seems to work as intended!
credits.png
Ugh, can't decide what to make next!
The Dystopia
ikW0BYF.png
Recently got RPG Maker MZ. A bit slower with my current PC but I will be getting a new one soon.
evening progress; pretty happy where this is at so i'll take the rest of the night to myself =w=
5NJGyKY.png

Forum statistics

Threads
118,403
Messages
1,115,676
Members
155,343
Latest member
sograyish
Top