Jump to content

Script to equip an associated item


SAC020

Recommended Posts

I would like to write a script which identifies the outfit an NPC is wearing, and equips an alternate, non-replacer (!) version.

 

Something like "if, on event, NPC is wearing the vanilla undershirt and jeans, then unequip it, and equip my own version of (non-replacer) undershirt and jeans"

 

Yes, I can hardcode the associations, exactly as written above, using the nominal base ids of the outfits, but I would prefer something more elegant than that. Something like a relationship / lookup table, if that concept even exists in papyrus.

Link to comment
Share on other sites

I just did this with a formlist of dirty clothes and a formlist of clean clothes. I made sure to put both items in the pair at the same index numbers when filling the lists via drag/drop in the Creation Kit. See lines 42 & 111: https://pastebin.com/W6i4K5fa

 

Wow, thank you very much! I am just now discovering form lists.

 

What happens if you don't have a "clean" version for every "dirty" version? Can you have placeholders? Or you put the "dirty" version at the same index in both lists?

Link to comment
Share on other sites

On line 87, I assign what player placed in washer as the outgoing item. On line 113, I overwrite the outgoing item with the found clean version. On line 116, I send the outgoing item to dryer regardless of whether it was overwritten. So the end result is dryer gets the clean version or the original* item player put in washer.

 

* (Stripped of omods, but that's an issue for another post.)

 

I think that's what you are asking. If not, let me know.

 

Also here are the available formlist functions: https://www.creationkit.com/fallout4/index.php?title=FormList_Script

Link to comment
Share on other sites

Let's say you have list A and list B. A has 30 items, but B only has 25 for some reason. If you use a loop to step through (iterate) A 1-30 (array indexes), then try to do something concurrently to B 1-30... you will throw an error because B only has 25 elements and you are asking B for 26 through 30.
Link to comment
Share on other sites

Let's say you have list A and list B. A has 30 items, but B only has 25 for some reason. If you use a loop to step through (iterate) A 1-30 (array indexes), then try to do something concurrently to B 1-30... you will throw an error because B only has 25 elements and you are asking B for 26 through 30.

I am just discovering form lists now, so I am slowly experimenting :)

 

What I achieved so far: created and populated a form list, and successfully equipped random items from the form list to the NPCs on a scripted event. Excellent progress! (for me :) )

 

Next steps that I need to figure out:

- to detect what clothes (under armor, or nude body, if under armor is not present) the NPC is wearing

- if I have a corresponding outfit in my form list (since I haven't replicated all outfits in game), replace theirs with mine

- if not, keep their own (without crashing, preferably)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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