My Little Dysfunctional Activator Script

Post » Thu Dec 19, 2013 11:27 pm

I've created a display for Unusual Gems/Stones of Barenziah. To activate the display, the player "use"s an activation trigger, an invisible volume floating out in front of the display much like is done with the player bookshelf. The activator trigger then calls a function in a separate trigger which pulls as many gems out of the player's inventory as will fit on the display and arranges them nicely.

The problem is, the script for the activator trigger doesn't work. Not "I activate it and nothing happens" doesn't work, but "doesn't appear in the game at all" doesn't work. It sends an OnInit() event when the save is loaded, but doesn't send an OnCellLoad() event when its containing cell is loaded. The script is initially disabled, but for now can be enabled by pressing a button in the cell it's in (for testing purposes). All other objects enabled by the test button enable properly and send OnCellLoad() events normally. The script was attached to a unique form, an Activator called "Unusual Gem Display." One of the first things I tried was deleting that activator, creating a completely new one, and attaching the script to the new one, but I had the same problem, which makes me suspect that it's the script itself that's having some sort of issue. Here is the script in its entirety (DbHOC is an abbreviation for the name of my mod):

Scriptname DbHOCGemDisplayClickTriggerScript extends ObjectReference  {Script which activates the Gem Display when clicked by the player.} import debugimport utility DbHOCGemDisplayTriggerScript Property DbHOCGemDisplayTrigger Auto{A reference to the gem display trigger object.} GlobalVariable Property DbHOCDebugMode Auto{Is DbHOC debug mode enabled?} bool Property DebugMode Auto Hidden{Store locally whether DbHOC debug mode is enabled to avoid calling GetValueInt() on the GlobalVariable property repeatedly.} Function setDebugMode()    if DbHOCDebugMode.getValueInt()        DebugMode = true    else        DebugMode = false    endIfendFunction EVENT OnCellLoad()    if DebugMode        Debug.Trace(self + ": OnCellLoad() event triggered")        ;this message never appears in my papyrus log, while all other custom scripts display a similar message normally    EndIf    setDebugMode()endEVENT Event OnInit()    Debug.Trace(self + ": if you're seeing this, then I'm not completely ******* useless.")    ;this message DOES appear in my Papyrus logendEvent Auto State Active ;in this state, the trigger can activate the gem display trigger when "used" by the player    Event OnBeginState()        if DebugMode            Debug.Trace(self + ": entering Active state")        EndIf    endEvent     Event OnEndState()        if DebugMode            Debug.Trace(self + ": leaving Active state")        EndIf    endEvent     EVENT OnActivate(ObjectReference TriggerRef)        if DebugMode            Trace(self + ": OnActivate() triggered, signalling gem display trigger")        endif        DbHOCGemDisplayTrigger.addGems()    endEVENTEndState State Inactive ;in this state, the trigger does nothing when activated    Event OnBeginState()        if DebugMode            Debug.Trace(self + ": entering Inactive state")        EndIf    endEvent     Event OnEndState()        if DebugMode            Debug.Trace(self + ": leaving Inactive state")        EndIf    endEvent     Event OnActivate(ObjectReference TriggerRef)        ;does nothing    EndEventEndState

I've been combing it over looking for something that could cause it to just straight-up not work, but I'm not seeing anything. Maybe a different set of eyes will. Failing that, does anyone have any ideas why this script refuses to appear in-game?

User avatar
Mistress trades Melissa
 
Posts: 3464
Joined: Mon Jun 19, 2006 9:28 pm

Post » Fri Dec 20, 2013 12:29 am

I may have solved my own problem: this was another instance of the bizarre z-axis rotation bug. I set the rotation of the activator volume to 1 degree on its z-axis (from 0), and it suddenly appeared in game and functioned normally. Oddly, though, it still didn't send an OnCellLoad() event.

User avatar
Emily abigail Villarreal
 
Posts: 3433
Joined: Mon Aug 27, 2007 9:38 am

Post » Thu Dec 19, 2013 9:45 pm

Glad you figured it out. I was just going to say, keep in mind (if you didn't already account for this) that OnCellLoad isn't guaranteed to fire if you load your save into that cell. You could try loading a save outside of it and then enter through a load door instead. OnCellAttach may also be another alternative, which may be more reliable for this situation (but still wont fire if you load a save into the cell). And of course, make sure your properties are filled (though I assume you did that :) )

User avatar
Rachell Katherine
 
Posts: 3380
Joined: Wed Oct 11, 2006 5:21 pm


Return to V - Skyrim