Jump to content

Scripting - "GetStage"?


ChaoticTrack

Recommended Posts

Again, sorry if there's already a thread(s) for this, but I'm doing some scripting for my quest. The only place I found a duplicate answer was on the Steam forums, unanswered from 2013.

I have a dungeon, and there's a few things I want to set up.

 

1. Have the exterior's door be locked (unpickable) until a certain stage in a quest.

2. Advance the quest when the player enters the cell.

 

I have an idea of how I would accomplish the second, but it requires a way for the door to be locked UNTIL a certain stage, or else the player can jump way into the quest before they even get to stage 10.

 

I quickly wrote and placed this script on a candle near the entrance so that when you enter the dungeon it will run the script.

 

int blackJadeDungeonEntered

Event OnLoad()
	if (blackJadeDungeonEntered == 0)
		BlackJadeDungeonLoadProperty.SetStage(20)
		BlackJadeDungeonLoadProperty.SetObjectivedisplayed(20)
		blackJadeDungeonEntered = 1
	endIf
EndEvent

I know there's an OnCellLoad() function, but I wasn't quite sure how to implement it so I went with this.

Using an integer, with my testing it seemed to hold it's value and only activate once.

 

TL;DR

 

I need a way to have the door locked until a certain quest stage, at which it will become unlocked.

 

Thank you!

Edited by ChaoticTrack
Link to comment
Share on other sites

You don't even have to have the door as a quest Alias, you can define it as an ObjectReference in the quest stage property.

 

So if you wanted the door to unlock on stage 10 for instance you just open your quest, go to quest stage 10 and hit properties (assuming you already have the quest script attached to the quest and it's accepting script fragments, if not you have to put a ; comment and compile first, close the quest window and open it again.) In Properties tab just add a new property as "MyQuestDoor" or whatever and point it at the door. Then in the fragment put:

MyQuestDoor.Unlock()

that's the cleanest way to do it. You generally want to avoid putting scripts on random objects if at all possible because then if you later need to update your mod and remove or alter the script in any way, it may not function properly for people already playing the mod, and if you delete the scripted object entirely, it will start to cause stack errors in people's games because the script will be baked into their save when the object no longer exists.

 

Also make sure that the door is not set to respawn, otherwise 30 days later the door will relock unless the cell is set as a NoResetZone

Link to comment
Share on other sites

You don't even have to have the door as a quest Alias, you can define it as an ObjectReference in the quest stage property.

 

So if you wanted the door to unlock on stage 10 for instance you just open your quest, go to quest stage 10 and hit properties (assuming you already have the quest script attached to the quest and it's accepting script fragments, if not you have to put a ; comment and compile first, close the quest window and open it again.) In Properties tab just add a new property as "MyQuestDoor" or whatever and point it at the door. Then in the fragment put:

MyQuestDoor.Unlock()

that's the cleanest way to do it. You generally want to avoid putting scripts on random objects if at all possible because then if you later need to update your mod and remove or alter the script in any way, it may not function properly for people already playing the mod, and if you delete the scripted object entirely, it will start to cause stack errors in people's games because the script will be baked into their save when the object no longer exists.

 

Also make sure that the door is not set to respawn, otherwise 30 days later the door will relock unless the cell is set as a NoResetZone

 

Thanks, I looked on the wiki and objectReference.Unlock(false) seemed to be the correct function (like stated above aha). You also mentioned that having scripts on objects can cause harm.

 

Will the script I wrote potentially be an issue? How can I do this in a better way? I've been trying to figure it out. I found OnCellAttach, but I don't know how to refer to the cell with it without putting it on an object.. :s

Link to comment
Share on other sites

  • Recently Browsing   0 members

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