Jump to content

NPCs regenerate health


StPatrick923

Recommended Posts

It doesn't actually matter to me too much -- just so long as we don't have, for example, a travelling merchant who survives an attack from Legion assassins with only a few hit points, then dies much later in the game because he gets into a fight with a pack of coyotes and he never healed from the earlier atteck.[/size]

In the scenario you outline above (the travelling merchant), the method *would* be important. Unless the healing is very quick you would want to factor in how long you would be hanging around the merchant (for the reference walking method) and as Ladez points out, what activity (in regards to combat) the merchant could engage in without the players presence (high mem)....ie whether he could be hurt/wounded when the player isn't about. If s/he can't be wounded/killed with the player absent, it's much less of an issue (although you could leave for a month and come back with the merchant in the same wounded condition), and you won't have to babysit the merchant.

 

Using a form id for all your actors to check against can function whether your near, far or in another worldspace all together (or so I suspect, some functions require a actor to be in the same cell, but I don't think those are functions we'd need for this). On the other hand adding all actor refIDs you want included, to a big formlist is a lot of work for the modder and I'm curious how many cpu cycles the script would take up (although you can easily modify how often you want it to run).

 

And of course there could be other ways too.....

Link to comment
Share on other sites

Hm. Maybe when you leave a cell, NPCs in that cell could regenerate some health, as opposed to slowly regenerating over time. That might be easier to implement or less memory-intensive, and would more or less satisfy what I'm looking for.

I'm not sure we really have a function to fire off some code when your leaving a cell. You can can definitely see if your currently in an exterior or interior cell or a specific cell. Maybe you could do a little ref walking to make a formList and every now and then test it against GetInSameCell. If it's 0 (ie the player and the actor/actors is/are no longer in the same cell) it could fire off a little healing to everyone in the formList.

 

It might be a bit tricky though because you want to do a bit of clean up of that formList. And I don't know if you could have duplicates end up in the formList (if your hanging around in the cell for a while), which could be some scary bloat. If they get healed by the script you can have them removed from the formList without any problem (there's a lot of functions for working with formLists), but they could be wounded again while your still in teh cell. The formList would be pretty dynamic with actors being added and subtracted as you move from cell to cell, get healed, get wounded etc.

 

But alas scripting is not my strong point, so I can't give you definitive answers I'm afraid.

Link to comment
Share on other sites

Actually there's a isinlist function, do that can do a check on an actors id before adding to a form list, eliminating any worries about dupes

 

That particular one only works on base forms though, but NVSE has ListGetFormIndex and IsRefInList.

 

-

 

I'm currently trying to make something work based on what's been discussed, but I can't promise anything.

 

By the way, do you want this for creatures too, or just NPCs?

Edited by Ladez
Link to comment
Share on other sites

  • Recently Browsing   0 members

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