Deleted49413338User Posted December 7, 2018 Share Posted December 7, 2018 If I want an NPC to spawn with already crippled limbs, how do I do that? I tried adding LeftAttackCondition -100 to the PRPS properties but that didn't work. Unless, a change like that wont activate on NPCs that are already loaded in the cell? Link to comment Share on other sites More sharing options...
DiodeLadder Posted December 7, 2018 Share Posted December 7, 2018 Hi there Oynlen, What you are looking for is a script called, "DefaultCrippleOnLoad", which can be attached to object references. Very similar to the dismember on load script that I was talking about in the thread you tried to help me once. :-) Link to comment Share on other sites More sharing options...
Deleted49413338User Posted December 8, 2018 Author Share Posted December 8, 2018 ok thanks I will look for it Link to comment Share on other sites More sharing options...
Deleted49413338User Posted December 8, 2018 Author Share Posted December 8, 2018 (edited) 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 December 8, 2018 by Guest Link to comment Share on other sites More sharing options...
Deleted49413338User Posted December 8, 2018 Author Share Posted December 8, 2018 Scriptname ZombieEffectScript extends activemagiceffectGroup MiscActor Property PlayerRef Auto Const MandatoryRace Property FeralGhoulRace Auto Const MandatoryRace Property FeralGhoulRace_Rot Auto Const MandatoryRace Property ZombieGhoulRace Auto Const MandatoryPotion Property ZombieStagger Auto Const MandatoryProjectile[] Property SilentProjectiles Auto Const MandatoryArmor Property ZombieSlowAttackArmor Auto Const MandatoryArmor Property ZombieSlowAttackArmorNPC Auto Const MandatoryEndGroupGroup KeywordsKeyword Property ActorTypeZombieFarHarbor Auto Const MandatoryKeyword Property FeaturedItem Auto Const MandatoryKeyword[] Property MeleeWeaponTypes Auto Const MandatoryKeyword Property ReplacedByZombie Auto Const MandatoryKeyword Property WeaponTypeExplosive Auto Const MandatoryKeyword Property AnimsUnarmed Auto Const MandatoryKeyword Property Anims1hmShortWeapon Auto Const MandatoryKeyword Property Anims1hmWeapon Auto Const MandatoryKeyword Property Anims2hmWeapon Auto Const MandatoryKeyword Property Anims2hmWideWeapon Auto Const MandatoryKeyword Property WeaponTypeShotgun Auto Const MandatoryKeyword Property NoDisintegrate Auto Const MandatoryEndGroupGroup ActorValuesActorValue Property DamageResist Auto Const MandatoryActorValue Property EnergyResist Auto Const MandatoryActorValue Property UnarmedDamage Auto Const MandatoryActorValue Property HealthAV Auto Const MandatoryActorValue Property HeadConditionAV Auto Const MandatoryActorValue Property PerceptionAV Auto Const MandatoryActorValue Property SpeedMultAV Auto Const MandatoryActorValue Property LeftMobilityCondition Auto Const MandatoryActorValue Property RightMobilityCondition Auto Const MandatoryActorValue Property LeftAttackCondition Auto Const MandatoryActorValue Property RightAttackCondition Auto Const MandatoryActorValue Property ZombieMarkerTimestamp Auto Const MandatoryEndGroupGroup GlobalVariablesGlobalVariable Property FGO_DamageMult Auto Const MandatoryGlobalVariable Property FGO_HeadshotsOnly Auto Const MandatoryGlobalVariable Property FGO_Health Auto Const MandatoryGlobalVariable Property FGO_MaxLevel Auto Const MandatoryGlobalVariable Property FGO_NoLoot Auto Const MandatoryGlobalVariable Property FGO_Perception Auto Const MandatoryGlobalVariable Property FGO_SpeedMult Auto Const MandatoryGlobalVariable Property FGO_XP Auto Const MandatoryEndGroupGroup SoundsSound Property NPCFeralGhoulAttackCharge Auto Const MandatorySound Property NPCFeralGhoulInjuredDownNotOutEnter Auto Const MandatoryEndGroupActor ZombieActorint ZombieStatLevelint bonusXPfloat lastOnHitTime = 0.0bool hasSpecialItem = falsebool hitByPlayer = falsebool property bLeftArm= True auto constbool property bRightArm = True auto constEvent 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 EndIfEndEvent Link to comment Share on other sites More sharing options...
Recommended Posts