Jump to content

Inconsistent results from a user-defined OnDeath handler with filters


DaWrecka

Recommended Posts

So you are saying so far all NPC's relying on the lvlSlaver for Stats only ,which rely on EncSlaver for everything. Are not working so far ? Where as Eulogy and Forty don't use the template data at all , are working ?

Hmm. It seems you're right. All of the ones which aren't working all use LvlSlaver as their template. There are other Slavers who have "Use Stats" and a template; However, none of those templates are LVLI forms. The only other commonality is that the ones which have been working have a Model Filename of "Characters\_Male\Skeleton.NIF", while the ones which don't work - which all use LvlSlaver - all use "marker_creature.nif", which is probably more of a 'red flag' than a cause.

Link to comment
Share on other sites

So it would seem you need to pass their Ref ID for "GetDead" or "OnDeath" block in the event handler.

 

Sorry not really familiar with event handlers ... but I assume you can pass any form ID in them ?

So just a matter of adding those 6 npc ref ID's along side the resident form list .... maybe ?

Link to comment
Share on other sites

So it would seem you need to pass their Ref ID for "GetDead" or "OnDeath" block in the event handler.

 

Sorry not really familiar with event handlers ... but I assume you can pass any form ID in them ?

According to the Wiki, you can pass a ref, a base form, or a list.

So just a matter of adding those 6 npc ref ID's along side the resident form list .... maybe ?

Not ideal, but it might suffice as a workaround.

 

Hmm... I wonder... what would happen if I were to add LvlSlaver as a filter...? (EDIT: Not a lot, it turns out)S

 

So I tried registering handlers with explicit filters for those six... Using their base forms didn't work. Using their references did.

 

Still not ideal, since it means you have to have persistent references for everything whose death you might want to handle, with unique refIDs. (I forget whether you can put non-persistent references on a form list)

Edited by DaWrecka
Link to comment
Share on other sites

I had a feeling the base IDs wouldn't work. Did you try matching their in-game GBO ID to the base ID in the GECK? I think something about the way the game generates the actor breaks the connexion to the base object, at least as far as event handlers are concerned. I would message Sax if you really want an answer, as I know he does a lot of work with stuff like this (and is the author of the best event handler tutorial I know of).

Link to comment
Share on other sites

I had a feeling the base IDs wouldn't work. Did you try matching their in-game GBO ID to the base ID in the GECK?

I did; GrouseRef definitely returns the same result for GetBaseObject as the base form that's on the formlist.

I think something about the way the game generates the actor breaks the connexion to the base object, at least as far as event handlers are concerned. I would message Sax if you really want an answer, as I know he does a lot of work with stuff like this (and is the author of the best event handler tutorial I know of).

I'll have to give that a try. Edited by DaWrecka
Link to comment
Share on other sites

So I tried registering handlers with explicit filters for those six... Using their base forms didn't work. Using their references did.

 

Still not ideal, since it means you have to have persistent references for everything whose death you might want to handle, with unique refIDs. (I forget whether you can put non-persistent references on a form list)

If necessary, it can still work for this specific application, yeah? or is there some reason you don't want to do it here? Is it that they weren't already persistent references, so you don't want to alter them and produce an unnecessary compatibility problem? You could use this:

https://geckwiki.com/index.php/SetPersistent

I suppose you'd need to associate the actors with reference variables via an array first, though, which is a little annoying. Although, rather than using the form list method, could you use an array script and do it by faction?

 

Just thinking of relatively painless workarounds. Regarding your actual problem of the event handler not catching these NPCs when they die, and messaging Sax, I'm mad to find out what you learn, as this is a perplexing little snag and it's getting to me that I can't think of what could be the trouble.

 

Speaking of persistent references, how many of these levelled actors are persistent to begin with? Is it possible that this is in any way related to the problem?

Link to comment
Share on other sites

If necessary, it can still work for this specific application, yeah? or is there some reason you don't want to do it here? Is it that they weren't already persistent references, so you don't want to alter them and produce an unnecessary compatibility problem? You could use this:

https://geckwiki.com/index.php/SetPersistent

I suppose you'd need to associate the actors with reference variables via an array first, though, which is a little annoying. Although, rather than using the form list method, could you use an array script and do it by faction?

 

Just thinking of relatively painless workarounds.

I'm not sure you can pass an array variable as a filter to SetEventHandler. Otherwise it might work.

 

...or it would, except it turns out that all of the slavers I'm interested in are already set as persistent, meaning that that for this instance at least, making a form list of the references is pretty easy thanks to a modified version of matortheeternal's PowerList script. In fact, I've just done that.

Regarding your actual problem of the event handler not catching these NPCs when they die, and messaging Sax, I'm mad to find out what you learn, as this is a perplexing little snag and it's getting to me that I can't think of what could be the trouble.

This DoctaSax?
Link to comment
Share on other sites

The trouble with any actor templated to a levelled list is that their base object (GetBaseObject, aka gbo) is not static, but dynamic, ie if you called getbaseobject on the ref in-game you would get a form whose formid starts with FF (255). This explains the problem with some of the debug readouts, in that IsInList called on the ref won't match the base form that is stored in the geck. To get that base form, you'd need GetBaseForm (gbf) and look it up in the list with ListGetFormIndex.

 

That it should also be a problem for a formlist working as filter for an event handler is new to me, but I honestly didn't test event handlers as much as arrays, string vars etc, at the time i wrote the tutorial (and haven't had much use for them either so far, except UDEs). I suspect the filter check done by the event handler follows the gbo rather than the gbf method. So it seems that you're stuck with using a formlist of refs rather than forms.

Link to comment
Share on other sites

I'm not sure you can pass an array variable as a filter to SetEventHandler. Otherwise it might work.

No, don't believe you can. I don't actually remember writing that, haha, but I probably meant something a little bit more complex like making your own form list at run-time from an array that you get via GLTA and filtering out whoever isn't in the faction you want. But if I meant that, I didn't think it through as that would return base forms only (if I remember right at least). Compounding the issue, you're still using a form list, so my wording was a bit poor as well. However, this function may be of use:

https://geckwiki.com/index.php/GetLevCharacterRefs

 

The very man.

 

The trouble with any actor templated to a levelled list is that their base object (GetBaseObject, aka gbo) is not static, but dynamic, ie if you called getbaseobject on the ref in-game you would get a form whose formid starts with FF (255).

This was exactly what I'd expected. However, OP said checking their base ID in-game with GBO did return the same ID as what was on the form list passed to the handler. Either that or we misunderstood one another. But the thing that I find interesting and confusing here is that there are other levelled actors on the form list that have their deaths registered accurately by the handler as intended.

Link to comment
Share on other sites

 

The very man.

 

The trouble with any actor templated to a levelled list is that their base object (GetBaseObject, aka gbo) is not static, but dynamic, ie if you called getbaseobject on the ref in-game you would get a form whose formid starts with FF (255).

This was exactly what I'd expected. However, OP said checking their base ID in-game with GBO did return the same ID as what was on the form list passed to the handler. Either that or we misunderstood one another.

 

 

So just in theory ... would making a form list to match "EncSlaver" Lvled character ... list of pics ... work then ?

 

EPD said "But the thing that I find interesting and confusing here is that there are other levelled actors on the form list that have their deaths registered accurately by the handler as intended. "

 

Which Lvled actors did have their death registered ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...