Plarux Posted September 21, 2020 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
SKKmods Posted September 21, 2020 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
Plarux Posted September 21, 2020 Author 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
Recommended Posts