SKKmods Posted April 9, 2019 Share Posted April 9, 2019 (edited) Working on scaling settlers (WorkshopNPC) damage with the Combat Settlers mod to partner with Settlement Attack System, did some testing to validate that Weapon OMODs and Shooting perks do register on NPC actors. As I put the effort in, here are the results for reference: Scriptname SKK_toolsWeaponsScript extends Quest group BaseGame Static Property pXmarker Auto Const Mandatory Armor Property pArmor_Highschool_UnderArmor Auto Const Mandatory Perk Property pGunslinger01 Auto Const Mandatory Perk Property pRifleman01 Auto Const Mandatory CombatStyle Property csRaiderRangedOffenseHigh Auto Const Mandatory ActorBase property pWorkshopNPC Auto Const Mandatory ActorValue Property pHealth Auto Const Mandatory ActorValue Property pPerception Auto Const Mandatory EndGroup group SKK Quest Property pSKK_toolsWeaponsQuest Auto Const Mandatory FormList Property pSKK_toolsWeaponsWEAPList Auto Const Mandatory FormList Property pSKK_toolsWeaponsAMMOList Auto Const Mandatory FormList Property pSKK_toolsWeaponsOMODList Auto Const Mandatory Outfit Property pSKK_toolsWeaponsOutfit Auto Const Mandatory Faction Property pSKK_toolsWeaponsFactionA Auto Const Mandatory Faction Property pSKK_toolsWeaponsFactionB Auto Const Mandatory Message Property pSKK_toolsWeaponsMessageBase Auto Const Mandatory Message Property pSKK_toolsWeaponsMessagePerks Auto Const Mandatory Message Property pSKK_toolsWeaponsMessageMods Auto Const Mandatory ReferenceAlias Property Alias_Container Auto Const Mandatory ReferenceAlias Property Alias_ShooterMarker Auto Const Mandatory ReferenceAlias Property Alias_TargetMarker Auto Const Mandatory ReferenceAlias Property Alias_Shooter Auto Const Mandatory ReferenceAlias Property Alias_Target Auto Const Mandatory ReferenceAlias Property Alias_ThisWeapon Auto Const Mandatory EndGroup LeveledItem ThisLeveledItem Weapon ThisWeapon Int ThisWeaponMods Int Perks Int ThisWeaponIndex String ThisWeaponName ;******************************************************************************************** Event OnQuestInit() ; startquest SKK_toolsWeaponsQuest Debug.Trace("SKK_toolsWeaponsScript.OnQuestInit") Utility.Wait(3.0) StartTest() EndEvent ;******************************************************************************************** Function StartTest() Debug.Trace("SKK_toolsWeaponsScript.StartTest") Debug.Notification("Weapon Damage test START") ObjectReference ThisREF ThisRef = Alias_Container.GetReference().PlaceAtMe(pXmarker) ThisRef.MoveTo(ThisRef,100.0, 100.0, 16.0) ThisRef.SetAngle(ThisRef.GetAngleX(), ThisRef.GetAngleY(), (ThisRef.GetAngleZ() + ThisRef.GetHeadingAngle(Alias_Container.GetReference())) ) Alias_ShooterMarker.ForceRefTo(ThisRef) ThisRef = Alias_Container.GetReference().PlaceAtMe(pXmarker) ThisRef.MoveTo(ThisRef,-100.0, -100.0, 16.0) ThisRef.SetAngle(ThisRef.GetAngleX(), ThisRef.GetAngleY(), (ThisRef.GetAngleZ() + ThisRef.GetHeadingAngle(Alias_Container.GetReference())) ) Alias_TargetMarker.ForceRefTo(ThisRef) ThisREF = Alias_ShooterMarker.GetReference().PlaceActorAtMe(pWorkshopNPC, aiLevelMod = 4, akZone = None) Alias_Shooter.ForcerefTo(ThisREF) ThisREF = Alias_TargetMarker.GetReference().PlaceActorAtMe(pWorkshopNPC, aiLevelMod = 4, akZone = None) Alias_Target.ForcerefTo(ThisREF) Actor ThisShooter = Alias_Shooter.GetActorReference() Actor ThisTarget = Alias_Target.GetActorReference() Alias_Container.TryToDisable() ;so actors cant loot it ThisShooter.RemoveFromAllFactions() ThisTarget.RemoveFromAllFactions() ThisShooter.AddToFaction(pSKK_toolsWeaponsFactionA) ThisTarget.AddToFaction(pSKK_toolsWeaponsFactionB) ThisShooter.SetValue(pHealth, 100) ThisShooter.SetValue(pPerception, 10) ThisShooter.SetCombatStyle(csRaiderRangedOffenseHigh) ThisShooter.SetOutfit(pSKK_toolsWeaponsOutfit, false) ThisShooter.UnequipAll() ThisShooter.RemoveAllItems() ThisShooter.AddItem(pArmor_Highschool_UnderArmor) ThisShooter.EquipItem(pArmor_Highschool_UnderArmor, abPreventRemoval = true, abSilent = true) ThisTarget.SetValue(pHealth, 100) ThisTarget.IgnoreFriendlyHits(TRUE) ThisTarget.SetNoBleedOutRecovery(TRUE) ThisTarget.SetEssential(False) ThisTarget.SetProtected(False) ThisTarget.SetRestrained(TRUE) ThisTarget.SetOutfit(pSKK_toolsWeaponsOutfit, false) ThisTarget.UnequipAll() ThisTarget.RemoveAllItems() ThisTarget.AddItem(pArmor_Highschool_UnderArmor, 1, abSilent =true) ThisTarget.EquipItem(pArmor_Highschool_UnderArmor, abPreventRemoval = true, abSilent = true) Int iIndex = 0 While iIndex < pSKK_toolsWeaponsAMMOList.GetSize() Ammo ThisAmmo = pSKK_toolsWeaponsAMMOList.getAt(iIndex) as Ammo ThisShooter.AddItem(ThisAmmo, 1, abSilent = true) iIndex +=1 EndWhile ThisWeaponIndex = 0 ThisWeaponMods = 0 Perks = 0 TestWeapon() EndFunction ;******************************************************************************************** Function TestWeapon() ;Debug.Trace("SKK_toolsWeaponsScript.TestWeapon " + ThisWeaponIndex) Actor ThisShooter = Alias_Shooter.GetActorReference() Actor ThisTarget = Alias_Target.GetActorReference() ThisTarget.ResetHealthandLimbs() If ThisWeaponIndex < pSKK_toolsWeaponsWEAPList.GetSize() If (ThisWeaponIndex == 0) ThisWeaponName = "PipeGun" Elseif (ThisWeaponIndex == 1) ThisWeaponName = "10mm" Elseif (ThisWeaponIndex == 2) ThisWeaponName = "PipeRevolver" Elseif (ThisWeaponIndex == 3) ThisWeaponName = ".44" Elseif (ThisWeaponIndex == 4) ThisWeaponName = "PipeBolt" Elseif (ThisWeaponIndex == 5) ThisWeaponName = "Laser" Elseif (ThisWeaponIndex == 6) ThisWeaponName = "HuntingRifle" Elseif (ThisWeaponIndex == 7) ThisWeaponName = "CombatRifle" Elseif (ThisWeaponIndex == 8) ThisWeaponName = "AssaultRifle" Else ThisWeaponName = "Unknown" EndIf ThisShooter.RemovePerk(pGunslinger01) ThisShooter.RemovePerk(pRifleman01) If (ThisWeaponMods == 0) && (Perks == 0) ThisLeveledItem = pSKK_toolsWeaponsWEAPList.getAt(ThisWeaponIndex) as LeveledItem ObjectReference ThisItem = ThisShooter.PlaceAtMe(ThisLeveledItem) Alias_ThisWeapon.ForceRefTo(ThisItem) ThisWeapon = ThisItem.GetBaseObject() as Weapon ThisShooter.AddItem(ThisItem, 1, abSilent = true) ElseIf (ThisWeaponMods == 1) && (Perks == 0) ObjectMod ThisMOD = pSKK_toolsWeaponsOMODList.getAt(ThisWeaponIndex) as ObjectMod ThisShooter.UnequipItem(ThisWeapon) ThisShooter.AttachModToInventoryItem(ThisWeapon, ThisMOD) ThisWeaponName = ThisWeaponName + " Powerful" ElseIf (Perks == 1) ThisShooter.AddPerk(pGunslinger01) ThisShooter.AddPerk(pRifleman01) ThisWeaponName = ThisWeaponName + " Perks" EndIf ThisShooter.EquipItem(ThisWeapon) ThisShooter.DrawWeapon() Self.RegisterForHitEvent(ThisTarget) pSKK_toolsWeaponsFactionA.SetEnemy(pSKK_toolsWeaponsFactionB, abSelfIsNeutralToOther = false, abOtherIsNeutralToSelf = true) ThisShooter.StartCombat(ThisTarget, abPreferredTarget = true) Else Debug.Trace("SKK_toolsWeaponsScript END") Debug.Notification("Weapon Damage test END") ThisTarget.SetRestrained(FALSE) Alias_Container.TryToEnable() Endif EndFunction ;******************************************************************************************** Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) pSKK_toolsWeaponsFactionA.SetAlly(pSKK_toolsWeaponsFactionB, abSelfIsFriendToOther = false, abOtherIsFriendToSelf = false) (akAggressor as Actor).StopCombat() Float fDistance = akAggressor.GetDistance(akTarget) Float fDamage = (akTarget.GetBaseValue(pHealth) - akTarget.getValue(pHealth)) Debug.Trace ("SKK_toolsWeaponsScript," + ThisWeaponIndex + "," + (akTarget as Actor).GetActorBase() + ",Health," + akTarget.getValue(pHealth) as Int + "/" + akTarget.GetBaseValue(pHealth) as Int + ",Damage," + fDamage as Int + ",Distance," + fDistance as Int + "," + ThisWeapon + "," + ThisWeaponName + ",OMOD," + ThisWeaponMods + ",Perks," + Perks ) If (ThisWeaponMods == 0) && (Perks == 0) pSKK_toolsWeaponsMessageBase.Show(ThisWeaponIndex, fDamage) ;[%.0f] <alias=ThisWeapon> damage %.0f ElseIf (ThisWeaponMods == 0) && (Perks == 1) pSKK_toolsWeaponsMessagePerks.Show(ThisWeaponIndex, fDamage) ;[%.0f] <alias=ThisWeapon> damage %.0f with perks ElseIf (ThisWeaponMods == 1) && (Perks == 0) pSKK_toolsWeaponsMessageMods.Show(ThisWeaponIndex, fDamage) ;[%.0f] <alias=ThisWeapon> damage %.0f with mods EndIf (akAggressor as Actor).Evaluatepackage() (akTarget as Actor).ResetHealthandLimbs() Utility.Wait(3.0) If (ThisWeaponMods == 0) && (Perks == 0) Perks += 1 ElseIf (ThisWeaponMods == 0) && (Perks == 1) Perks = 0 ThisWeaponMods +=1 Else Alias_ThisWeapon.Clear() (akAggressor as Actor).UnequipItem(ThisWeapon) akAggressor.RemoveItem(ThisWeapon,1,TRUE, Alias_Container.GetReference()) Perks = 0 ThisWeaponMods = 0 ThisWeaponIndex +=1 EndIf TestWeapon() EndEvent ;******************************************************************************************** edit: disposable script added, because why not. Edited April 9, 2019 by SKK50 Link to comment Share on other sites More sharing options...
HadToRegister Posted April 9, 2019 Share Posted April 9, 2019 How are you doing that?By giving them the different levels of Gunslinger and Rfilemen perks to increase their output damage? Link to comment Share on other sites More sharing options...
SKKmods Posted April 9, 2019 Author Share Posted April 9, 2019 Pop the spoiler script open to see, but yes the perk test step adds Gunslinger01 and Rifleman01. I already do that for companions in the Companion Auto Upgrade mod, wasn't sure if damage perks would apply to generic non unique actors. They do. Link to comment Share on other sites More sharing options...
HadToRegister Posted April 9, 2019 Share Posted April 9, 2019 Oh cool, so you can add gunslinger02, 03 and 04 the higher they go in level Link to comment Share on other sites More sharing options...
SKKmods Posted April 9, 2019 Author Share Posted April 9, 2019 Yes that's exactly what CompanionAutoUpgrade does, but in line with player level and perks as the NPC actors themselves don't actually level. I will probably be adding the same player level indexed perks to Combat Settlers health leveling, that's simple. Testing the impact of 30 settlers configured with a heap of perks in combat with 64 hostiles is the challenge to ensure a quality experience. Link to comment Share on other sites More sharing options...
Recommended Posts