Jump to content

Papyrus Scripting: Enabling and Disabling Objects


hfreeman

Recommended Posts

I am currently working on a mod to rebuild Helgen. I thought it would be good to try and integrate the rebuild into the game. To avoid messing around with the original Helgen, I decided to place gates to a new 'Helgen Worldspace'. I made the gates into quest aliases for the rebuild quest. However, the compiler fails when I try to script them to enable. I typed this into the 'End' box under the scripts section of the topic info box for the quest dialogue:

 

GetOwningQuest().SetStage(10)

Alias_Gate01.GetReference().Enable()

 

I clicked compile and this was the result:

 

Starting 1 compile threads for 1 files...

Compiling "TIF__01000D67"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01000D67.psc(10,0): variable Alias_Gate01 is undefined

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01000D67.psc(10,13): none is not a known user-defined type

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01000D67.psc(10,28): none is not a known user-defined type

No output generated for TIF__01000D67, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on TIF__01000D67

 

If anyone knows how to do this properly, please tell me what I'm doing wrong.

Link to comment
Share on other sites

Just take the enabling part of the script and attach it to the Quest Stage fragment instead of the dialogue fragment.

 

This because the dialogue script hasn't got the the alias properties defined in it.

 

To prevent me getting it completely wrong, please could you explain where this is done and what to put in as the code.

Link to comment
Share on other sites

Delete your Alias_Gate01.GetReference().Enable() from the dialogue fragment (keep the rest)

 

Go to Quest Stages Tab.

 

Select Stage 15 and if you don't have already one, add a Quest Item (this will enable the papyrus fragments section)

 

In the fragment section, write the same thing you just deleted.

 

Now it should compile properly.

Link to comment
Share on other sites

  • 4 weeks later...

I have a similar problem, I just can't get a grip on Papyrus if I'm honest. I have created an initially disabled exit door for the Thieves Guild and named it "thievesguildexitdoorref" in the Editor Reference ID box and set it as initially disabled.

 

In the dialogue end box where I want it enabled I have added the Getowningquest line and set it to the stage as above and that compiled.

 

I then went to the appropriate stage and added this line to the exisiting script box

 

"thievesguildexitdoorref.GetReference().Enable()"

 

But when I compile I get this error

 

"Starting 1 compile threads for 1 files...

Compiling "QF_TG01_0001F326"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_TG01_0001F326.psc(177,0): variable thievesguildexitdoorref is undefined

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_TG01_0001F326.psc(177,24): none is not a known user-defined type

No output generated for QF_TG01_0001F326, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on QF_TG01_0001F326"

 

I've tried without the GetReference() and same result

 

Can someone help please? This was so easy in FO3 and FNV!

Link to comment
Share on other sites

You need to read up on properties.

 

If that page doesn't make sense, basically you can't reference anything directly in a script. You have to create variables known as properties. You use these properties anywhere you want to reference anything. After you compile your script, you can edit the properties so that they point at what you want.

 

Quest stage script fragments are actually functions in your quest's quest fragments script. You cannot use properties in your quest stage script fragment until you add it to the quest fragments script. If you don't have any quest stage script fragments yet, then you don't have a quest fragments script for your quest. So you should first compile a quest stage script fragment with just a semicolon ";" to generate the quest fragments script, add your properties to the quest fragments script, then edit the quest stage script fragment with your real code.

Edited by fg109
Link to comment
Share on other sites

You need to read up on properties.

 

If that page doesn't make sense, basically you can't reference anything directly in a script. You have to create variables known as properties. You use these properties anywhere you want to reference anything. After you compile your script, you can edit the properties so that they point at what you want.

 

Quest stage script fragments are actually functions in your quest's quest fragments script. You cannot use properties in your quest stage script fragment until you add it to the quest fragments script. If you don't have any quest stage script fragments yet, then you don't have a quest fragments script for your quest. So you should first compile a quest stage script fragment with just a semicolon ";" to generate the quest fragments script, add your properties to the quest fragments script, then edit the quest stage script fragment with your real code.

 

 

Thanks for the help! My head hurts! Boy they've made life complicated with Papyrus! I'll have a good read up once I have time, I can't even find the scripts in the Creation Kit!

Link to comment
Share on other sites

Translating for mere mortal what one of the Scripting Gods said (no jokes fg, i've found your scripting thread amazing):

 

- you can't point a object in a script, you have to point to a property (that will point to the object itself)

 

- this can be done in 2 ways ---> with aliases or with properties

 

- aliases ---> go to alias tab, create a new alias ---> select specific reference and select your door (if you remember the cell you can use the drop down, or you can 1st view it in the cell view and then use the "select from cell view" button) ---> call it myDoor

 

As soon as you create a alias, it will be automatically added to the script as a sort of property. So putting the script Alias_myDoor.GetReference().Enable() will work flawlessly

 

- properties ---> if for some unknown reasons you don't like aliases (i love them), you can set your door as a property

 

Go to the stage that will enable the door, right click on "quest item" window ---> new. This will enable the papyrus. Now put a ";" and compile. Save the quest and reopen it.

 

Now your "properties" button should be clickable. Enter the properties, click add ---> "door" type (i think you can use ObjectReference too), name "myDoor" and fill the value dropdown with your door.

 

Now your script should be myDoor.Enable()

 

Done!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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