Jump to content

Stage Update in Another Quest


bajun

Recommended Posts

Hello,

 

I want to make stage that requires a condition of another quests. Quest should update, when other`re completed. I wrote a script that should deal with it, but it doesn't work, althought it compiles.

Scriptname MyQuestScript extends Quest  Conditional

Quest Property myQuest Auto
Quest Property ConditionalQuest01 Auto
Quest Property ConditionalQuest02 Auto
Quest Property ConditionalQuest03 Auto

bool Function SetStage(int iStage)
	if ConditionalQuest01.isCompleted()
		if ConditionalQuest02.isCompleted()
			if ConditionalQuest03.isCompleted()
			
			myQuest.SetStage(20)
			
	endif
		endif
			endif
	
EndFunction

I wonder if I put it into the right place - in the quest-that-should-be-updated script tab.

 

Do you have any tips for that, guys?

Edited by bajun
Link to comment
Share on other sites

  1. Well, first of all, you don't need conditional on the end of the first line (unless you know for sure what you're doing with it and you know it needs to be there).
  2. Your indentation is off. The EndIf associated with a given If should be indented by the same amount as the If. It's so you can see at a glance which If and EndIf go together.
  3. This is a function, not an event. Functions are blocks of code that can be called from elsewhere, but they don't run on they're own. This means "When I tell you 'SetStage', I want you to check these things and do this if they're done." Events are the game telling you certain things have happened, and they run automatically. But if you never tell it "SetStage", then it never does it.
  4. The function is set as a bool, that means it'll return a Bool when it's called, but you never return anything. Return something with "Return True" and "Return False".
  5. The function requires a number be put in (it has "Int iStage" in its parentheses) but it never uses the variable iStage. Normally, your finale SetStage would use that variable. In this case, just remove the "Int iStage" so it's just "Function SetSTage()"
  6. This function calls itself. By that, I mean its name is SetStage and you use the function SetStage. That's going to set up an infinite stack of it simply calling SetStage. Rename the function to SetStageIfReady. While it is occasionally useful to have a function call itself, that's exceedingly rare. Normally, it would be really really bad, like in this case.
  7. This should be done from a script fragment, and that means this function needs moved to the script that's made when you make a script fragment. Go to the stage where this should happen, type in some code like "SetStage(20)", and compile it. Now, go to the quest script tab and put in your SetStageIfReady function (everything but the top line, you DO need the properties still). Now, go back to your stage script fragment and change it to SetStageIfReady(20). Your script should look something like this:

 

 

Scriptname TIF_### extends Quest

;inserted code from the script fragment, don't change it...

Quest Property myQuest Auto
Quest Property ConditionalQuest01 Auto
Quest Property ConditionalQuest02 Auto
Quest Property ConditionalQuest03 Auto

Function SetStage()
	if ConditionalQuest01.isCompleted()
		if ConditionalQuest02.isCompleted()
			if ConditionalQuest03.isCompleted()
				myQuest.SetStage(20)
			endif
		endif
	endif
EndFunction

 

 

 

As for whether it's in the right place, it could be put in a number of places. Different places require different triggers. Try the changes I mentioned and see if it helps.

Link to comment
Share on other sites

I don't know if I understood it properly. I went to stage 20 in my quest and put there 'SetStage20'. Then i went to main quest script and I added there line that you posted. When i saved it I recieved the annotation:

E:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_TEQClingingInALittleConfu_02057ACE.psc(16,0): too many arguments passed to function
E:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_TEQClingingInALittleConfu_02057ACE.psc(31,0): the parameter types of function setstage in the empty state on script qf_teqclinginginalittleconfu_02057ace do not match the parent script quest
No output generated for QF_TEQClingingInALittleConfu_02057ACE, compilation failed.

And my quest script looks like that now:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 3
Scriptname QF_TEQClingingInALittleConfu_02057ACE Extends Quest Hidden

;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN CODE
SetObjectiveDisplayed(10)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_2
Function Fragment_2()
;BEGIN CODE
SetStage(20)

SetObjectiveCompleted(10)
SetObjectiveDisplayed(20)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Quest Property myQuest Auto
Quest Property ConditionalQuest01 Auto
Quest Property ConditionalQuest02 Auto
Quest Property ConditionalQuest03 Auto

Function SetStage()
	if ConditionalQuest01.isCompleted()
		if ConditionalQuest02.isCompleted()
			if ConditionalQuest03.isCompleted()
				myQuest.SetStage(20)
			endif
		endif
	endif
EndFunction

I wonder if it`s this script that you mentioned. Your script name begin with TIF but my begun with QF.

 

Ahh, and you wrote about SetStageIfReady function, but it doesn't exist from what I know.

Edited by bajun
Link to comment
Share on other sites

It doesn't exist. That's why you're using it as the name for this new function that you're making. Trust me, change line 16 to SetStageIfReady() and change line 31 to Function SetStageIfReady(). No numbers on either of those two lines. You're making a new function, a new block of code to run when you tell it to. The name of this new block of code, this new function, will be SetStageIfReady. Inside that new function, you're going to call the normal SetStage function with myQuest.SetStage(20). As for TIF vs QF, it doesn't matter. It's perfectly irrelevant, no worries. Just change line 16 and 31 and let us know what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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