Detect unconscious essential NPCs

Post » Tue May 17, 2011 6:04 am

Here's the code I'm using at present, placed in the actor's script:
if IsEssential	if getav health <= 0		player.additem GlassesBlackrimmed 1 ; just a check	endifendif

However, checking the health is slightly unreliable. If the actor is killed by the Kill command, for example, it's health doesn't drop and there may be other circumstances where it will fail.

I will probably still use this method, since it's reliable enough, but if anyone has a better suggestion I'd be glad to hear it.

If nothing else there's now a code example on the forum. :)
User avatar
patricia kris
 
Posts: 3348
Joined: Tue Feb 13, 2007 5:49 am

Post » Tue May 17, 2011 8:45 am

You could try http://geck.gamesas.com/index.php/GetKnockedState == 1. I use it as a perk condition in my mod to kill and loot essential NPCs.
User avatar
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Tue May 17, 2011 12:43 am

Yeah, i've seen the GetKnockedState in other mods and i've used it on a follower npc script and it's reliable.
User avatar
Lakyn Ellery
 
Posts: 3447
Joined: Sat Jan 27, 2007 1:02 pm

Post » Tue May 17, 2011 2:18 am

There is a bug with http://geck.gamesas.com/index.php/GetKnockedState though - if the actor is damaged in such a way that they become unconscious while they are knocked down (for example, via http://geck.gamesas.com/index.php/PushActorAway) then http://geck.gamesas.com/index.php/GetKnockedState will say that they are knocked down but not unconscious until they recover.

This can be a problem for essential actors that are killed by attacks that have a "push away" effect, like the Super Mutant Behemoths.

Cipscis
User avatar
Vivien
 
Posts: 3530
Joined: Fri Apr 13, 2007 2:47 pm

Post » Tue May 17, 2011 8:47 am

From reading the http://cs.elderscrolls.com/constwiki/index.php/GetKnockedState entry it seems would trigger in other circumstances too?

I'll probably go with the health-check. I feels like actors dying without taking damage would be pretty rare. And if it does happen it won't break my concept too badly.

FYI, I'm thinking of adding hire-able rangers for my RR mod that would leave you after being knocked down a bit.
User avatar
stacy hamilton
 
Posts: 3354
Joined: Fri Aug 25, 2006 10:03 am

Post » Tue May 17, 2011 7:11 am

I thought the health of NPCs was regenerated to a certain proportion of their maximum health when they were knocked out? Have you tested this approach?

Cipscis
User avatar
Jesus Duran
 
Posts: 3444
Joined: Wed Aug 15, 2007 12:16 am

Post » Tue May 17, 2011 9:26 am

It regenerates when they wake up, so it's a good way to detect that (except for the aforementioned exception), but that was not my primary concern.
User avatar
Laura Mclean
 
Posts: 3471
Joined: Mon Oct 30, 2006 12:15 pm


Return to Fallout 3