PDA

View Full Version : Is there a way to be notified of the amount of damage a CT node received?



SilentRuin
July 20th, 2020, 21:13
I need to know the amount of damage over max HP in "wounds" in the CT tracker but I can't see it being sent or stored anywhere except in the chat window. Is there a way to get this information on how much damage was actually applied?

"wounds" is always truncated to the number of hit points so I can't tell from just looking at that.

celestian
July 20th, 2020, 21:16
I need to know the amount of damage over max HP in "wounds" in the CT tracker but I can't see it being sent or stored anywhere except in the chat window. Is there a way to get this information on how much damage was actually applied?

"wounds" is always truncated to the number of hit points so I can't tell from just looking at that.

manager_action_damage.lua has the code I think you want.

SilentRuin
July 20th, 2020, 21:30
manager_action_damage.lua has the code I think you want.

Where I've been looking but unless I'm missing something (always a definite possibility) there is just a giant applyDamage routine which figures everything out and then sends a message to the chat window. At no place do I have access to the applied damage. For sure, I see it in chat window, but there is no "hook" for code that I can see that can give me that applyDamage final calculated damage to apply.

Am I missing something?

Moon Wizard
July 20th, 2020, 22:17
There is no hook built. It would be a custom thing.

JPG

SilentRuin
July 20th, 2020, 22:32
There is no hook built. It would be a custom thing.

JPG

I have enough to do on this extension yet that I'll put that aspect of it on the back burner or just "punt" support of that feature. Overriding the applyDamage handler seems to risky to other extensions (which would be dead if I stomped their version if they also overwrote it). I'll see if I think of something else later.

celestian
July 20th, 2020, 22:40
Where I've been looking but unless I'm missing something (always a definite possibility) there is just a giant applyDamage routine which figures everything out and then sends a message to the chat window. At no place do I have access to the applied damage. For sure, I see it in chat window, but there is no "hook" for code that I can see that can give me that applyDamage final calculated damage to apply.

Am I missing something?

No, there is no hook, you'd need to capture nRemainder to get the "over and above wounds damage done" and do whatever it is you're wanting to with it. Keep in mind I'm looking at 2E code which I think this part is still the same in 5e. Tho I didn't check so maybe it's just a 2E thing.

SilentRuin
July 21st, 2020, 15:00
No, there is no hook, you'd need to capture nRemainder to get the "over and above wounds damage done" and do whatever it is you're wanting to with it. Keep in mind I'm looking at 2E code which I think this part is still the same in 5e. Tho I didn't check so maybe it's just a 2E thing.

Solved it - in a less drastic way than overwritting applyDamage() function in the previously mentioned LUA code (which an extension I use, Death Indictator in signature, already does for a largely useless reason). Essentially, I tossed out my trigger to do my stuff in CombatManager.addCombatantFieldChangeHandler() and instead just do the following:

In my onInit()...


...
ActionDamage.messageDamage = messageDamage;
...


and in the exact copy of ActionDamage.messageDamage that I made myself I added the additional bit of code...



...
local nStartOf, nnEndOf, sDMGExceeded = sExtraResult:find("DAMAGE EXCEEDS HIT POINTS BY (%d+)");
local nDMGExceeded = 0;
if nStartOf then
nDMGExceeded = tonumber(sDMGExceeded);
end
onWoundsChanged(rTarget, nDMGExceeded);
...


Not thoroughly tested it yet, but superficial testing makes me think this is what I'll be doing - as its a fairly small piece of code to stomp to get what I want.