Jump to content

Crippled limbs for npc.


Recommended Posts

So I edited and added that script to the main script of Zombie Walkers, but still the resurrected NPC's walk with their fists up like boxers.

 

I tried to upload a screenshot of the entry I made but imgur seems to be down or something. I can copy and past a segment of the script here. Hopefully someone can tell my what I am doing wrong. It compiled fine. The new entry is ;CrippleOnLoad

 

The whole event its triggered to start on load, I think, so I added it in there instead of making it a stand alone event.

Edited by Guest
Link to comment
Share on other sites

Scriptname ZombieEffectScript extends activemagiceffect

Group Misc
Actor Property PlayerRef Auto Const Mandatory
Race Property FeralGhoulRace Auto Const Mandatory
Race Property FeralGhoulRace_Rot Auto Const Mandatory
Race Property ZombieGhoulRace Auto Const Mandatory
Potion Property ZombieStagger Auto Const Mandatory
Projectile[] Property SilentProjectiles Auto Const Mandatory
Armor Property ZombieSlowAttackArmor Auto Const Mandatory
Armor Property ZombieSlowAttackArmorNPC Auto Const Mandatory
EndGroup

Group Keywords
Keyword Property ActorTypeZombieFarHarbor Auto Const Mandatory
Keyword Property FeaturedItem Auto Const Mandatory
Keyword[] Property MeleeWeaponTypes Auto Const Mandatory
Keyword Property ReplacedByZombie Auto Const Mandatory
Keyword Property WeaponTypeExplosive Auto Const Mandatory
Keyword Property AnimsUnarmed Auto Const Mandatory
Keyword Property Anims1hmShortWeapon Auto Const Mandatory
Keyword Property Anims1hmWeapon Auto Const Mandatory
Keyword Property Anims2hmWeapon Auto Const Mandatory
Keyword Property Anims2hmWideWeapon Auto Const Mandatory
Keyword Property WeaponTypeShotgun Auto Const Mandatory
Keyword Property NoDisintegrate Auto Const Mandatory
EndGroup

Group ActorValues
ActorValue Property DamageResist Auto Const Mandatory
ActorValue Property EnergyResist Auto Const Mandatory
ActorValue Property UnarmedDamage Auto Const Mandatory
ActorValue Property HealthAV Auto Const Mandatory
ActorValue Property HeadConditionAV Auto Const Mandatory
ActorValue Property PerceptionAV Auto Const Mandatory
ActorValue Property SpeedMultAV Auto Const Mandatory
ActorValue Property LeftMobilityCondition Auto Const Mandatory
ActorValue Property RightMobilityCondition Auto Const Mandatory
ActorValue Property LeftAttackCondition Auto Const Mandatory
ActorValue Property RightAttackCondition Auto Const Mandatory
ActorValue Property ZombieMarkerTimestamp Auto Const Mandatory
EndGroup

Group GlobalVariables
GlobalVariable Property FGO_DamageMult Auto Const Mandatory
GlobalVariable Property FGO_HeadshotsOnly Auto Const Mandatory
GlobalVariable Property FGO_Health Auto Const Mandatory
GlobalVariable Property FGO_MaxLevel Auto Const Mandatory
GlobalVariable Property FGO_NoLoot Auto Const Mandatory
GlobalVariable Property FGO_Perception Auto Const Mandatory
GlobalVariable Property FGO_SpeedMult Auto Const Mandatory
GlobalVariable Property FGO_XP Auto Const Mandatory
EndGroup

Group Sounds
Sound Property NPCFeralGhoulAttackCharge Auto Const Mandatory
Sound Property NPCFeralGhoulInjuredDownNotOutEnter Auto Const Mandatory
EndGroup

Actor ZombieActor
int ZombieStatLevel
int bonusXP
float lastOnHitTime = 0.0
bool hasSpecialItem = false
bool hitByPlayer = false
bool property bLeftArm= True auto const
bool property bRightArm = True auto const

Event OnEffectStart(Actor akTarget, Actor akCaster)
ZombieActor = akTarget

If(ZombieActor)
;float startTime = Utility.GetCurrentRealTime()
;Debug.OpenUserLog("joefor")
;Debug.TraceUser("joefor", "[ZombieEffectScript] OnEffectStart(" + ZombieActor + ")")

; Sanity check - only proceed if zombie is not dead
If( !ZombieActor.IsDead() )
; headshots only - use deferred kill
If( FGO_HeadshotsOnly.GetValue() == 1 )
ZombieActor.StartDeferredKill()
EndIf

; CrippleOnLoad
If( ZombieActor.GetRace() == ZombieGhoulRace )
If bLeftArm
ZombieActor.DamageValue(LeftAttackCondition, 100)
Endif
If bRightArm
ZombieActor.DamageValue(LeftAttackCondition, 100)
Endif
EndIf

; zombie stats should be based on player level with a max based on config
ZombieStatLevel = PlayerRef.GetLevel()
int maxEffectiveLevel = FGO_MaxLevel.GetValueInt()
If( maxEffectiveLevel != -1 )
; use minimum of configured max effective level and player level
ZombieStatLevel = Math.Min( ZombieStatLevel, maxEffectiveLevel ) as int
EndIf
;Debug.TraceUser("joefor", "[ZombieEffectScript] Level = " + ZombieStatLevel )

; apply Speed Mult
Float speedMultValue = FGO_SpeedMult.GetValue()
If( speedMultValue != -1 )
; set speed mult value directly based on config
ZombieActor.SetValue(SpeedMultAV, speedMultValue )
Else
; randomize speed mult from slow walk (69) to fast run (300)
Int randSpeedMult = Utility.RandomInt(0, 200) + Utility.RandomInt(0, 200) - 100
If( randSpeedMult < 0 )
; set to Slow Walk
randSpeedMult = 69
ElseIf( randSpeedMult < 100 )
; set to Walk
randSpeedMult = 100
EndIf
ZombieActor.SetValue(SpeedMultAV, randSpeedMult)
EndIf
;Debug.TraceUser("joefor", "[ZombieEffectScript] SpeedMult = " + ZombieActor.GetValue(SpeedMultAV))

; apply Perception bonus
float perceptionBonus = FGO_Perception.GetValue()
If( ZombieStatLevel > 62 )
perceptionBonus += 3
ElseIf( ZombieStatLevel > 52 )
perceptionBonus += 2
ElseIf( ZombieStatLevel > 32 )
perceptionBonus += 1
EndIf
If( perceptionBonus > 0 )
; get base perception value
float perceptionBase = ZombieActor.GetValue( PerceptionAV )

; add bonus and set new value
ZombieActor.SetValue( PerceptionAV, perceptionBase + perceptionBonus )
EndIf
;Debug.TraceUser("joefor", "[ZombieEffectScript] Perception = " + ZombieActor.GetValue(PerceptionAV))

; set damage resistance
; note: for some reason SetValue on DamageResist does not work even though it works for the other stats
int CurrentDamageResist = ZombieActor.GetValue( DamageResist ) as int
ZombieActor.ModValue( DamageResist, (ZombieStatLevel * 1.24 + 8.276) as int - CurrentDamageResist )
;Debug.TraceUser("joefor", "[ZombieEffectScript] DamageResist = " + ZombieActor.GetValue(DamageResist))

; set energy resistance
ZombieActor.SetValue( EnergyResist, (ZombieStatLevel * 1.933 + 13.988) as int )
;Debug.TraceUser("joefor", "[ZombieEffectScript] EnergyLevel = " + ZombieActor.GetValue(EnergyResist))

; set health
ZombieActor.SetValue( HealthAV, (ZombieStatLevel * 5 + 20) * (FGO_Health.GetValue() / 100.0) )
;Debug.TraceUser("joefor", "[ZombieEffectScript] Health = " + ZombieActor.GetValue(HealthAV))

; set unarmed damage
InitializeUnarmedDamage()

float xpMultiplier = FGO_XP.GetValue() / 100.0
If( xpMultiplier == 0 )
bonusXP = 0
ElseIf( xpMultiplier > 0 )
; calculate total XP that should be awarded (min 1)
bonusXP = ((ZombieStatLevel * 1.432 + 1.063) * xpMultiplier) as int
If( bonusXP < 1 )
bonusXP = 1
EndIf
EndIf

; prevent disintegration from lasers/plasma/etc.
ZombieActor.AddKeyword( NoDisintegrate )

; special case: far harbor fog ghouls have a base xp of 7 that will already have been awarded
; check if this is a Fog Ghoul spawned in the commonwealth (ActorTypeZombieFarHarbor) OR
; check if this zombie is located in Far Harbor
If( ZombieActor.HasKeyword( ActorTypeZombieFarHarbor ) )
bonusXP -= 7
ElseIf( Game.IsPluginInstalled( "DLCCoast.esm" ) )
Location FarHarborWorld = Game.GetFormFromFile(0x00020168, "DLCCoast.esm") as Location
If( ZombieActor.IsInLocation( FarHarborWorld ) )
bonusXP -= 7
EndIf
EndIf
;Debug.TraceUser("joefor", "[ZombieEffectScript] bonusXP = " + bonusXP)

; equip magic item to slow zombie attack speed
If( ZombieActor.GetRace() == FeralGhoulRace_Rot )
( ZombieActor.GetRace() == FeralGhoulRace )
ZombieActor.EquipItem( ZombieSlowAttackArmor, true, true )
Else
ZombieActor.EquipItem( ZombieSlowAttackArmorNPC, true, true )
EndIf

; register for various actor events
RegisterForHitEvent(ZombieActor)
RegisterForRemoteEvent(ZombieActor, "OnCripple")
RegisterForRemoteEvent(ZombieActor, "OnPartialCripple")
RegisterForRemoteEvent(ZombieActor, "OnDying")
RegisterForRemoteEvent(ZombieActor, "OnKill")
RegisterForRemoteEvent(ZombieActor, "OnDeferredKill")

; transfer any special items from replacement
ObjectReference[] replacedActors = ZombieActor.GetLinkedRefChildren( ReplacedByZombie )
int i = 0
While( i < replacedActors.length )
Actor replacedActor = replacedActors as Actor

; transfer special items
AddInventoryEventFilter( None )
RegisterForRemoteEvent(ZombieActor, "OnItemAdded")
replacedActor.RemoveAllItems( ZombieActor )

i += 1
EndWhile

;float elapsedTime = Utility.GetCurrentRealTime() - startTime
;Debug.TraceUser("joefor", "[ZombieEffectScript] OnEffectStart(" + ZombieActor + ") completed after " + elapsedTime + " seconds")
EndIf
EndIf
EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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