Opening is easy... but how do I make the Activator 's script KNOW about the Container? I assume there's some way to pass reference between objects, but I dont know how this works.
I want to do something like this Pseudocode:
(Effect Script)
ObjectReference magicLever = player.PlaceAtMe( MagicLeverActivator);
ObjectReference invisibleChest = player.PlaceAtMe( SecretContainer );
magicLever.chest = invisibleChest;
(then in the MagicLeverScript's onActivate:)
Self.chest.activate();
Optionally, I'd go for plan B: Have the Magic Lever create its own chest when the lever is created, but I can't find a suitable event to attach this to... there doesn't appear to be any kind of event for "I just got created" that I can see...
UPDATE: I think what I'm asking for is a LinkedRef, and I can see from this site http://www.cipscis.com/skyrim/tutorials/externalaccess.aspx how to ACCESS the linked ref, but I can't figure out how to SET it in the first place...
Suggestions?