Jump to content

Additem to an actor resets their outfit


SKKmods

Recommended Posts

Having an issue that whenever a script tries to AddItem() weapons (or armor) to a human NPC actor they reset to their default outfit which causes any armor to unequip, even if the base outfit is valid underarmor. Even happens from the console.

 

Any known workarounds, or scripts that will find and re-equip inventory armor (that don't depend on F4SE) ?

 

Edit: trying to use an intermediate container suffers the same issue:

TargetContainer.RemoveItem(BestWeapon, aiCount = 1, abSilent = True, akOtherContainer = ThisActor) 
Edited by SKK50
Link to comment
Share on other sites

Interesting. I'm using FXEquipItemOnEffectScript, which does equip an armor base item without adding it explicitly, and it's fine. But later it does remove the equipped item without unequipping first, and that resets the NPC's outfit to default.

Maybe, quest alias inventory drop should be ok, if adding an item is that neccessary?

Edited by hereami
Link to comment
Share on other sites

Unfortunately the weapon to add could be any weapon base depending on what is found after combat, so using a static alias inventory add (or replicating hundreds of them and ignoring dynamic content like DLC and mod added weapons) is not practical.

Link to comment
Share on other sites

That's great, but doesn't help re-equip random bits of clothing and armor settlers may have been dwessed up in. That will clearly destroy settlement immersHun and make me a bad mod author.

 

Amusingly even paid for CC content (Ambush kit shooting range) suffers this outfit reset issue, so its baked right in to the platform.

 

The horrible solution so far is to iterate through a bunch of armor type formlists checking GetItemCount(ThisList) and then GetItemCount(ThisArmor) to EquipItem(ThisArmor) on any hits.

 

Horrible as that takes ~5 seconds to process 120 common armor elements per settler. Multiplied by say 30 surviving settlers exiting combat at the same time and the script falls well behind real time events.

 

I have tried to parallelise by creating (say 30) multi-thread worker scripts and CallFunctionNoWait() on them, but it's that sort of cleverness that starts to grab an unfair share of the papyrus environment resources leading to induce lag. Bad mod author :(

Link to comment
Share on other sites

This is a settler just recovered from bleedout scanning for weapons, adding the best one (2 seconds) which triggers default outfit reset. Then it takes 3 seconds to scan inventory against the armor lists to find the single layer spike armor re-equip :( A settler with base + 5 pieces + hat takes 6 seconds:

 

https://youtu.be/QhBinWC_Lf0?t=122

Link to comment
Share on other sites

 

any weapon base depending on what is found after combat

So, does it happen, when an Actor grabs a weapon/armor by own decision - e.g. Find, followed by Acquire proc.? I've made'em to scavenge for caps/ammo, and i think, those, who were looking for weapons in another mod, also didn't change their outfit on Acquire, need to check though, i didn't focus on that.

Link to comment
Share on other sites

The base game actor weapon scavenge and upgrade process does not trigger an outfit reset, I observe it is specifically:

 

Actor.AddItem() or RemoveItem(akOtherContainer = Actor) with Weapons or Armor.

 

I have not used find/acquire packages because of consistency issues (the overhead of defensive watchdog timer and event registration management to unstick complex packages), so don't know if that triggers the reset.

 

This is the "official" caviat on my mod:

 

(5) Due to a base game issue, the post combat weapons collect and upgrade process is extremely script intensive. It can take up to 5 seconds per settler to complete (that is a LONG time) so do not enable of you have fps or lag issues. The issue is that the game triggers actors to reset to their default outfit when a weapon is added to their inventory, so this mod has to find and re-equip most base game or DLC armor in their inventory. It does not know about mod added armor to re-equip. If your settlers are dwessup dollies, don't use this function.
Also note that if settlers are set to bleedout they are regarded as corpses by other actors, so their weapons can be looted by the base game auto upgrade process. You will notice obvious stuff like miniguns transferring between actors as they loot each other.
Edited by SKK50
Link to comment
Share on other sites

 

I have not used find/acquire packages because of consistency issues (the overhead of defensive watchdog timer and event registration management to unstick complex packages), so don't know if that triggers the reset.

Hm, look. Acquire doesn't cause any reset, from what i can observe, now i'm just interested. Could be done like following.

- Assuming the managing script knows about the exact target actor and the weapon ref ID, "found" by him;

- A package with a single proc Acquire (Travel - optionally), which has Target type of LinkedRef, that is assigned by script as required to point to the found item;

- Package may have a condition to run, if HasLinkedRef or not - depends on where the package resides;

- Package may be inserted at top of general stack or a special quest with highest priority may contain it;

- When both the actor and item are determined, the script sets LinkedRef on Actor and Forces him into an alias (or collection), containing the Acquire package;

- Here the managing script's job is done and actor is "freed";

- Actor obtains the Ref by "his own decision";

- Two ways next:

1) RefAlias script, residing on the same alias as package, which removes the Actor from the alias (collection) and clears the LinkedRef, when the item is acquired (OnItemAdded, GetIsReference==myFoundItem);

2) Package fragment OnEnd/OnChange, doing the same cleanup - assuming the package ends/changes well, when the Acquire proc completes;

 

Safety timeout may be added to handle the case, if proc stucks (can happen, if item is too far, inaccessible, bad pathfinding or else).

 

And still, does immediate EquipItem() cause too much troubles even for now, as mentioned in Skyrim's wikia? But also it's said to be able to equip RefId rarther than Base form only (forced alias ref, in worst case). After all, it's very natural to equip a new shiny toy at once.

Link to comment
Share on other sites

unfortunately actors end up stealing each others weapons because of the base game auto scan and upgrade process that kicks in on combatstatechange, which is what you see in the video with jun stealing sturges minigun.

 

Plus every package needs an ondistancelessthan watchdog as well as a timeout, because too many packages get stuck when done at scale (consider there can be up to 127 settlers all looking to upgrade weapons). I already use linkref packages for all settlers finding power armor, once there are more than 20 active things get messy.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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