# multiple discrete instances of elemental damage in a damage formula?

#### jonthefox

##### Veteran
Wondering if it's possible to do something like this with the damage formula:

10 (fire) damage + 20 (ice) damage + 30 (physical) damage.

If the target has no elemental resistances to anything, the target would receive 60 damage.

If the target has 100% ice resistance, the target would receive 40 damage ( 10 fire + 30 physical).

If the target has 50% ice resistance, the target would receive 50 damage (10 fire + 10 ice (halved) + 30 physical).

Basically, the damage formula would contain different damage totals that individually factored in a target's elemental resistance. Could this be done, and if so how?

#### Andar

##### Veteran
not by default, you'll need a plugin to change the engine behaviour.

theoretically this is possible to do with the damage formula alone, but that would get extremely complex and error-prone.

the first problem is that the engine by default multiplies the result of the damage formula with the elemental damage rate of the set element. You would have to divide by that to prevent a doubled effect.
it is better if a plugin removes that part in favor of other handling if you want to do this.

the second problem is that the code needed to get the damage rates for elements into the damage formula is not short, and having it done multiple times would make the formula difficult to read.
So the second function of that hypothetical plugin should be to provide a shortcut-function to write that into the damage formula.

I don't know of a plugin that does this, but should be easy to do if you request one.

#### Oddball

##### Veteran
The easiest way to do this in the engine alone (albiet, in a bit of a clunky way) is to make new elements that are hybrid elements

#### Another Fen

##### Veteran
You should be able to include elemental resistances in the damage formula.
I'm not sure if MZ changed anything here, but in MV you could use
b.elementRate(12)
for the targets elemental resistance (to element 12). Of course the end result of the damage formula would still be modified through the actual element of that skill if you chose one.

So something like this could maybe work:
10 * b.elementRate(2) + 20 * b.elementRate(3) + 30 * b.elementRate(1)

Edit: So yeah, what Andar has already suggested

### Latest Profile Posts

I ended up needing to do a chapter one world map remake. It's still WIP but coming along nicely. =D
Stream will be live shortly! I will be beginning a play-through of Resident Evil 4! Feel free to drop by!

1st iteration on castle interior in Tiled.
I've started up Pillars of Eternity. It's interesting how the game does a "select choice" cutscene using still image art for dramatic flair. I wonder if that might work for my RPGMaker project.
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.