Jump to content

Enabling a portal after a certain quest stage.


TehNewbie

Recommended Posts

Hello there guys! I have ran into a problem recently, a problem with a script.

You know the mod called "Halls of Dovahndor"? The portal to the Halls opens immediately after installing the mod. I decided to try and make it open after the defeat of Alduin. And this is the part where I run into problems. Here's my script:

Scriptname MonahvenMiraadActivator extends ObjectReference

ObjectReference Property ThePortal Auto
Quest Property AlduinDefeat Auto

Event OnLoad()
If (AlduinDefeat.GetStageDone(200))
ThePortal.Enable()
EndIf
EndEvent

Where ThePortal is obviously portal to Dovahndor, and AlduinDefeat is quest MQ305. I attached the script to the portal (I set the portal to be initially disabled) but when I set the stage of the quest to 200, nothing happened. The portal was still closed.

When, however, I attached the script to the quest itself, everything worked flawlessly. I don't really want to attach it to the quest, because I don't want to mess something up by accident, and to make it compatible with everything. As you surely know by now, I'm really terrible at scripting, and I'd like to ask for some help. I would want to attach the script to the portal, and somehow make it work.

Thank you all in advance.

Link to comment
Share on other sites

Onload is called when an object's 3D is loaded. You may wanna use OnInit instead.

 

Thank you for your reply! Unfortunately, it didn't really work. The portal remains disabled. I think the problem is hidden in my script somewhere.

By the way... When I attach the script to the portal, I can choose the needed quest normally (in the properties), but I can't select the portal itself (in the Render Window) so I must leave "ThePortal" property value set to the default one. By doing so, does it mean it automatically chooses the portal? Or it simply leaves "ThePortal" property... blank? It doesn't choose anything?

Link to comment
Share on other sites

You can try setting the property value directly, not by selecting the Portal not in Render Window.

 

You can attach the script to quest if it worked for you. You can create a new quest just to hold your script, if you care about potential incompatibilities.

Link to comment
Share on other sites

From what I can see, it's not possible for me. Right under the "Pick Reference in Render Window" there are two fields, Cell and Reference. That's where the problem is, the area where the portal is placed is counted as an exterior one (the "Wilderness" one).

I don't really know how to choose places from the "Tamriel Worldspace" aside from picking them in Render Window. But picking the portal like that is not really an option for me, because when I try to choose it using the Render Window, the cursor turns red.

It's most likely because of the script attached to the portal.

 

I've been thinking... What about using the XMarker? Is it possible to somehow make it enable the portal? If yes, could you guys help me with it? I'm not really a Creation Kit expert, but I'll do my best.

 

If everything else fails, I'll just try to make my own quest and attach my script to it, like suggested by simtam.

 

EDIT: Scratch all that. I decided to make my own quest as suggested by simtam and... I have a feeling that I am getting closer to the solution. Maybe.

Edited by TehNewbie
Link to comment
Share on other sites

You can also leverage the fact that the script is attached to the portal, and not define a portal property, just simply:

Scriptname MonahvenMiraadActivator extends ObjectReference

Quest Property AlduinDefeat Auto

Event OnInit()
If (AlduinDefeat.GetStageDone(200))
  Enable()
EndIf
EndEvent

or you could inspect your mod with Tes5Edit and set the property value there, avoiding the problem of Wilderness...

Link to comment
Share on other sites

Sometimes an object that is rendered behind the editor camera may obfuscate the cursor which doesn't let u select a reference.
A good trick is to center the camera on ur portal, then make sure u can select it with ur cursor. If u try to click on it and u can't, hit "1" on ur keyboard to hide whatever object is hiding it, then try to select it.

If that doesn't work, get the coordinates for the cell the portal is in, then manually select the portal from the drop-down menu in the properties tab.

Link to comment
Share on other sites

You can also leverage the fact that the script is attached to the portal, and not define a portal property, just simply:

Scriptname MonahvenMiraadActivator extends ObjectReference

Quest Property AlduinDefeat Auto

Event OnInit()
If (AlduinDefeat.GetStageDone(200))
  Enable()
EndIf
EndEvent

or you could inspect your mod with Tes5Edit and set the property value there, avoiding the problem of Wilderness...

 

I tried your version of the script, but sadly it didn't work. The portal remains closed. Same goes for the TESVEdit option. Thank you for your suggestions though, I'll try to mess around with them for a bit longer.

 

Sometimes an object that is rendered behind the editor camera may obfuscate the cursor which doesn't let u select a reference.

A good trick is to center the camera on ur portal, then make sure u can select it with ur cursor. If u try to click on it and u can't, hit "1" on ur keyboard to hide whatever object is hiding it, then try to select it.

 

If that doesn't work, get the coordinates for the cell the portal is in, then manually select the portal from the drop-down menu in the properties tab.

 

Thank you for your suggestions, but the problem persists. I think that once you add a script to an object, you can't select it as a property in that script.

 

 

I'll be offline for a few hours, but I'll report in as soon as I can.

 

Since I am such a noob when it comes to scripting, I am most certainly making a mistake somewhere. Sorry for asking for so much, but... Can you guys give me more advices? Send me on the right track? Thank you in advance.

Link to comment
Share on other sites

Best advice is that you can use Debug.Trace(...) and read Papyrus logs in order to pinpoint what fails: is it the case that the script event has not been fired at all, or it was fired but the property was not set, or everything was all right, but the instruction Portal.Enable() did not work as intended. Could be anything. I never tried relying on a script attached to a disabled thing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...