# Coding a battle system, help with math operations

#21

mhnnn… that’s what I meant though…
go into the scene file, exit it, go back in at a specific label below.

#22

#23

i think i’ll work with a melee/distance variable for the texts
thank you

#24

If you use fairmath for this, the damage will be different for characters with different fortitude.
For example, let’s take two characters: one has fortitude 80, another has only 10. They receive 4 critical hits from the same enemy with strength 10, so hurt will be str*4 = 40.
For our resilient character with 80, damage would be 32, leaves 48.
Second hit to this already weakened character will be only 19, leaves 29.
The 3rd hit - 11, leaves 18.
The 4th hit - 7, leaves 11.
This at least could be explained: the enemy is tired after previous attack and can deal less damage.
But what about squishy character with 10 fortitude? Logically, they should be dead after the first hit from the same enemy, but, because of how fairmath works, they receive only 4 damage. Then 2, then 1, and one again.
Wouldn’t this cause some logical problems in combat?

#25

I’ll be honest. I outrigt forgot I could do plain math there too… and make a

``````*if fort <0
*set fort 0
*set outcome 10
``````

(I have a list for the outcomes)

#26

Well, that should fix it.
By the way, are you planning to use the same file with this script for every battle?

#27

If it proves itself. The var (except fort) would be resetted after every battle.

#28

This means the reader will see the same non-specific lines like “Enemy attacks you and misses” again and again. Or are you planning to do something about that, too?

#29

Yes. As there’s a limited number of opponents I’ll go with some ifs and vars for the respective fight here.

#30

Understood. Good luck.