I found a workaround, using EquipItem instead of AddItem would not cause the reset, the problem I had was that I couldn't just applied it to every NPC, because it would make Provisioners and Guards to equip another ammo and use it, and that messes with their equipped weapons So I found a Function BrendonLeCount made in this topic: https://forums.nexusmods.com/index.php?/topic/5892563-check-settlers-role-via-script/ That identifies each npc as Farmers, Guards, or Provisioners And with that I restricted the script to work only on settlers that aren't Provisioners or Guards I know, its super specific Here's how the function ended up, in case anyone need it:
Scriptname LucasScript extends Quest
Keyword Property ActorTypeNPC Auto
Ammo Property AMagazine_Ammo_38Caliber_Small Auto
Function GiveAmmoMag38()
ObjectReference PlayerREF = Game.GetPlayer() as ObjectReference
ObjectReference[] kActorArray = PlayerREF.FindAllReferencesWithKeyword(ActorTypeNPC, 900000.0)
ObjectReference npc
int i = 0
If kActorArray.Length > 0
While (i < kActorArray.Length)
npc = kActorArray[i] as Actor
Actor npc2
npc2 = npc as Actor
If (npc2 Is WorkshopNPCScript)
If (GetJobIndex(npc2 as WorkshopNPCScript) != 3 && GetJobIndex(npc2 as WorkshopNPCScript) != 1)
npc2.EquipItem(AMagazine_Ammo_38Caliber_Small, False, True)
EndIf
EndIf
i = i + 1
EndWhile
EndIf
EndFunction
WorkshopParentScript Property WorkshopParent Auto
RefCollectionAlias Property CaravanActors Auto
int Function GetJobIndex(WorkshopNPCScript akNPC)
; 0 - unassigned
; 1 - guard
; 2 - scavenger
; 3 - provisioner
; 4 - farmer
; 5 - merchant (and phoropter tech? soda jerk? power cyclist?)
If akNPC.bIsWorker
If akNPC.bIsGuard
return 1 ; 1 - Guard
ElseIf akNPC.bIsScavenger
return 2 ; 2 - Scavenger
Else
If akNPC.assignedMultiResource == WorkshopParent.WorkshopRatings[WorkshopParent.WorkshopRatingFood].resourceValue
return 4 ; 4 - farmer
Else
return 5 ; 5 - merchant or other
EndIf
EndIf
Else
If CaravanActors.Find(akNPC) >= 0
return 3 ; 3 - provisioner
Else
return 0 ; 0 - unassigned
EndIf
EndIf
EndFunction