Welcome to the AFK Mods bug tracker. In order to report an issue, you need to have a VALIDATED account to post one. Once you have followed the link the registration email sent you, please select a project from the drop down menu below. Select “Open New Issue” and fill out the form with as many details as possible.

Please also consider sending your bug report to Bethesda if you are reporting on an issue with Skyrim Special Edition, Fallout 4, or Starfield. Doing so will help everyone on all platforms.

Issue Data
Status: Closed
Issue Type: Bug Report
Project: Unofficial Skyrim Special Edition Patch
Component: Skyrim SE: Vanilla
Category: Papyrus
Assigned To: Nobody
Platform: All
Severity: Low
Votes: 1
Watching: N/A
Opened By EyeDeck on Dec 28, 2019 8:29 pm
Closed By Arthmoor on Jan 18, 2020 2:50 pm
Resolution: Fixed
Comment: Fixed for USSEP 4.2.2.

Issue #28300: TrapTriggerBase never clears lastTriggerRef property, causing undue persistence

 
Just noticed this while poking around a save with ReSaver:
When either of the OnTriggerEnter blocks in TrapTriggerBase fire, the ref that tripped the trap is stored in lastTriggerRef. This property is never used directly in this script, but it is used by some scripts that either extend, or reference TrapTriggerBase. All uses of this property seem to only happen very shortly after the property is assigned, in most cases in the onBeginState block in the extending script's Active state (set immediately after assigning lastTriggerRef), so it seems that this property wasn't intended to be used for long-term memory anyway.

Anyway, I notice that lastTriggerRef is never cleared, which means that any actor (or other objectref I suppose) that sets off any trap that uses this script—which is, well, most of them—will remain persistent until something else sets off the same trap, causing unnecessary memory usage and so on.

I think a reasonable fix would be to just add a simple OnCellDetach block to the script, like so
event OnCellDetach()
	lastTriggerRef = None
endEvent

This...shouldn't cause any side-effects, at least based on my own quick analysis of this and related scripts, but would need some testing to be sure.

Comments

1 comment(s) [Closed]
Arthmoor said:
 
I checked all of the scripts using this as a base and the only one that didn't already have a safeguard in place was SpringTrap. So it should be pretty safe to have it go ahead and set lastTriggerRef to None along with a safeguard check in SpringTrap to prevent it from trying to act on the reference if it was being processed when the cell detaches.

Showing Comments 1 - 1 of 1