Open-Terraria-API icon indicating copy to clipboard operation
Open-Terraria-API copied to clipboard

No hook for bosses dying

Open Mrcactus1215 opened this issue 3 years ago • 2 comments

I'm trying to make a plugin for DPS and % contribution to bosses calculation.

The way it works is by using TSAPI's extension of the Npc.Strike hook I add each boss to a dictionary with the needed information for the calculation. And then when the boss dies, using TSAPI's extension of the Npc.Killed hook I remove the boss from the dictionary.

It works fine for bosses like King Slime, Eye of Cthulhu and such (one part) bosses, but it gets very complicated when dealing with multiple part bosses (Skeletron Prime, Skeletron not included because their arms are not part of the boss's max health). Eater of Worlds specifically can't be removed from the dictionary because while a part of it dies, the 'boss' is still alive.

I tried to go around it by getting the total number of segments of the boss (head and tail don't count, only type ID 14) and then only removing it after the number of segments dead is the same as total but that seemed to be less reliable as the boss split apart, and then some other bugs where I used a strong weapon and hit the boss after it was dead. All of my calculations would be possible, and easier to do if there was a hook for bosses dying with the Terraria.NPC property in it.

With such a hook, all I'd have to do is remove the NPC from my dictionary and it's done, no counting or anything.

Mrcactus1215 avatar Jun 14 '22 15:06 Mrcactus1215

So you are basically asking the otapi devs to implement the detection of worm boss deaths for you...

punchready avatar Jun 19 '22 00:06 punchready

yes

Mrcactus1215 avatar Jun 19 '22 02:06 Mrcactus1215