Simplist way to detect death of enemy?

Post » Sun Jun 24, 2012 1:29 pm

I need to know when the actor I enter battle with dies. What's the easiest way to do this?

I've come up with the following, either seems fine, but is there another way that is better?
1. Force the enemy in to an alias with a OnDeath event - (but then I would need to get that back to the player)
2. When entering combat, save the enemy reference, when combat is done, check if the enemy is dead.
a. OnCombatStateChanged
b. IsDead()

#2 - seems cleanest to me as it's all in one code base.

This is not for a stage or quest, this is to track kills. So it could be any enemy, not a scripted enemy.

Thanks!
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Sun Jun 24, 2012 3:04 pm

If the purpose is to track kills, could you not use the OnStoryKillActor event and check whether you are the killer (or one of your followers is, if you want)?
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Post » Sun Jun 24, 2012 3:37 am

I'd say the best approach for this depending on what your goals are is to use either a http://www.creationkit.com/Kill_Actor_Event, which will allow the Story Manager to feed your quest a bunch of data regarding the actor that died (and if you want to give that data to your scripts, an http://www.creationkit.com/OnStoryKillActor_-_Quest Event), or if you just want a very simple method so you can fire off a new quest stage when your actor dies use an http://www.creationkit.com/OnDying_-_Actor Event in Papyrus. Don't use OnDeath, it can fail.
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Sun Jun 24, 2012 8:55 am

Thanks Ingenue & Thomas Kaira! I have never used the "Story" functionality so I'll have to look in to what that's about.

This is not in any way quest related though, so I don't have stages to trigger or anything. It's for a statistic, so I'll look at the OnStoryKillActor event.
User avatar
Stacey Mason
 
Posts: 3350
Joined: Wed Nov 08, 2006 6:18 am


Return to V - Skyrim