AsianBorn

Warper
Member
Joined
Aug 20, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
N/A
I am unsure if this is the correct place to post this enquiry, sorry if its not.

I want skills to be able to deal both attack damage and magic attack damage rather than just one or the other, however I do not know how to implement this properly.

How would I combine these - (a.atk * x - b.def * x) as well (a.mat * x - b.mdf * x) but not have the overall damage lowered if one of the defense values is greater than the corresponding attack values.

Example - (a.atk * 1 - b.def * 1) + (a.mat * 1 - b.mdf * 1)
if my actor had 50 attack and 50 magic attack but the target had 20 defense and 80 magic defense, then the actor would deal 0 damage to the target because of the excess magic defense. How would I make it so that this example formula would deal the 30 attack damage that it logically should no matter how high the magic defense is.

Would very much appreciate any assistance thank you :)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,705
Reaction score
2,807
First Language
English
Primarily Uses
RMMZ
Use Math.max to avoid negative contributions to the calculation.

Math.max(a.atk * x - b.def * x, 0) + Math.max(a.mat * x - b.mdf * x, 0)
 

AsianBorn

Warper
Member
Joined
Aug 20, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
N/A
Use Math.max to avoid negative contributions to the calculation.

Math.max(a.atk * x - b.def * x, 0) + Math.max(a.mat * x - b.mdf * x, 0)
I had no idea this was a thing, thank you, I appreciate the reply :)
 

Latest Threads

Latest Posts

Latest Profile Posts

In the past hour I've both joined and left the RPG Maker subreddit. So many memories were made. Power to the gam mak!
So the number one complaint I get so far is the levels are simply too large. What's funny is in testing I deemed levels taking too long and actually shortened them. Figuring I could beat them in 5-6 minutes so players would be able to do so in probably double that. I was apparently very mistaken, only one player has mentioned even reaching the second area. Let alone the first boss. :kaoswt:
I don't believe it. I actually did some proofreading in my game - and fixed some grammar errors! I feel so accomplished, knowing I can actually proofread my own writing!
...I've had a bad day, okay? Bad enough for me to want to proofread stuff. :yswt2:
Ughhh, July is not my month. Thankfully, it's nearly done.
mercba30 wrote on Jesse - PVGames's profile.
How do I get the new version of the character creator? Thank you in advance!

I fixed the lips and noses for MZ! The files have been updated.
qQwgk8C.png

Everything below!

Forum statistics

Threads
113,674
Messages
1,076,587
Members
147,695
Latest member
GirlintheToilet
Top