![]() |
Zombie with zero health still alive and well because the head has full health. |
Aim for the head!
When you find yourself fighting zombies, the first rule you learn is aim for the head. Ever since the beginning of creating the Zombie Walkers mod I've wanted to create a headshots only mode. It just seems like the right way to play any zombies game. Finally, I've found an implementation I'm happy with.
Deferred Kill
Fallout 4 has built in functions for creating a deferred kill situation where an actor still takes damage but does not actually die until "allowed" to:
- StartDeferredKill - Puts the actor into a Deferred Kill state. In this state, the actor can take damage but will not die.
- EndDeferredKill - Removes the actor from a Deferred Kill state. If the actor's health went below zero or the actor was killed for any other reason while in the Deferred Kill state, the actor will die when this is called.
- Kill(Actor akKiller = None) - Kills this actor with the passed-in actor being the culprit.
The above is tailor made for keeping zombies alive until their head is destroyed. Basically, you call StartDeferredKill on init and then wait to call EndDeferredKill until the head health is zero. To be extra sure I actually check if they are dead after calling EndDeferredKill and if not actually kill them.
Checking Head Health
Checking head health is actually pretty straightforward. Actors have several properties called actor values that you can check with a simple function:
- GetValue(ActorValue akAV) - Gets the specified Actor Value from the Object Reference.
Since the function takes an ActorValue object, you need to know what object corresponds to the condition of the head. In my script I created a property called HeadCondition and then used the property view to browse available options. After some experimentation I could see that PerceptionCondition was the right actor value to check and ranged from 100 (perfect health) to 0 (crippled/dismembered).
Putting it all together
Here's a sample of what the script might look like (note that I haven't tested this one as I pulled the relevant pieces out of a larger script):
ActorValue Property HeadCondition Auto Const Mandatory GlobalVariable Property HeadshotsOnly Auto Const Mandatory Event OnInit() ZombieActor = self.GetActorReference() ; Headshots Only mode - start deferred kill If( HeadshotsOnly.GetValue() == 1 ) ZombieActor.StartDeferredKill() EndIf EndEvent Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, \ Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked, string apMaterial) ; check condition of head If( ZombieActor.GetValue(HeadCondition) <= 0 ) ; zombie's head is destroyed, end deferred kill ZombieActor.EndDeferredKill() ; now, make sure zombie dies If( !ZombieActor.IsDead() ) ZombieActor.Kill() EndIf EndIf EndEvent
Why are you so excited about this?
First, this implements a feature I've been wanting from the beginning. More importantly, it does it in a way that is totally independent of Body Part Data configuration. Torso and Limb damage values/health can be set to whatever (and maybe eventually made configurable) and the zombies will still only die when their heads are destroyed.
I may revisit Body Part Data now that this mode exists to make crippling a little easier. I had changed damage on limbs to 25% and set the health very low but the crippling rate still never seemed to match the default settings. The only downside of changing the limb damage values is it'll make zombies a lot easier to kill if anyone turns off headshots only mode. Then again, who would do that?
im trying to figure out why, with headshot only mode off, and health at 10% why for the life of me, can i empty an entire combat shotgun mag into one zed and they dont die?
ReplyDeleteCurrently with headshots only disabled their torso still only takes 10% damage. This will be changing to 50% in the upcoming 2.5 update that is hopefully coming soon (doing some playtesting of a couple new features now).
DeleteWhen you're new to the 토토사이트 game, it could be hard to learn to play. Fortuitously, you are able to follow some simple recommendations to begin playing.
ReplyDelete