FuryoftheStars Posted January 23, 2021 Author Share Posted January 23, 2021 What exactly does the Self.Clear() do? I tried a quick Google search, but came up empty, though it's entirely possible I'm using the wrong search terms. :P Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 23, 2021 Share Posted January 23, 2021 This might help: https://www.creationkit.com/index.php?title=Clear_-_ReferenceAlias Link to comment Share on other sites More sharing options...
dylbill Posted January 23, 2021 Share Posted January 23, 2021 Self points to whatever the script is attached to. So, if it's a reference alias script, it points to the reference alias it's on. Clear() clears the reference alias so it's set to None, the OnLoad() event won't run anymore because the reference alias isn't holding a reference anymore. Link to comment Share on other sites More sharing options...
FuryoftheStars Posted January 25, 2021 Author Share Posted January 25, 2021 Ok, thanks both of you. I'll look more into this later. I'm going to take a break from this idea to work on the other mod idea that I had (that was the first mod idea I wanted to work on and allowed myself to be side tracked by this one...), but I will circle back around to it, cause they do tie into each other. Link to comment Share on other sites More sharing options...
FuryoftheStars Posted January 31, 2021 Author Share Posted January 31, 2021 Hmm, any chance anyone knows of a mod that uses this technique already, or can someone write up a quick usage example? I think I'm having a hard time following this one through. Thanks! Link to comment Share on other sites More sharing options...
dylbill Posted January 31, 2021 Share Posted January 31, 2021 It's not too complicated. Make a new quest, in the quest, make a new reference alias. Make it a specific reference fill type, choose the cell that the HF bed is in and choose the HF bed as the reference. Make sure the Optional box is checked, or Clear() won't work. Then put a script like this on the reference alias: Scriptname TM_ReferenceAliasScript extends ReferenceAlias ObjectReference Property MyBed Auto Event OnLoad() MyBed.Enable() Self.Clear() ;remove the ref from this ReferenceAlias. EndEvent Link to comment Share on other sites More sharing options...
FuryoftheStars Posted January 31, 2021 Author Share Posted January 31, 2021 (edited) Ok, thanks. I would have never gotten the quest part. I didn't even realize that was going to be needed for this. :/ Out of curiosity, I just found something a few minutes ago about using States as a run once switch. (https://forums.nexusmods.com/index.php?/topic/1309985-running-a-script-only-once/ Not sure why I wasn't able to find this sooner.... And actually, someone else in that thread suggested using a boolean, though it was stated that States may have a performance gain over the bool.) Any feedback on that? Do you know what the potential pros vs cons are? Edited January 31, 2021 by FuryoftheStars Link to comment Share on other sites More sharing options...
dylbill Posted January 31, 2021 Share Posted January 31, 2021 Using states or bools are also valid options, but for this case I would still use Clear(). The reason to use a reference alias on a quest is so you don't have to edit the vanilla bed form directly which can cause mod conflicts, otherwise you could put the script directly on the bed object reference. If you are putting a script directly on a reference, using states would be best. If you're only using a quest for this one reference alias, you can also stop the quest after the script runs for better performance.: Scriptname TM_ReferenceAliasScript extends ReferenceAlias ObjectReference Property MyBed Auto Event OnLoad() MyBed.Enable() Self.Clear() ;remove the ref from this ReferenceAlias. Self.GetOwningQuest().Stop() ;stop the quest this ReferenceAlias is on. EndEvent Link to comment Share on other sites More sharing options...
FuryoftheStars Posted January 31, 2021 Author Share Posted January 31, 2021 (I tried making another post, but then the site seemed to time out and was giving gateway errors. So apologies if another post shows up at some point.) Ok. So I haven't dealt much with quests yet. Is there something about the setup of the quest that... for lack of a better word... monitors the target object reference in order to know when to trigger? I'm assuming we're not just putting a trigger condition onto another object, seems I'm assuming this would somehow require altering a vanilla object somewhere. I'm just trying to understand how the pieces work. Thanks! Link to comment Share on other sites More sharing options...
dylbill Posted January 31, 2021 Share Posted January 31, 2021 For more info on Reference Alias script, you can go here: https://www.creationkit.com/index.php?title=ReferenceAlias_Script. At the bottom it says ReferenceAliases receive events from the ObjectReference they are pointing at. So, all you have to do is fill your reference alias with the objectreference you want to receive events from. In Fallout 4 they added the RegisterForRemoteEvent function, which would have been nice to have in Skyrim, but referencealias's will work just as well. Link to comment Share on other sites More sharing options...
Recommended Posts