Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Ravelen

Allies
  • Posts

    1
  • Joined

  • Last visited

Ravelen's Achievements

Layman

Layman (1/11)

0

Reputation

  1. UPDATE: Someone has helped me elsewhere, thankfully. Solution posted. I apologize in advance if I am totally overlooking something or unaware of a broken rule I am violating, I am far from a Papyrus Skyrim coding expert and barely a novice. Okay, so this is the setup; I have a quest. The quest is triggered and one of the reference aliases, an NPC, is spawned at a location. Okay, fine. I select “Initially Disabled†for the NPC, so they’re created when the quest runs, but they’re initially disabled. We’ll enable them later. This is how we’ll enable them; We have a very simple script that runs an OnInit, placed in the Quest scripts section. It runs when the Quest runs. After a period of time with a single update event, we Enable the NPC the Quest created. Seems simple, I have some things working, but the NPC still won’t be enabled. Scriptname Sin7War_TimedEnable5 extends Quest ReferenceAlias property myAlias auto ObjectReference property SelfRef auto Event OnInit() Debug.Notification("OnInit Event activated.") myAlias.ForceRefTo(SelfRef) RegisterForSingleUpdate(120.0) EndEvent Event OnUpdate() Debug.Notification("Event OnUpdate activated..") SelfRef.Enable() EndEvent Note, earlier I tried to DIRECTLY enable the NPC Ref alias in the quest. Apparently you cannot do that? For example, this stated earlier line gives the compiler fits; myAlias.Enable(), it gives me: Enable is not a function or does not exist. Okay, so we can’t Enable the refAlias directly. It seems to only work on ObjectReferences. So I look around, I find ForceRefTo and try to shove the reference into that created ObjectReference holder, so I can actually enable the script. That compiles. I of course go to the Quest section, properties for the script, and fill in the property for ReferenceAlias myAlias (The NPC), while keeping ObjectReference SelfRef default and unfilled. It runs in Skyrim, I get both ^ of my debug notifications. NPC still does not enable. So I assume the reference is not being put into SelfRef. I am at a loss. How can I enable an NPC initially disabled by the quest? I can’t point at it in the Cell Window, because of course it is not created yet. I have to use the reference set up by the quest, but I get “Enable is not a function or does not exist†with everything except ObjectReference. Bonus Question: Is there a little snippet of code that allows me to generate a random number between two values? If I can somehow get my above script attempt to work, I’d like to use a random value between two sets of numbers for my SingleUpdate. Thank you in advance for taking the time to read this, even if you don't have an answer. UPDATE SOLUTION: ReferenceAlias property myAlias auto Event OnInit() ;Debug.Notification("OnInit Event activated.") int random = Utility.RandomInt(120, 1200) RegisterForSingleUpdate(random) EndEvent Event OnUpdate() ;Debug.Notification("Event OnUpdate activated..") myAlias.GetActorReference().Enable() EndEvent
×
×
  • Create New...