PENGU_PUNCHR

Villager
Member
Joined
Jul 13, 2022
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMZ
Hello, I want to add an achievement that's given when 10,000 cumulative damage is outputted by actors. To do this, for every attack that is done by an actor, I need to add the damage that was done in that attack to a "totalDamage" variable. How would I receive the damage value of an attack using scripts?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,784
Reaction score
6,610
First Language
English
Primarily Uses
RMMV
You could do it a complex way with events:
- Make a troop event that runs every turn and saves the current HP of each enemy into a variable
- Have every damage skill call a common event that checks those variables, adds any difference to your achievement-tracking variable, and modifies the HP variable to be current again

Or an easy way with plugins:
- Give every actor the same passive state using VisuStella Skills and States
- In the passive state, put a notetag from VisuStella Battle Core:
Code:
<JS Post-Damage as User>
$gameVariables.setValue(X, $gameVariables.value(X)+value);
</JS Post-Damage as User>
where X is the ID of your achievement-tracking variable. Make sure to initialize it to 0 at the beginning of the game.
 

PENGU_PUNCHR

Villager
Member
Joined
Jul 13, 2022
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMZ
You could do it a complex way with events:
- Make a troop event that runs every turn and saves the current HP of each enemy into a variable
- Have every damage skill call a common event that checks those variables, adds any difference to your achievement-tracking variable, and modifies the HP variable to be current again

Or an easy way with plugins:
- Give every actor the same passive state using VisuStella Skills and States
- In the passive state, put a notetag from VisuStella Battle Core:
Code:
<JS Post-Damage as User>
$gameVariables.setValue(X, $gameVariables.value(X)+value);
</JS Post-Damage as User>
where X is the ID of your achievement-tracking variable. Make sure to initialize it to 0 at the beginning of the game.
Thanks for the quick response and for providing two solutions!
 

Latest Threads

Latest Profile Posts

My children thought this would be a funny shirt for me.
Bad Sign 2.jpg
Trying something out. Is this too many words to read?Profile_Arwen.png
totally-saved-2.gif
Save/Load complete. Kind of. There should be trinkets or medals that fit in the empty space of the bookmarks to show progression. Was gonna post it earlier, but I couldn't link GIFs. Don't mind all of them having a style level of 000, it just means they're all nakey and don't have anything equipped.
SpyroFan67 wrote on TESTOSTERONE's profile.
One question-why is your user picture a shelf of greeting cards at a store? XD

Forum statistics

Threads
131,565
Messages
1,221,087
Members
173,257
Latest member
hahadori
Top