Jump to content

NPC grows his own beard but won't trim/shave


ThoraldGM

Recommended Posts

BACKGROUND: I have the beard growing in location change event for testing. Script is on Scavver NPC who executes a sweep package with find/acquire procedures. The FormList is a list of headparts dragged in CK, facial hair ranging from 0 (light scruff, "Hard Road") to 6 (bushiest, "Doomsday Prepped").


TLDR: The beard grows one time from short to full. Then the index numbers and beards are supposed to recycle from the beginning of the FormList.


PROBLEM: The numbers recycle according to MessageBox flags, but the beard stays stuck on the bushiest headpart.


Known facts from extensive tests:


- Changing NextIndex from 0 to 1 (when NowIndex is 6) didn't fix anything

- Beards start in correct slot on fresh saves

- Beards progress to #7 beard on fresh saves

- Beards NEVER change from #7 to #1 (but the index number resets as expected)

- Reloading any save that hit #7 beard has #7 beard forever,

despite the global variable cycling correctly per MsgBox


Relevant code:




GlobalVariable Property pgvScavverScruffStage Auto Mandatory
; Current facial hair

FormList Property pScavverScruffList Auto Const Mandatory
; List of facial hair growth parts

Event OnLocationChange(Location akOldLoc, Location akNewLoc)
int MaxAmmo = 50
int AmmoCount
float NowIndex = pgvScavverScruffStage.GetValue()
float NextIndex = NowIndex + 1


If(pgvScavverStatusSniffer.GetValue() == 1)
Debug.Notification("Scavver changed location.")
Utility.Wait(1)
EndIf


If NowIndex == 6 ; If current facial hair is last in the list (of 7 entries) ...
NextIndex = 1 ; Set next facial hair to the first entry (actually to 2nd for testing)
EndIf


pScavverActor.ChangeHeadPart((pScavverScruffList.GetAt((NowIndex as Int)) as HeadPart), True) ; Remove current facial hair
pScavverActor.ChangeHeadPart((pScavverScruffList.GetAt((NextIndex as Int))) as HeadPart) ; Add the next facial hair
pgvScavverScruffStage.SetValue(NextIndex) ; Update global to new facial hair
Debug.MessageBox("BEARD IS NOW: " + NextIndex)
...
EndEvent


No errors displayed in compiler or in Papyrus.0 debug log.


When I come out of 111 with hand blocking sunlight, global variable goes from 0 to 1 every time. (because Scavver stepped from world into trailer)


SCREENSHOTS:


http://i.imgur.com/EykDxl2.png


http://i.imgur.com/csHPkGp.png


http://i.imgur.com/q9xgYr3.png


I need a fresh set of eyes to look this over for logic errors. Or is there something about that particular beard that makes it "stick"?


Thanks for looking.

Link to comment
Share on other sites

Turns out all I needed was one more "true" to remove extra parts that connect beard to hairline. Apparently, the extra part is a duplicate beard layer which is why it looked like the beard was "sticking". (Solved by GeneralLuBu in Discord chat)

pScavverActor.ChangeHeadPart((pScavverScruffList.GetAt((NowIndex as Int)) as HeadPart), true, true)
; Remove current facial hair

Scavver now starts his beard cycle over (trims/shaves) when he reaches the end of it :-)

 

 

http://i.imgur.com/GgtYo24.png

Link to comment
Share on other sites

  • Recently Browsing   0 members

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