So I'm trying to edit someone elses mod just to learn how to mod in skyrim. The first thing I'm trying to do is to have a mannequin auto dress with random stuff that's in a chest when I push a button. Actually, to make it easier first I'm just trying to display the name of a random item in the chest when I press the button. Right now I'm messing around with the "Drunken Dragon" mod (a player owned store). Super cool. I've already edited the script to do things I want, but I want to do something completely different now though. So I put a duplicated dwemer button inside the cell, then edited the defaultDweButtonScript (I forgot to duplicate it... I know... I'm an idiot.) So I got the button to display a dialog that says "Button Pressed" whenever I push it. That works great. So here's the script.
scriptName defaultDweButtonScript extends objectReference
sound property QSTAstrolabeButtonPressX auto
objectReference property objSelf auto hidden
ObjectReference Property pppDrunkenDragonChestRefA Auto
event onCellAttach()
objSelf = self as objectReference
playAnimation("Open")
endEvent
auto state open
event onActivate(objectReference akActivator)
;goToState("waiting")
playAnimationAndWait("Trigger01","done")
if QSTAstrolabeButtonPressX
QSTAstrolabeButtonPressX.play(objSelf)
endif
debug.MessageBox("Button Pressed")
int iTotalItems = pppDrunkenDragonChestRefA.GetNumItems()
debug.MessageBox("TotalItems: " + iTotalItems)
int iRand = Utility.RandomInt(0,iTotalItems - 1)
form oItem = pppDrunkenDragonChestRefA.GetNthForm(iRand)
debug.MessageBox(oItem.getname())
endEvent
endState
As you can see, I placed this line... ObjectReference Property pppDrunkenDragonChestRefA Auto at the top of the script. Then I edited the properties of the script and made sure that reference pointed to the chest in the cell. Then I loaded up the game and.... nothing. It still displays "Button Pressed" and "TotalItems: 0" and just a blank message box (where I tried to display the name of the nonexistant item.) So what am I doing wrong? It's obvious that the script isn't picking up the chest reference. Am I forgetting something? Thanks!