Quest SetStage back to previous stage?

Post » Sat May 28, 2011 7:25 am

Is it possible to use SetStage to go back to a previous quest stage?

I want to have quest that switches between two stages. Is this possible or can a quest go to a stage once only?

The quest stages don't have any journal entries.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Fri May 27, 2011 8:18 pm

If "Allow Repeated Stages" is set to on, then yes. Scripts will re-run, and journal entries re-appear (but that's not a worry for you).
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Sat May 28, 2011 1:42 am

I have enabled "Allow Repeated Stages" but my quest script still does not repeat.

It has two stages; 10 and 20.

10 goes first then 20. But then it stops and won't revert back to 10.

I'm using a book as activator that sets the Quest to 10 and then another book that sets it to 20. I know the books are working as they show a message when clicked.

So when clicking the first book again, it should set the quest back to 10, but it doesn't. The book shows the message but I get no message from the quest.
User avatar
Dragonz Dancer
 
Posts: 3441
Joined: Sat Jun 24, 2006 11:01 am

Post » Fri May 27, 2011 7:59 pm

This is the code. It is just a messagebox test to try to get the repeating stages working.

Begin GameMode	set fquestdelaytime to 0.1	if doonce == 0 && getstage MyQuest == 10		MessageBox "QuestStarted"		set doonce to 1		set doonce2 to 0	endif		if doonce2 == 0 && getstage MyQuest == 20		set doonce to 0		set doonce2 to 1                                        MessageBox "QuestStopped"	endifEnd

User avatar
Kelli Wolfe
 
Posts: 3440
Joined: Thu Aug 23, 2007 7:09 am

Post » Sat May 28, 2011 9:55 am

You know there's no setstage command anywhere in that script, right?
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Fri May 27, 2011 11:12 pm

You know there's no setstage command anywhere in that script, right?

Yeah yeah, I'm using SetStage in an object script on a book.

I know that works fine because I can start the quest with the book and end it also. But on the 3rd attempt to setstage back to 10, the book script runs but the quest script does not.
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Fri May 27, 2011 6:34 pm

What about the "Quest Stopped" comment? Are you actually stopping the quest with any commands, or just flopping between two stages while keeping it running all the time?

Posting the script from the book might be helpful. Really odd things can stop a script sometimes.
User avatar
.X chantelle .x Smith
 
Posts: 3399
Joined: Thu Jun 15, 2006 6:25 pm

Post » Sat May 28, 2011 1:45 am

The quest should run continuously just flipflopping between two states. With stage 20 being the "stopped" state, waiting for setstage 10 to start it again.

I have 2 books that are identical except one sets the stage to 10 and the other to 20.

Book1
Begin OnActivate 	if isActionRef player == 1 		MessageBox "Book Activated"		set DoOnce to 1	endif End;==============================Begin GameMode 	if DoOnce == 1		MessageBox "Book Script Started"		setstage MyQuest 10		set DoOnce to 0	endif	End


Book2
Begin OnActivate 	if isActionRef player == 1 		MessageBox "Book2 Activated"		set DoOnce to 1	endif End;==============================Begin GameMode 	if DoOnce == 1		MessageBox "Book2 Script Started"		setstage MyQuest 20		set DoOnce to 0	endif	End

User avatar
Logan Greenwood
 
Posts: 3416
Joined: Mon Jul 30, 2007 5:41 pm

Post » Sat May 28, 2011 1:28 am

If I recall correctly (yes I hate abbreviations!) you can use SetStage along with a 'Allow Repeated Stages' quest to run the code for that stage, however GetStage command will always return the highest stage that has been set. So if you set a quest stage to 20 and that is the highest stage you have set the quest to, it will always give stage 20.

Example to clarify:

SetStage MyQuest 10; Quest stage set to 10. Code for stage 10 runs.

if GetStage MyQuest == 10; This code will run as Stage == 10endif

SetStage MyQuest 20; Stage set to 20. Code for stage 20 runs.

SetStage MyQuest 10; Code for stage 10 runsset CheckVar to ( GetStage MyQuest ); CheckVar == 20 as 20 is the highest stage that has been set.

User avatar
Mari martnez Martinez
 
Posts: 3500
Joined: Sat Aug 11, 2007 9:39 am

Post » Fri May 27, 2011 11:29 pm

That sounds right.

Maybe try using "sqv MyQuest" in the console to see what the current stage is? I think that one actually works correctly.
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Sat May 28, 2011 9:49 am

I'm suspicious about those DoOnce tests as well. Since they're local variables, I think you're preventing either book from doing anything a second time with those.
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Sat May 28, 2011 4:54 am

I see, that seems to be the problem.

So how would I go about getting around this limitation?

Should I put all the code for each stage into the "result script" box in the quest stages tab?
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Fri May 27, 2011 10:46 pm

That, or manually add a flag for each state.

Begin GameMode

if DoOnce == 1
MessageBox "Book2 Script Started"
setstage MyQuest 20
set MyQuest.stage to 20
set DoOnce to 0
endif

End

and then check for the "stage" variable rather than using "getstage"
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm

Post » Fri May 27, 2011 9:09 pm

That, or manually add a flag for each state.

Begin GameMode

if DoOnce == 1
MessageBox "Book2 Script Started"
setstage MyQuest 20
set MyQuest.stage to 20
set DoOnce to 0
endif

End

and then check for the "stage" variable rather than using "getstage"

Excellent! Thanks a bunch, I've got it all working well now. I didn't know you could reference a variable from a quest in a normal script.
User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm

Post » Fri May 27, 2011 9:28 pm

however GetStage command will always return the highest stage that has been set. So if you set a quest stage to 20 and that is the highest stage you have set the quest to, it will always give stage 20.

This is my experience with Getstage as well.
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm


Return to IV - Oblivion