Jump to content

lukandroll

Members
  • Posts

    5
  • Joined

  • Last visited

Nexus Mods Profile

About lukandroll

lukandroll's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm trying to use this script, however, unassigned settlers are flagged as provisioners, I also tried using CaravanActorAliases col ref, same resultsI can't find a way to identify why these unassigned settlers are in the CaravanAactors col refCould it be that these settlers have been moved from another settlement, so they were added to the CaravanActors ref col?
  2. 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
  3. Lol, silly function So you have to loop through the actor items and copy them to a temp container, add the new item to the temp container, but then how do you replace the actor items with the temp container without triggering the reset?
  4. Thanks, I found out what the problem was I haven't had my properties initialized as the objects they were in the Properties window of the script Now it looks like this: Also I had the ammot declared as a MiscObject, that was wrong also, I declared as a Ammo now The now working script looks like this: 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 as Form, 900000.0) ObjectReference npc int i = 0 If kActorArray.Length > 0 While (i < kActorArray.Length) npc = kActorArray[i] npc.AddItem(AMagazine_Ammo_38Caliber_Small) i = i + 1 EndWhile EndIf EndFunction However, there is a problem, the AddItem is reseting the NPC equiped items, so all my provisioners and guards now are wearing their default clothes and weapons Is there anything I can do to prevent this?
  5. Hi, I'm new to the ck and scripting and I'm trying to run a script that will add a custom ammo type to all humans npcs in the area This is the script: Scriptname LucasScript extends Quest Keyword Property ActorTypeNPC AutoMiscObject Property AMagazine_Ammo_38Caliber_Small Auto Function LucasScript() ObjectReference[] kActorArray = Game.GetPlayer().FindAllReferencesWithKeyword(ActorTypeNPC, 900.0) ObjectReference npc int i = 0 If kActorArray.Length > 0 While (i < kActorArray.Length) npc = kActorArray npc.AddItem(AMagazine_Ammo_38Caliber_Small) i = i + 1 EndWhile EndIf EndFunction I get this error on the papyrus log however:error: None or invalid form passed in to FindAllReferencesWithKeyword Seems like a problem with the ActorTypeNPC propertyBut I don't know how to declare it since I know nothing about the framework and its objectsCould anyone point me out on what I'm doing wrong?
×
×
  • Create New...