Jump to content

Need ideas for distributing items to NPCs


6Sfool

Recommended Posts

For a while I've been using body mods with armor refits. I decided a while ago to try my own hand at an armor overhaul, and I'd say I've gotten pretty good at mashing up different clothing refits in Outfit Studio. Then I had the idea to split the cuirasses into a top and bottom half, making them more modular but not annoyingly so. Previously I just hijacked the outfit framework from vanilla, Immersive Armors, and even Dynamic Outfits with good results, but now that the cuirass requires another part I have to create my own mod.

I'm almost finished a mod with more than 80 items including pants, underwear, and leggings. All are female only because I don't feel like putting in the work to make males modular. Some I intend to just make craftable (easy), others I will patch into mods like Sleep Tight (less easy), but for most of the NPCs I encounter I need to add through other methods. I've considered different ways of distributing the outfits to NPCs, each with their own pros/cons:

 

1. Spell Perk Item Distributor. This mod seems like an easy and lightweight way to give the items out (and to females only too), but in practice I see it will be more difficult. For one it mostly relies on distribution by skill level and not by other methods I hoped to hook into such as equipped torso. It also seems that the clothes will most likely not equip when distributed, that's a dealbreaker.

2. Cloak spell with add/equipitem. Hoping I don't have to use that, my scripting knowledge is nonexistent, and my skills in applying these spells are no better. Also they get a bad name for causing various issues, I'm not a fan of the implementation of many cloak spells by even great mods.

3. Direct outfit edits. I saw the LE mod Underwear For All uses this with good success, and while it might be tedious to edit all the outfit lists by hand and fix possible mod conflicts, it sounds doable, and it gives me the most freedom to choose the outfit combo. I will probably go with this.

 

Only, I'd rather not see that every male NPC I loot is wearing women's underwear, regardless of whether they have the armoraddon to show it. I thought about distributing the clothing using method 3 and removing the items by keyword from males on something like a death event, but even with this method I need some help with setting that up (and it sounds like a cloak spell).

 

Does anyone have any simpler ideas? I'm in over my head.

Link to comment
Share on other sites

If you make a male variant for each female piece that uses the normal body slots, then the males should have those and hopefully be wearing them. As far as the female only pieces that use non-standard body slots, you can attach a small script to the armor record that would remove them from males if they should be added by accident (including the player if you wanted). Something like:

 

 

ScriptName LimitArmorToFemaleScript Extends ObjectReference
;attach directly to the armor record

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
  If akNewContainer as Actor ; did we just get put into an actor inventory
    ActorBase myActorBase = (akNewContainer as Actor).GetActorBase()
    If myActorBase.GetSex() == 1 ; added to female - stick around
      Return
    Else
      ; if wanting to allow male players to carry female pieces 
      ; un-comment the following condition statement and its corresponding endif
      ;If akNewContainer as Actor != Game.GetPlayer()
        ; added to male or non-gender character - remove and sent to the void
        akNewContainer.RemoveItem(Self as ObjectReference,1,true)
      ;EndIf
    EndIf
  EndIf
EndEvent 

 

Or you can give male characters something else instead of extra modular pieces of armor and skip the script. Perhaps a cloak, backpack or other thing from a resource mod.

 

As far as distribution goes, you can add the armors to leveled lists via script for the most compatibility with other mods. This is how Immersive Armors handles most of their armors.

Link to comment
Share on other sites

Thank you, that's exactly what I'm looking for. It would be easy to just make a generic .nif for males so that the items reflected that they were equipped without looking ridiculous, but I had to make the item names so androgynous that they were no longer clear what they were. So I will assume that this script runs even if an actor first spawns with this as part of their outfit, correct? A quick google search didn't turn up any details.

Link to comment
Share on other sites

If the armor is already assigned to the actor or actor base prior to loading, then no the OnContainerChanged event will not run. You can perform a similar treatment with the OnEquipped event should an item be equipped by the actor, but it wouldn't do anything for actors who do not equip the armor. And as far as outfits go, I honestly do not know. You'd have to test to see what happens. Hopefully the worst that you will have is the occasional male with a fetish for carrying around female clothing but not wearing it.

Link to comment
Share on other sites

Tweaked it to work on equip in the hopes that it works for outfits.

I tested by adding the script to an item then adding the item to the Blacksmith01 outfit. I visited Adrianne and Alvor on a new save - they both had the item equipped. The resetinventory command also did not remove the item from Alvor, so either my edited script has some errors or outfits don't fire the script. Also tried to equip the item on a male player character, it let me.

 

 

ScriptName LimitToFemaleScript Extends ObjectReference
;attach directly to the armor record

Event Event OnEquipped(Actor akActor)
ActorBase myActorBase = akActor.GetActorBase()
If myActorBase.GetSex() == 1 ; added to female - stick around
Return
Else
; if wanting to allow male players to carry female pieces
; un-comment the following condition statement and its corresponding endif
;If akActor != Game.GetPlayer()
; added to male or non-gender character - remove and sent to the void
akActor.RemoveItem(Self as ObjectReference,1,true)
;EndIf
EndIf

EndEvent

 

 

I tried to change it back to the script you provided (using edit source menu) and test whether my changes were the issue, but CK threw an error saying it failed to compile the script.

I'll have another crack at it later.

Link to comment
Share on other sites

If you added the item to the outfit, it won't get removed with resetinventory.

 

As far as not working with the player, I do not know. It is known that some things on a script do not run when the item holding the script is within an inventory or container. The OnEquipped event is one of those things that does indeed work. But it might be possible that RemoveItem is a function that cannot be used in such a scenario. More testing might be needed in that regard.

 

The smarter thing tho would be to figure out a way to add the gender specific items to the correct gender NPCs. Perhaps an SSEEdit script could be written to parse the player's load order and spread the items about. It would require that the user run the script on their own specific set up, however.

Link to comment
Share on other sites

I think I'm going to change directions like you suggested, controlling who receives items rather than who they get taken from. Working on a cloak spell right now.

At this point I'm just thinking out loud. I'd attach a magic effect with a script to check for keywords on their chest slot like armormaterial. Depending on the material or whether they are wearing clothingrich or clothingpoor tags, I would add new items from different leveled lists. I'm just not sure what the nuances are to this approach, such as how often this script will apply to each NPC.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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