Plarux Posted September 21, 2020 Share Posted September 21, 2020 Hello, I need to create a script that is attached to an NPC (ObjectReference in the world), which enables the NPC, but only if that NPC is filled by a quest alias.Once the quest is started, this script could check to see if this Object Reference is filled by the alias, if it is, then it enables it. Any help is greatly appreciated! Plarux Link to comment Share on other sites More sharing options...
SKKmods Posted September 21, 2020 Share Posted September 21, 2020 Quest Property TheQuest Auto Const Mandatory ReferenceAlias Property Alias_TheNPC Auto Const Mandatory Event OnInit() Self.RegisterForRemoteEvent(TheQuest, "OnQuestInit") EndEvent Event Quest.OnQuestInit(Quest akSender) Debug.Trace(Self + " OnQuestInit " + akSender + " Alias_TheNPC " + Alias_TheNPC.GetRef() ) If (Alias_TheNPC.GetRef() == (Self as ObjectReference)) ;make sure quest fill allows disabled Self.Enable() EndIf Self.UnregisterForAllEvents() EndEvent Link to comment Share on other sites More sharing options...
Plarux Posted September 21, 2020 Author Share Posted September 21, 2020 (edited) Quest Property TheQuest Auto Const Mandatory ReferenceAlias Property Alias_TheNPC Auto Const Mandatory Event OnInit() Self.RegisterForRemoteEvent(TheQuest, "OnQuestInit") EndEvent Event Quest.OnQuestInit(Quest akSender) Debug.Trace(Self + " OnQuestInit " + akSender + " Alias_TheNPC " + Alias_TheNPC.GetRef() ) If (Alias_TheNPC.GetRef() == (Self as ObjectReference)) ;make sure quest fill allows disabled Self.Enable() EndIf Self.UnregisterForAllEvents() EndEvent SKK50, thank you! I will be using this in my bounty mod and make sure to credit you :smile: If I wanted the reference to be disabled once the quest was completed, would I be able to create a new event inside the script that uses OnQuestShutdown, Self.Reset(), and Self.Disable()? Edited September 21, 2020 by Plarux Link to comment Share on other sites More sharing options...
Recommended Posts