determining if containers resetrespawn - how?

Post » Wed Jun 20, 2012 2:15 pm

is there a way to determine if a container resets/respawns?
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Wed Jun 20, 2012 7:25 am

Doh! Can someone move this to the Creation Kit forum, please? Thanks!
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Wed Jun 20, 2012 8:53 am

http://www.creationkit.com/Containerbut I guess you looked there. As for doing it on the fly I guess you could call http://www.creationkit.com/OnReset_-_ObjectReference, but you wouldn't know until it resets, which may well be too late.
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Wed Jun 20, 2012 2:12 am

Thanks, Ali!

I found something that I can use for finding chests that are player owned.
The Condition IsInMyOwnedCell works: http://www.creationkit.com/IsInMyOwnedCell
It doesn't exactly detect if the chest will respawn or not, but it will do for my needs.
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Wed Jun 20, 2012 4:20 pm

Isn't there a "respawns" checkbox in the edit popup from double clicking on it in the render window?
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Wed Jun 20, 2012 5:13 am

Yeah in the CK it's easy. It's detecting within game that's the problem.
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Wed Jun 20, 2012 1:10 pm

Yes, since resetting restores all object attributes and script variables to their starting values, you can't detect resetting directly in a script. What you can do however is rely on the fact that these are restored to their defaults. For example with actors, you can use the Variable* Actor Values (though in Skyrim these have mostly been reserved) to avoid altering any 'proper' actor values (like Strength etc), changing the value of one of them when the actor is spawned. When a cell resets and the actor resets, the Variable* is reset too and you can detect this.

Objects (like chests) however are different, as they have far less properties and no unessential values like Variable*. However, there is at least one factor that does reset with any object that has 3D: scale. If you change the scale of an object via script after it's loaded, and the cell resets, it will be restored to its initial size (for most everything, this is 1). This is how the Savegame DeBloatifier gets around the fact that placed references in Skyrim don't trigger the OnReset() block (references placed with PlaceAtMe are automatically persistent and don't trigger OnReset()) when fixing duplicative Nirnroot empty roots. They're set to a scale of 1.01 and detect when scale == 1.

And... I just realised you probably asking if there's a way to check if contents reset, given a chest set to not respawn will still have its 3D reset. Placing a non-playable token in the chest (which means it won't show up when looting) and detecting if it's present or not would indicate the contents have changed.
User avatar
gary lee
 
Posts: 3436
Joined: Tue Jul 03, 2007 7:49 pm

Post » Wed Jun 20, 2012 3:46 pm

Placing a non-playable token in the chest (which means it won't show up when looting) and detecting if it's present or not would indicate the contents have changed.

True, this would detect after the container already has reset; but, is there a way to detect in script if a container is going to reset? I'm trying to do something like this currently myself and would like to give the player a warning "this container will reset/respawn" so they're less likely to lose their stashed gear.
User avatar
kelly thomson
 
Posts: 3380
Joined: Thu Jun 22, 2006 12:18 pm

Post » Wed Jun 20, 2012 3:56 pm

A quest works with a PlayerREF ReferenceAlias via an OnItemRemoved() event. The script will detect if the recipient container respawns via checking a FormList.
Spoiler
ScriptName YourQuestPlayerAliasScript extends ReferenceAliasArmor Property InnocuousARMO AutoFormList Property RespawningContainerFLST AutoMessage Property RespawnWarningMESG AutoEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	If !akDestContainer	ElseIf RespawningContainerFLST.HasForm(akDestContainer.GetBaseObject())		If !akDestContainer.GetItemCount(InnocuousARMO)			akDestContainer.AddItem(InnocuousARMO)			Int iButton = RespawnWarningMESG.Show()			If (iButton == 0) ; Heed Warning				akDestContainer.RemoveItem(akBaseItem, aiItemCount, False, GetReference()) ; Give item(s) back to Player Alias			ElseIf (iButton == 1) ; Ignore Warning				GetReference().Slap(Fish)			EndIf		EndIf	EndIfEndEvent
InnocuousARMO, however, would be removed upon respawn in which case the below script would probably replace it, ensuring each container reference only warns the user once.
Spoiler
ScriptName InnocuousArmorScript extends ObjectReferenceFormList Property RespawningContainerFLST AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	If akNewContainer ; Prevent cumulation/addition in applicable/innaplicable containers		akNewContainer.RemoveItem(GetBaseObject(), akNewContainer.GetItemCount(GetBaseObject()) - RespawningContainerFLST.HasForm(akNewContainer) As Int, True)	Else ; Might be caught when container repawns		akOldContainer.AddItem(GetBaseObject()) ; akOldContainer has already warned the player once	EndIfEndEvent
User avatar
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Wed Jun 20, 2012 4:02 am

A simple solution if you're just concerned about vanilla containers is to go through each container in the CS, find which ones don't respawn/reset and putting something like "storage" or "safe" in their name.
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Wed Jun 20, 2012 11:57 am

While that would work, it would leave all kinds of room for conflicts. Setting up the alias setup above would be faster and wouldn't necessitate the editing of any base forms. When SKSE's SetName() is available, using it to change the names might be the way to go as it wouldn't have any side effects.
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm


Return to V - Skyrim