Thanks for the detailed replied, Caethyril! I had a feeling it wouldn't be simple and was totally prepared to override some game function to store that info in an accessible place, but I might be able to work with what you've given me.
If all your skills use the formula box, you can try formulae like this:
JavaScript:
v[1] = this.item().id; a.atk * 4 - b.def * 2
I.e. set a game variable equal to the skill's ID, then process the rest of the formula, whatever it might be, as usual. Skill effects run after the damage formula is processed, so the variable will be set before the event runs.
😮💨
I've been very much avoiding placing extra statements in the formula box, preferring to create plugins with note tags for fancy effects. However, maybe I can make an exception in this case... at the very least, it's worth a try. The only minor problem is that the skill in question is not a damage skill... so I wonder if using the formula box
just to run a command would create some minor issues?
(Just a quick note: the damage formula is evaluated to determine an expected value when determining action preferences, i.e. autobattle actors or enemy AI. I don't think the caveat applies in this particular case, but thought it was worth mentioning. 😅)
Yes, I recall reading about this in the giant damage formula thread that's pinned in the main forum. I don't think it matters in my specific case - although I do have a setting to let you set your party to auto-battle, the content of the variable would only matter if the skill is actually executed, so even if it's redundantly updated when the AI picks a skill, it shouldn't affect anything.
If (some of) your skills do not use the formula box and you'd like to avoid "0" damage popups, maybe check out Yanfly's Skill Core plugin:
www.yanfly.moe
Amongst other things, it offers skill notetags that let you run some JS at various points in a skill's execution, e.g.
Code:
<Pre-Damage Eval>[/INDENT][/INDENT][/INDENT]
[INDENT][INDENT][INDENT]$gameVariables.setValue(1, item.id);[/INDENT][/INDENT][/INDENT]
[INDENT][INDENT][INDENT]</Pre-Damage Eval>
😤
Thanks for the suggestion. I've been steadfastly avoiding most of Yanfly's plugins though (for several reasons, I won't go into them here), so I'd prefer to keep that streak going. That said, I guess it would be really easy to get the same effect by overriding something like
makeDamageValue or one of the functions in its vicinity in the call stack, so this is still helpful information.
EDIT: The formula box method didn't work for me, since ultimately what I needed was the skill's target rather than its user which isn't stored in a
Game_Action (at least on the menu screen), but I got it working by overriding
Game_Action.prototype.apply to store some stuff in the variable. I suppose it might've been "cleaner" to implement a custom skill effect and do away with the common event entirely, but whatever, this works.