Difference between revisions of "IsStageDone - Quest"

From the CreationKit Wiki
Jump to navigation Jump to search
(Added notes about when a stage is considered done.)
(Elaborate on notes. Add that GetStageDone is an alias. Indicate what happens when called from the current stage's quest fragment script. Indicate what happens if you call SetStage on a lower stage.)
Line 3: Line 3:
'''Member of:''' [[Quest Script]]
'''Member of:''' [[Quest Script]]


Obtains whether the specified stage is done or not.
Obtains whether the specified quest stage is done or not.
 
A stage is "done" if it has ever been visited with the [[SetCurrentStageID - Quest|SetCurrentStageID]] or [[SetCurrentStageID - Quest|SetStage]] functions.
 
<code>GetStageDone</code> is an alias for <code>IsStageDone</code>.


== Syntax ==
== Syntax ==
Line 33: Line 37:


== Notes ==
== Notes ==
A stage is considered "Done" when the quest has been set to that stage at some point in the past. This includes the current stage. This means if a quest has stage 0, 10, 20, 30, 40, 50, 60, and you do a setstage for stages 0, 40, 20, 60, then only those stages are considered done. Even though [[GetCurrentStageID - Quest|GetCurrentStageID()]] will return 60, GetStageDone(50) will return false.
 
* <code>IsStageDone</code> returns <code>true</code> for the current quest stage, even while the quest fragment scripts for the current stage have not yet completed.
* Assume you have a quest with stages 0, 10, 20, 30, 40, 50, and 60. You call <code>SetStage</code> for stages 0, 40, 20, and 60, in that order. See the following table for the result that <code>IsStageDone</code> will return after the final <code>SetStage</code> (to stage 60) has been completed:
{| class="wikitable
|-
! IsStageDone !! Result
|-
| 0 || true
|-
| 10 || false
|-
| 20 || true
|-
| 30 || false
|-
| 40 || true
|-
| 50 || false
|-
| 60 || true
|}
Even though <code>[[GetCurrentStageID - Quest|GetCurrentStageID()]]</code> will return 60, <code>IsStageDone</code> will return false for stages 10, 30, and 50, because these stages have not yet been visited. If you subsequently call <code>SetStage(30)</code>, the result of <code>GetCurrentStageID</code> will still be 60, but <code>IsStageDone(30)</code> will now return true.


== See Also ==
== See Also ==

Revision as of 18:25, 8 September 2023

Member of: Quest Script

Obtains whether the specified quest stage is done or not.

A stage is "done" if it has ever been visited with the SetCurrentStageID or SetStage functions.

GetStageDone is an alias for IsStageDone.

Syntax

bool Function IsStageDone(int aiStage) native
bool Function GetStageDone(int aiStage)
  return IsStageDone(aiStage)
EndFunction

Parameters

  • aiStage: The stage to check.

Return Value

Whether the passed-in stage is done or not.

Examples

; is stage 20 done in the main quest?
bool mainQuestStage20Done = MainQuestProperty.IsStageDone(20)


; Prints a debug message if the side quest has completed stage 10
if (SideQuestProperty.GetStageDone(10))
  Debug.Trace("The side quest has finished stage 10!")
endIf

Notes

  • IsStageDone returns true for the current quest stage, even while the quest fragment scripts for the current stage have not yet completed.
  • Assume you have a quest with stages 0, 10, 20, 30, 40, 50, and 60. You call SetStage for stages 0, 40, 20, and 60, in that order. See the following table for the result that IsStageDone will return after the final SetStage (to stage 60) has been completed:
IsStageDone Result
0 true
10 false
20 true
30 false
40 true
50 false
60 true

Even though GetCurrentStageID() will return 60, IsStageDone will return false for stages 10, 30, and 50, because these stages have not yet been visited. If you subsequently call SetStage(30), the result of GetCurrentStageID will still be 60, but IsStageDone(30) will now return true.

See Also