You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Tuesday, December 18th 2012, 6:54pm

Event for creature death

I'm working on a new addon and I want it to perform certain actions whenever I kill a mob. The problem I have run into is that I haven't found an event handler which explicitly does this. I could trigger it when the targetted mob's health drops to 0 but this wouldn't work correctly because it would also work for mobs that I am not killing (I target someone else's kill). Does anyone know of an event handler that specifically handles this? I would think there is one because the game knows to give you xp/tp for your kills and not someone else's.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Tuesday, December 18th 2012, 7:53pm

Sort of depends on what restrictions, if any, you want to impose on this. If you restrict things to only a mob that you are currently targeting, then you can use the UNIT_HEALTH event since it will give you a unit ID in arg1 and so you can compare it with your current target with

Source code

1
UnitIsUnit("target", arg1)


Otherwise, you'll have to do some fancy footwork to track units you have attacked and monitor them that way. If so, then you'll likely also want to track their target (via the UNIT_TARGET_CHANGED event) in case they loose focus (as in you ran out of range of the mobs area, you died, etc). If they do, or die, remove them from the tracking list. You may also want to remove a unit from the list after a reasonable amount of time has gone by so that you don't clutter your tracking list too much.
2013... The year from hell....

3

Tuesday, December 18th 2012, 8:31pm

I'm trying to keep track of kills, so it would be things that you attack. I hadn't thought about using the mob's target, that's a good idea. That raises another question. Do we know how aggro works?

Let say I attack a mob then someone else comes in and kills it before it resets. I had always thought that you remain on a mob's "aggro list". Is this true and if so, how do we access that list? Hmm, I'm going to take a look at some aggro tracking addons.

Edit: Sweetness! Using the TargetHateListRequest(). Thanks again!

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

4

Tuesday, December 18th 2012, 9:07pm

I've never played with aggro stuff, but here's a couple of functions and an event of interest.

The TARGET_HATE_LIST_UPDATED is fired after you've requested for the aggro (aka hate) list, and you can get it (apparently there is some delay required between requests).

The functions are GetTargetHateList and TargetHateListRequest. Apparently, GetTargetHateList takes a "row" value for the entry and returns the name and aggro value from that table. The table might not be sorted in any order. If a row doesn't exist, the function returns nil.
2013... The year from hell....