PlaceAtMe vs. AddItem: Saved Game Bloating

Post » Tue Jun 19, 2012 1:01 pm

I am quite new of modding and I'd like to ask to you guys a theorical question:

What is the difference between PlaceAtMe and AddItem from the point of view of Saved Game Bloating?

I am quite worried and I am trying my best to avoid using PlaceAtMe in my mods to avoid messing other people's saved games, but I'd like to understand if there's
any workaround to substitute PlaceAtMe (and add an object reference to a location instead to an inventory) and avoid this issue.

Moreover I have a related doubt:

If I add a script "OnItemAdded" to a container object and then use RemoveAllItem to transfer objects from a container to this reference...the OnItemAdded script would be run on
each item added? Even if we have many diifferent ones and the process seems to be instantaneous?

I mean...the system tracks all items as reference even if they are stacked and we perceive them as "one" item type with an amount?

Thanks,
Jashkar
User avatar
Charlotte Buckley
 
Posts: 3532
Joined: Fri Oct 27, 2006 11:29 am

Post » Tue Jun 19, 2012 5:28 pm

re: OnItemAdded () Event...
It will execute for each item added ALWAYS.

Off-topic but relevant:
A note re: OnItemRemoved () Event...
Will NOT execute when the item was removed with a script.

E.g. when attached to the player,
OnItemAdded () will always execute regardless of how the player acquired the item (e.g. from a container, the game world, from a script).
However, OnItemRemoved () will only execute if the player actually removes the item (e.g. dropped, put into a container, ingested for potions and food).
User avatar
Laura Mclean
 
Posts: 3471
Joined: Mon Oct 30, 2006 12:15 pm

Post » Tue Jun 19, 2012 5:04 am

For "savegame bloating" it makes no difference but it's irrelevant usually. A mod that only adds a couple of new objects by script won't cause any more trouble than another one that adds the same number of objects to a merchant's inventory, no matter what method is used to create the objects.

Any object that is created in game, be it random equipment of a NPC, a shop's inventory, a spawned creature or a quest reward given to the player gets a uinque FormID out of a pool of 2^24 = 16,777,216 possible numbers. A randomly spawned thug who carries armor, boots, helmet, sword and shield uses 6 FormIds. (1 for the thug, five for his inventory items) Troubles start when there are (almost) no numbers left.

Savegame bloating usually is related to scripts that constantly create a lot of new objects, a script could create a new object at the player's position every 0.1 seconds for example, to place footprints or to lay a path so that a NPC may literally follow in your footsteps even on a random zigzag course. Such a script would spend 36,000 FormIDs per hour, and is prone to cause trouble (and huge savegames) sooner or later, unless you add a mechanism that deletes those objects again.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Tue Jun 19, 2012 5:54 am

If you want to Place a Object (Actor, Armor, Weapon,Creature etc. etc.) by the player, its better you place this Object in a neutral Cell and Move it just in Time to him with "MoveTo".
User avatar
Samantha Mitchell
 
Posts: 3459
Joined: Mon Nov 13, 2006 8:33 pm

Post » Tue Jun 19, 2012 4:47 am

If you want to Place a Object (Actor, Armor, Weapon,Creature etc. etc.) by the player, its better you place this Object in a neutral Cell and Move it just in Time to him with "MoveTo".

Umm... why is that better to storing the object in no cell, and placing it at the actor when needed?
User avatar
NeverStopThe
 
Posts: 3405
Joined: Tue Mar 27, 2007 11:25 pm

Post » Tue Jun 19, 2012 8:01 am

Umm... why is that better to storing the object in no cell, and placing it at the actor when needed?

Drop it on his head with a MoveTo(Game.GetPlayer(),0.0,0.0,5000.0) - http://www.youtube.com/watch?v=_r1knpIlcV8
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Tue Jun 19, 2012 12:49 pm

Thank you guys... :)

Now it's clearer...and no...I am not planning to make a "spamming mod", so I'll just add one or two things... ;P

Thanks again,
Jashkar
User avatar
Caroline flitcroft
 
Posts: 3412
Joined: Sat Nov 25, 2006 7:05 am

Post » Tue Jun 19, 2012 11:00 am

Savegame bloating from placeatme used to bean issue with Oblivion but hasn't been since Fallout, from memory. When it comes to actors at least in Fallout, both live and dead actors are cleaned up at a cell reset, unless the 'respawn' flag is ticked (and usually, you're not doing this if placing temp actors -- as with spawn mods for eg -- so cleanup generally kept bloat down).

Actually, though haven't really had a chance to look into it but Skyrim may be a little different -- one of the devs in the CK beta stated that at any placeatme object is automatically treated as persistent. It doesn't trigger OnReset events and similar, and isn't cleaned up.
User avatar
Elle H
 
Posts: 3407
Joined: Sun Aug 06, 2006 3:15 am

Post » Tue Jun 19, 2012 8:29 am

Actually, though haven't really had a chance to look into it but Skyrim may be a little different -- one of the devs in the CK beta stated that at any placeatme object is automatically treated as persistent. It doesn't trigger OnReset events and similar, and isn't cleaned up.

There's a flag on PlaceAtMe where it suggests you have to opt-in to having your object Persistent. (bool abForcePersist false)
Let's just hope he meant the OnReset thing. Which (I think) also applies to objects dropped by the player too.

On that last note I thought it was cool that some random prisoner stopped me in the middle of a quest to ask if he could clear up the armor I'd dropped.
Now if only they'd made NPC's in towns that swept up the ash piles...
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Tue Jun 19, 2012 8:41 am

I remember that note, here it is for those not allowed in that forum:
Created references can't be flagged to reset, the game specifically has code that ignores all created references when resetting a cell.
tunaisafish is correct about created references not automatically being http://www.creationkit.com/Persistence_(Papyrus). I expect some references, like explosions, will recycle correctly, although looking at the problems with Nirnroot and the like that may not be the case with many types of reference.

Cipscis
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am


Return to V - Skyrim