Jump to content

Papyrus Scripting: Enabling and Disabling Objects


hfreeman

Recommended Posts

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!

 

 

Thanks Gasti, that is really helpful, I think I like the sound of aliases best as well, excellent instructions. I'll give it a go later

 

EDIT: Seemed to work flawlessly! Mind you I haven't tested yet but the script compiled perfectly with no errors. Thanks again

Link to comment
Share on other sites

Ahh, the only snag doing it the way I've done it with the door being enabled after dialogue is the door isn't there when loading a saved game where you are further into the Thieves Guild Quest, basically beyond Stage 20 where the enabled command is set. The ladder still works but the exit door isn't there! I'll have to test to see if it works with a new game but I'll also have to find a way to make is save game compatible.

Would it work better if I added the enable command to a script for the original exit ladder from the Cistern, so the new door enables the first time someone activates the Cistern exit?

 

EDIT:

 

Bigger problem than I thought, it doesn't appear even if you go back to the the start and get to that point in the Quest, it can be used via the ladder in the Flagon but the trapdoor itself isn't there , it stays disabled. I may have to use the other option of having a key that the player can find and not have the door disabled at the start. Shame though, it would be nice to conquer it

Link to comment
Share on other sites

I didn't understand your problem.

 

I understand the part where you talk about being further in the questline (since the enabling is linked to a dialogue that never took place). This is fixable by having a script that runs the 1st time you load the mod.

 

It will check if the point you reached in the questline and then enable or not the door. There was a thread about it somewhere.

 

But about the rest i didn't understand anything lol.

Link to comment
Share on other sites

Ahh, the only snag doing it the way I've done it with the door being enabled after dialogue is the door isn't there when loading a saved game where you are further into the Thieves Guild Quest, basically beyond Stage 20 where the enabled command is set. The ladder still works but the exit door isn't there! I'll have to test to see if it works with a new game but I'll also have to find a way to make is save game compatible.

Would it work better if I added the enable command to a script for the original exit ladder from the Cistern, so the new door enables the first time someone activates the Cistern exit?

 

EDIT:

 

Bigger problem than I thought, it doesn't appear even if you go back to the the start and get to that point in the Quest, it can be used via the ladder in the Flagon but the trapdoor itself isn't there , it stays disabled. I may have to use the other option of having a key that the player can find and not have the door disabled at the start. Shame though, it would be nice to conquer it

 

Maybe I'm missing something, but can't you attach a script to the door (or better yet a linked XMarker) to enable/disable the door based on the current quest stage during the OnLoad or similar?

Link to comment
Share on other sites

Maybe I'm missing something, but can't you attach a script to the door (or better yet a linked XMarker) to enable/disable the door based on the current quest stage during the OnLoad or similar?

 

 

I'm not sure to be honest, in the end I have created a key which the player can only find when inside the flagon, this basically does the job I wanted, making a quicker entry and exit but without the cheat of getting to the Flagon before they find it norrnally. The idea behind the mod is just to save a loading screen, especially during those seeminly endless side quests you have to do to get the "special jobs"

 

Thanks for the help everyone, at least I now know about aliases and properties, I have some serious reading to do! Papyrus is already my nemesis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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