Hello good people, I'm stuck on this one. Since my game has multiple attacks, I would like for 1 event to detect how much dmg enemy took.
Let's say for example we have fireball spell
Fireball
Dmg=4
TotalDmg=0
EnemyMaxHP=10
EnemyCurrentHP=10
My issue is that I would like a stat that shows total dmg dealt by fireball but not including dmg beyond 0. So if it takes 3 fireballs to kill 10 hp enemy, I would like only 10 hp added to the totaldmg stat instead of 3 x Fireball dmg = 12.
I've tried below:
While EnemyHp<MaxHp
EnemyCurrentHP=EnemyMaxHP-EnemyCurrentHP
EnemyMaxHP=EnemyCurrentHP // so I can stop the loop.
But this one ends up going in negative, so it deals dmg like: 4,4,-2
Is there any way to stop it calculating beyond 0?
Any help would be greatly appreciated.