Hi everyone,
I was going to put this in the formulas topic, but because it may not specifically include just formulas in order to solve this problem, I've posted it here.
I'm trying to store the damage dealt from an enemy (as in, the final number that pops up after the target has been hit) in a variable so I can use it in the following way:
1) Skill inflicts (somewhat random) HP damage
2) Said HP damage stored in variable
3) Force the same skill again, variable is multiplied by 2 to inflict twice the amount of damage as it did previously.
4) Force the same skill for a third time, variable is multiplied by 3 to inflict three times the amount of damage as it did previously.
I would like this to be primarily used by enemies, but it would handy to know how to use for actors to (should there even be any difference in the execution).
Note that this is a skill that targets all enemies. The problem I see here is that each target is going to receive a different amount of damage (depending on their defensive stats, etc), and I specifically want them to receive damage in the follow up attacks that references that same number they were hit with in the first place. Is any of this possible?
Thank you!
Storing dealt damage in a variable + specific targets
● ARCHIVED · READ-ONLY
-
-
I found this one, but no idea if it will work,
If it doesn't help or not the way you want (#3 post) than somebody else might have a way. -
With the default MV I don't think this is possible without some js. For the purposes of saving damage values to variables you could probably get away with using Yanfly's Skill Core's post-damage evals. This appears to allow you to use the variable 'value' to access the damage, so a simple:
Code:$gameVariables.setValue(x, value); //replace x with the variable id
Will allow you to store the value for later use. As you're trying to store more than one value though this is a little trickier. So, depending on the number of battlers you can have in battle, reserve that many variables for this skill, ie. 4 battlers = 4 variables (ensure they are sequential). If you want to use the skill on enemies keep in mind that this may require 8 (or more) values to be stored.
With the variables set up the post-damage eval will need to contain something to this effect
Code:var id = x + target.index(); $gameVariables.setValue(id, value);
In this example replace x with the variable id of the first variable you set up to store the damage results. eg. if you're using variable id's 4, 5, 6 and 7 replace x with 4.
This will store the damage each actor receives into a unique variable for later use. To retrieve these values in your damage formula you should be able to use
Code:v[x + b.index()]
Again, replace x with the lowest number variable used for storing damage values (4 in the previous example).