Store damage into a variable

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,317
Reaction score
818
First Language
English
Hello, so I'm trying to figure out how I could store all the damage from an attack done into a variable.

This is what I'm trying to do:

Character X has an attack that deals damage to all enemies, and then heals the whole party for a portion of that damage done.

I know of a few workarounds with calling common events and storing character stats to decide on damage/healing, but that only really works for me if there is just one enemy.

Any ideas or solutions to this?

Thank you for your help!

EDIT: While I'm at it, anyone know how to give a damage formula an "if/else statement" for...

Heal: Restores X amount of HP, but if Heal crits, it adds Y state to target?
 
Last edited by a moderator:

Shake0615

Reanimator
Veteran
Joined
Nov 3, 2012
Messages
118
Reaction score
65
First Language
English
Primarily Uses
RMMV
Yanfly's Damage Core and Critical Control plugins give you the ability to add code directly into a skill's notebox. However, I don't know anything about JavaScript so I can't tell you how to do the actual coding. In theory though that plugin should do what you need it to.
 
Last edited by a moderator:

Mirai Ko

Veteran
Veteran
Joined
Oct 16, 2012
Messages
64
Reaction score
15
First Language
English
 Thinking about it (and spending alot of time fighting with Variables in Damage Formulas) I think there might be a way to do it.

For simplicity, let's say the damage formula to all enemies is a.atk - b.def, and the Variable you want to store the total damage in is 7.

x = a.atk - b.def; y = v[7]; y += x; v[7] = y; x
 In theory, since the damage formula is run for each enemy, variable 7 should get increased each time by the damage result of each hit.

After which you'd have to call a common event that force actions the same actor to use a skill with

x = v[7] * 0.5; x
To do 50% of the damage dealt or whatever ratio you want.
 

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,317
Reaction score
818
First Language
English
@Mirai: I'm going to try that out and let you know if it works :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,015
Members
137,563
Latest member
MinyakaAeon
Top