Jump to content

NPC reset bug (Clothing reverts to default) - NOT the equipitem bug.


PJMail

Recommended Posts

UNFORTUNATELY When I create the NPC it still resets on unload, even if I transfer and equip a new outfit via script.

HOWEVER, if I manually transfer and equip something on the NPC (via containermenu) it DOESNT reset.

 

Is there no way to lock their inventory without having to manually make a change?

 

Not that I don't know of.. maybe through F4SE, by playing with the native actor inventory event's event source.

 

Also the NPC's ActorBase is always the NPC I use as the Template (it does not create a new FF template even though I use Lchar Traits)

 

I meant the GetLeveledActorBase(). If the Default Template and of the Template Form point to an LChar, the game creates a "leveled actor base" for the actor (see FF02B3DE in the log below).

 

LeveledActorBase is created from the actor's GetActorBase() and the template data of the randomly picked actor base from the LChar.

 

 

Now with equip data ((E) = equipped in the log), I rerun the tests but only in cell A) this time. I focused on two NPCs..

 

For "FirstTestNPC" (whose Default Template AND Template Form "Traits" = LCharRaiderFaceAndGender ), the output was:

 

Before CellReset:

[09/25/2023 - 01:32:35PM]  FindAll :: looping :: LoopActor [Actor: [Actor < (3B000FD5)>]]. [DisplayName: Test_DefTemplTraits]. [ActorBase: [ActorBase < (3B000FB4)>]]. [ActorBaseName: Test_DefTemplTraits]. [LeveledActorBase: [ActorBase < (FF02B3DE)>]]. [LeveledActorBaseName: Test_DefTemplTraits]. [FaceTemplate: [ActorBase <<nullptr form> (FF000800)>]]. [FaceTemplateName: ]...
[09/25/2023 - 01:32:35PM]  PrintInventoryItems ==> [["Harness (1)", "Scavenger Outfit (1) (E)", "Gray Knit Cap (1) (E)", "Bottlecap (4)", "Corn (1)", "Pipe Pistol (1) (E)", ".38 Round (14)"]].

After CellReset:

[09/25/2023 - 01:35:44PM]  FindAll :: looping :: LoopActor [Actor: [Actor < (3B000FD5)>]]. [DisplayName: Test_DefTemplTraits]. [ActorBase: [ActorBase < (3B000FB4)>]]. [ActorBaseName: Test_DefTemplTraits]. [LeveledActorBase: [ActorBase < (FF02B3DE)>]]. [LeveledActorBaseName: Test_DefTemplTraits]. [FaceTemplate: [ActorBase <<nullptr form> (FF000800)>]]. [FaceTemplateName: ]...
[09/25/2023 - 01:35:44PM]  PrintInventoryItems ==> [[".38 Round (14)", "Pipe Pistol (1) (E)", "Corn (1)", "Bottlecap (4)", "Surveyor Outfit (1) (E)"]].

Their face template actor base was broken ( for non-LChar Traits templated actors, it's working just fine ) and inventory with equip data got reset. So the game keeps their facial data somewhere else, not in the same variable that non-LChar Traits templated actors use.

 

 

1) NPCs' inventories:

 

The ones whose inventories contained only forms that weren't packed in LeveledItems ( so they had fixed items like PrintInventoryItems ==> [["Blowtorch (1)", "Tinker Headgear (1) (E)", "Utility Coveralls (1) (E)"]] for example ) kept their editor-set inventory and equip data. Inventories filled with LeveledItems were reset (including their equip data which is expected after an inventory reset). Other factors didn't affect this.

 

2) NPCs' faces:

 

Interestingly, only those NPCs' faces got reset on CellReset whose facial data were inherited form an ingame created ActorBase form ( their BaseID starts with 0xFF ) that was set to Respawn. FirstTestNPC was Protected but no other actor base flags were set. Their face did not change and I performed multiple CellReset due to the following...

 

I didn't know the Respawn flag can trigger such behavior, so I decided to hook up native Papyrus functions IsRespawns() and SetIsRespawns() to the virtual machine through the script extender..

 

Setting FirstTestNPC.GetActorBase() to Respawn didn't change anything: on CellReset, they kept their face and gender.

 

However, when I performed the CellReset after ( GardenOfEden.SetIsRespawns(FirstTestNPC.GetLeveledActorBase, True) ), on the next CellReset, their face and gender data changed.

 

Then, I choose another NPC ("SecondTestNPC") who, unlike FirstTestNPC, was set to Respawn in the editor but all other data was matching FirstTestNPC's. I set SecondTestNPC's LeveledActorBase to non-Respawn with SetIsRespawn(abRespawn = false) and.... their face didn't get reset. (Their inventory still did, by the way).

 

 

After some further testing, I found that the reason why the Respawn flag causes the faces of LChar Traits templated NPCs to get reset on CellReset is because the game destructs the previously created LeveledActorBase form when it initializes the actor's 3D if that takes place in a Cell that has been marked for reset.

 

For example, if one has a Persistent actor refererence ( whose base data is loaded by the game's data handler upon loading the game and not when they get within 10000 game units to the player ) and one MoveTo this actor to the player, the actor's face won't get reset and their LeveledActorBase won't be removed because the actor's 3D will be initialized in a cell that cannot be reset as it's already loaded ( in the example, it is = Game.GetPlayer().GetParentCell() ).

 

However, if the player travels to a marked for reset Cell and the actor's 3D is initialized in that cell, upon loading the actor ( which is preceeded by the CellReset as references must wait until the cell is fully loaded before their 3D could be initialized ), their LeveledActorBase is removed which triggers a full Traits data reevaluation ( can result in different face and gender, depending on the randomly selected actor base from the LChar: this means the Traits reset is not guaranteed to be visually noticable ingame, for example when the system selects the previously selected one again ).

 

 

Whether it is by design or a bug, I don't know...

 

 

Quite unrelated but as far as game anomalies go, one of recent ones I noticed that the ( native, non-F4SE ) ObjectReference script functions, GetInventoryValue() doesn't calculate the dropped weapon of a killed actor in the inventory value, unless: the actor was killed with a holstered weapon ELSE IF the player approaches then faces toward the body so the HUDMenu renders the inventory list of the actor ( the item list panel on the right side ).

 

Turning away ( which makes the inventory list invisible ) immediatelly "breaks" the function because the returned value is less than the "real value" by the value of the dropped weapon instance...

Edited by LarannKiar
Link to comment
Share on other sites

  • 4 weeks later...

Getting nowhere here - one step forward, 2 steps back...

LarannKiar - how do you create an NPC without any leveled list/ templates?

 

I have an actorbase fully configured (no templates used) - it displays fine in CK, but when I create an Actor from it (either via placeatme or placeactoratme) they are either a random nude NPC OR a random fully dressed "Settler". Basically everything I specified in the NPC record is ignored.

 

How do I create an Actor with everything predefined? I am trying to create an Actor that doesn't reset...

Link to comment
Share on other sites

If anyone is interested - You need to have default template defined (pointing to an Actor Template), and at least one template flag specified (I suggest "Attack Data").

This seems to be what is done by Bethesda for unique Actors like Companions.

 

And you need to create your NPC via PlaceAtMe(Template) - NOT PlaceActorAtMe(Template). The later will still have the inventory reset issue.

Link to comment
Share on other sites

As far as I remember, NPCs whose inventory only contained "fixed" items like 10mm Pistol, Utility coveralls and neither their Default Outfit nor Inventory Template pointed to a Leveled Character or an ActorBase whose IsRespawn flag was set didn't get reset regardless of Parent Cell, Editor Location and their Encounter Zone. Of course, such inventories don't support randomization but they can be "locked" by Trading items through the menu. ( Most likely it's one of the equip manager's parameters that triggers this behavior but I haven't tried to disassemble it so I can't be sure ).

 

"Random nude NPCs" is an interesting issue though.. first of all, when you see an item being "equipped", that's not really the "actual" equip state, that's just inventory item data ( a data flag that can be edited independently of the "real" equip state ). Inventory handler is accessible if Is3DLoaded() = False but one shouldn't rely on the equip manager for various reasons... for example, because the system comes with failsafes and one of them may try to equip the Default Outfit on the NPC in case EquipItem ( or EquipObject in the console and the native code; these have more paramaters than the Papyrus version ) was called on them while Is3DLoaded() = False, basically to prevent the loader from trying to equip for example Armors with overlapping "Biped Slots" on the NPC ( could very easily lead to frequent CTDs so the risks during development were probably too high to "smarten up" EquipItem to the level so it can reliably work after OnUnload ). If the manager doesn't find a Default Outfit or the inventory has been altered "in a way that" the failsafe can't fix, the NPC may show up with everything unequipped OnLoad which is worse than random "equip reset". So, make sure you don't RemoveItem(SomeItem) ( if ActorRef.IsEquipped(SomeItem) = True), EquipItem or SetOutfit() if Is3DLoaded() = False. Doing so doesn't necessarily trigger the "nude NPC bug" but there's a chance.. By the way, I don't know where you place the NPCs but handling actor's 3D data is often "too expensive" for the engine... actually, I encountered this bug when I spawned like 20 actors in an area where there were already a lot. I don't remember how the actors or their inventories were set up though.

 

Note: I don't really use PlaceActorAtMe(), don't know what kind of "undesirable" effects it might have. I prefer PlaceAtMe() for actors too but it's probably just a design choice.

Edited by LarannKiar
Link to comment
Share on other sites

What I meant was -

Based on our previous discussion here I created an actorbase that had no leveled items and was not based on any Lchar templates. This was the one that turned up a random nude - and by random I mean random sex, face, and NO inventory. Looks like the failsafe has a failsafe NPC to use as well - as my actorbase had a fixed face, sex, outfit, and inventory - none of which was used.

 

What made it work was one templated attribute (I used one of the Enc...Template NPC as the template and just the "attack data" from that template).

 

I had then tried this "working" actorbase creating an actor via placeatme and placeactoratme. The later would reset outfit on unload, while the "placeatme" stayed as I equipped them.

 

This is obviously not conclusive as so many small details seem to effect what is reset and why...

Link to comment
Share on other sites

What I meant was -

Based on our previous discussion here I created an actorbase that had no leveled items and was not based on any Lchar templates. This was the one that turned up a random nude - and by random I mean random sex, face, and NO inventory. Looks like the failsafe has a failsafe NPC to use as well - as my actorbase had a fixed face, sex, outfit, and inventory - none of which was used.

 

What made it work was one templated attribute (I used one of the Enc...Template NPC as the template and just the "attack data" from that template).

 

I had then tried this "working" actorbase creating an actor via placeatme and placeactoratme. The later would reset outfit on unload, while the "placeatme" stayed as I equipped them.

 

This is obviously not conclusive as so many small details seem to effect what is reset and why...

 

I have no idea how such NPC could turn out to be "randomly nude" but I'm glad you got it working. :)

 

Will the plugin be available somewhere? Even the one with the broken NPC? Might want to take a look at the actor record later. My NPC reset findings were quite different I don't know why.. might have forgotten something important to mention then.

Link to comment
Share on other sites

I am happy to give you the esp - in fact it probably doesn't need to be an override for my mod.

I suspect I can just make it a new record in an esp and then you just do a "player.placeatme <id>" via the console to see the issue.

Let me see what I can do, it is the least I can do for all your help.

Link to comment
Share on other sites

  • 1 month later...
On 9/10/2023 at 5:50 PM, PJMail said:

UNFORTUNATELY When I create the NPC it still resets on unload, even if I transfer and equip a new outfit via script.

HOWEVER, if I manually transfer and equip something on the NPC (via containermenu) it DOESNT reset.

Is there no way to lock their inventory without having to manually make a change?

Things inserted by Alias Inventory do not reset. I don't know if such armor/weapon would stay equipped or not.

On 9/8/2023 at 9:13 PM, LarannKiar said:

- interior cell should be part of a Location (Unique actor data is part of the (their Editor) Location data)

- use a "Never Resets" Encounter Zone for the location (as CellReset (which is based on the layers of Encounter Zone >> Location >> Cell) can be a bit buggy sometimes)

Does it make a difference if NoResetZone is specified directly on a REFR rather than having entire Cell as NoResetZone. E.g. Cell is also used for spawns moved out in world then and wouldn't like NoReset be inherited by a temporary Ref in any manner, somewhat cautious about permanent persistence of deleted refs phenomenon.

Emm, very unfortunate that interior Cells are always loaded, i always thought contrary. What's the point of keeping something inaccessible majority of time, unless that's marked Persistent specifically.

Regarding npc reset. I have a rudimentary Actor/Race serving as container (so it's hard to say if Template helps, i don't really need any to clutter esp) hard-placed in a Cell, NoResetZone, persistent, and he kept resetting inventory after enabled/disabled while moving to Player and back, even if PlayerTeammate. But if he's enabled all the time, then inventory seems be safe after moving. Unpleasant to keep him always enabled though.

Edited by hereami
Link to comment
Share on other sites

  • Recently Browsing   0 members

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