Halp: Multiple damage formulae in single skill

So, Fomar0153's Custom Formulae tutorials are a big help here, but...

I seem to have hit a snag; I'm trying to set up a skill similar to a hybrid of D&D's Magic Missile and Prismatic Spray; multiple hits with separate damage calculations, and two random status effects.

Thus far, it seems like the damage calculation formulae and the random status effect formulae (for the record, the random status effect formula is b.add_state(2+rand(6)) with use of the standard database status entries) are skipped until the last entry, which is applied as the only effect.

Setting up the script (following the second tutorial) as follows:

def multiblast(a, 😎

 (1+rand(a.atk))-(1+rand(b.atk))

 (1+rand(a.atk))-(1+rand(b.atk))

 (1+rand(a.atk))-(1+rand(b.atk))

 (1+rand(a.atk))-(1+rand(b.atk))

 b.add_state(2+rand(6))

 b.add_state(2+rand(6))

end

It seems that only the last line is applied, the rest are ignored. Am I missing something important here?
you can use the damage formula for a lot of things and calculations, but the coding requires the damage to be the output of the formula.


Only that output is then applied as damage, all calculations up to that point are ignored.


Your first lines calculate numbers, but those results are nowhere stored and thereby discarded when the next number is calculated.


You need to rewrite that into a structure like


dam = (1+rand(...


dam += (1+...


and then return the dam-value to the formula field
...Dammit.

Thanks; looks like I have a bigger task on my hands as far as working out how that skill (Well, those skills, plural - I have a number of combination skills planned out) must work than I thought.

Time to hack away at the scripts, I guess.

**Addendum**
Well, "repeat" works for multiple damage recalculations, and the States are added if I set the add_state before damage...

Now just to make that added state less than 100% likely to happen...

Admins, if you'd kindly lock this topic? 🙂
damage formula always uses the LAST line as damage

Original thread: https://forums.rpgmakerweb.com/threads/halp-multiple-damage-formulae-in-single-skill.23831/