Bozingar Posted May 23, 2021 Share Posted May 23, 2021 Quick question about modding best practice: If you have a script that changes an actorbase mid-game (i.e. changing the Outfit of an NPC), how negative of an impact would this have of your save game bloat if done repeatedly on many actorbases? And if you were to change that Outfit back to the original one via mid-game script, would that eliminate this bloat, or would Skyrim still see the actorbase as "edited" despite having its old outfit back? For context: My mod temporarily changes the actorbase of a target to have an "Empty" outfit so the player can loot their equipped items without killing them. It then changes the actorbase outfit back to what it was after a number of in-game hours. While I do use GetLeveledActorBase whenever possible, this script could be run on hundreds of actorbases across the span of a game. My questions really boil down to: 1. If an actorbase is changed and then changed back via script, does Skyrim still see that actorbase as "edited" in terms of save data? 2. If hundreds are still taking up save data in this manner, would that even be noticeable? Thanks in advance for any insight, and please let me know if you can think of any ways to accomplish this without touching actorbases. I've toyed around with cloning the target's equipped items. That works but is way more clunky and script-heavy than the method above. Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 23, 2021 Share Posted May 23, 2021 I wouldn't change the actorbase at all. If this is just a outfit swap/change I would just script it out. Is this an army of NPCs from a custom actorbase? Link to comment Share on other sites More sharing options...
Bozingar Posted May 23, 2021 Author Share Posted May 23, 2021 I wouldn't change the actorbase at all. If this is just a outfit swap/change I would just script it out. Is this an army of NPCs from a custom actorbase?There are no new NPCs in this case. This is an alias-based script that has the following steps: 1. Forces the NPC target (any NPC) into an alias.2. Grabs the actor's actorbase (leveled actorbase if a leveled actor).3. Sets their outfit to "Empty" and saves their original outfit on a dummy actorbase.4. Allows the player to loot the NPC, including the items that used to be in their outfit (the point of the script).5. Registers the NPC for an update in a few in-game hours.6. On update, grabs their original outfit from the dummy actorbase and gives it back to them. This shouldn't really matter for leveled actors, as those get recycled anyway. However, I'm curious if, when the script gives a unique actor their original outfit back, if Skyrim will recognize that they are back to their "Unedited" state. I'm concerned that, despite all actorbases getting restored by the script, they will still be tagged as "Edited", and weigh down a player's save file. I know messing with actorbases isn't ideal; this is just the most script-light method of accomplishing this I've got to work yet. Living NPCs really hate having their outfit items removed (as we've seen with unmodded companions), and they tend to respawn at the drop of a hat. Without changing to an empty outfit, the script requires a mix of OnLoad alias script and a bunch of dummy invisible items. Definitely doable, but I wanted to cross off this solution before brute-forcing it. Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 24, 2021 Share Posted May 24, 2021 (edited) Little lost here what you're doing but ... as for your question putting original outfit back should be easy enough to test. Edited May 24, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
Bozingar Posted May 25, 2021 Author Share Posted May 25, 2021 Little lost here what you're doing but ... as for your question putting original outfit back should be easy enough to test.Sorry if I'm being confusing. To clarify, the mod already works as intended. It lets the player loot all items from NPCs who are stunned but still alive (working on some old-school non-lethal spells: entangle, feeblemind, power-word stun, ect). It uses the OpenInventory() command on the NPC. However, this command by default doesn't let players see or loot items that are part of the NPC's Outfit. This mod briefly switches the NPC's outfit to "Empty", allowing the player to loot said items from the stunned NPC. It then gives them their outfit back after a while, ensuring Skyrim doesn't slowly become more and more naked. It's similar to the "Perfect Touch" pickpocketing perk, but that's hardcoded into pickpocketing so I couldn't use it. A lot of follower mods use this same principle to let the player change their outfit, but this script could feasibly be called on every NPC the player meets and stuns. I'm curious whether changing actorbases on such a grand scale would cause performance impacts, and if giving them back their original outfits (as my mod currently does) would solve this. It's possible I'm seriously overestimating how much data this would actually add to a player's save file. Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 25, 2021 Share Posted May 25, 2021 (edited) With out seeing the mod working I can only speculate. As far as data used in the save ... Unless it's some type of bug that keeps taking more and more data I wouldn't worry about it.Myself I wouldn't mess with the actorbase that way. Other than to just read it. Edited May 25, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
ReDragon2013 Posted May 26, 2021 Share Posted May 26, 2021 (edited) NexusComa2 wrote: "Little lost here what you're doing"Me too. Bozingar wrote: "If an actorbase is changed and then changed back via script, does Skyrim still see that actorbase as "edited" in terms of save data?"You cannot change the actorbase of an actor, no way! What are you doing is to change the outfit depends on actors actorbase.Bozingar wrote: "Sets their outfit to "Empty" and saves their original outfit on a dummy actorbase."That's what are you doing. The changing of the outfit, nothing more or minor.Imho the question is, does it make sense to use next coding construct: "Registers the NPC for an update in a few in-game hours. On update, grabs their original outfit from the dummy actorbase and gives it back to them."Not really, better to handle this with a magic effect script as part of an ability spell. Make a condition to finish this effect like Is3DLoaded == 1 ; as long as the actor has 3D loaded keep the effect running on the actor.You did not provide your script code, so I had to write my own.boziOutfitChangeAbitlityScript Scriptname boziOutfitChangeAbitlityScript extends ActiveMagicEffect ; https://forums.nexusmods.com/index.php?/topic/10056588-trying-to-avoid-save-bloat-when-modifying-actorbases/ Outfit PROPERTY dummyOutfit auto ; ?? Actor TargetActor ; to store applied actor Outfit savedOutfit ; to store original outfit ; -- EVENTs -- 3 EVENT OnEffectStart(Actor akTarget, Actor akCaster) ; received when this effect is first started (OnInit may not have been run yet!) targetActor = akTarget Debug.Trace(" OnEffectStart() - target = " +akTarget) ; debugging only! ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) ; (effect may already be deleted, calling functions on this effect will fail) ChangeOutfit(1) Debug.Trace(" OnEffectFinish() - target = " +TargetActor) ; debugging only! ENDEVENT EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not player activated! ENDIF ;--------------------- ChangeOutfit(0) TargetActor.OpenInventory(TRUE) ; force open the inventory for NPC, not teammate Utility.Wait(0.25) ENDEVENT ; -- FUNCTION -- ;--------------------------- FUNCTION ChangeOutfit(Int i) ;--------------------------- ActorBase AB = TargetActor.GetLeveledActorBase() ; https://www.creationkit.com/index.php?title=GetOutfit_-_ActorBase ; https://www.creationkit.com/index.php?title=SetOutfit_-_Actor IF ( AB ) IF (i == 0) IF (!savedOutfit) && (SKSE.GetVersion() > 0) savedOutfit = AB.GetOutfit() ; SKSE required! AB.SetOutfit(dummyOutfit) ; empty outfit ENDIF ELSE IF ( savedOutfit ) AB.SetOutfit(savedOutfit) ; back to original outfit savedOutfit = None ENDIF ENDIF ENDIF ENDFUNCTION Edited May 26, 2021 by ReDragon2013 Link to comment Share on other sites More sharing options...
Bozingar Posted May 26, 2021 Author Share Posted May 26, 2021 NexusComa2 wrote: "Little lost here what you're doing"Me too. Bozingar wrote: "If an actorbase is changed and then changed back via script, does Skyrim still see that actorbase as "edited" in terms of save data?"You cannot change the actorbase of an actor, no way! What are you doing is to change the outfit depends on actors actorbase. Bozingar wrote: "Sets their outfit to "Empty" and saves their original outfit on a dummy actorbase."That's what are you doing. The changing of the outfit, nothing more or minor. Ah, I think I had a fundamental misunderstanding of what SetOutfit() was doing since it is called on the actorbase instead of the actor. I thought it was modifying the underlying base instead of the actor data itself. If this is the case, my original question indeed makes no sense. My script wouldn't add any more save data than any other actor interaction. Thanks for clarifying! Thank you for providing a script as well! My logic is almost identical to yours here; I only used aliases instead of magiceffects because it is part of a larger spell that needs to attach AI packages to the affected NPCs. I appreciate all the help! Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 26, 2021 Share Posted May 26, 2021 It's refencing the actorbase for actor. In this case what you're calling deals with data from both.This line says it all ... ActorBase AB = TargetActor.GetLeveledActorBase() Link to comment Share on other sites More sharing options...
Recommended Posts