Jump to content

[LE] Activator - Conditions Not Working ('ifs' + 'else') to SetStage


Didact2805

Recommended Posts

Hi there,

 

I'm making an activator where, on Stage 73, it should display Message 1 AND also SetStage the Quest to Stage 74.

 

Upon 2nd activation I want it to Set the Stage to 76 (So activating the activator X2 set the Stages to 74 and 76 respectively).

 

Event OnActivate(ObjectReference akActionRef)
if BBX_TestQuestProperty.GetStage() == 73
BBX_TestQuestProperty.SetStage (74)
Debug.MessageBox("Stage 74 Successful.")
else
BBX_TestQuestProperty.SetStage (76)
Debug.MessageBox("Stage 76 Successful.")
The script does compile successfully, however, ONLY the Stage 76 message box appears on activation instead of '74' then '76'. Was wondering what is required to set it properly.
Thanks in advance.
Link to comment
Share on other sites

Doesn't work that way. The else will only run if the stage is already set to 74. To run the else statement, that code would need run again after the stage has been set to 74.

 

if (this happens to be true at time this statement is run)

; this will fire, and the else will not be checked

 

else (this happens if the above statement is false)

;

endif

 

there's also this which may fit more into what you want

 

if (this happens to be true at the time this statement is run)

; run this code no other statements

elseif (the above statement was false so run this one)

; no other statements run after this

elseif (see above..)

; see above

else (when everything else is false)

; run this

endif

Edited by Rasikko
Link to comment
Share on other sites

To figure it out a bit more, what Rasikko already explained to you.

 

If you forgot to fill "BBX_TestQuestProperty" in the CK, only messagebox with 76 will be shown.

If you filled the quest property right, show next script.

 

xyzObjectScript

 

Scriptname xyzObjectScript extends ObjectReference
; https://forums.nexusmods.com/index.php?/topic/7348961-activator-conditions-not-working-ifs-else-to-setstage/
; ScannerLegend wrote: "ONLY the Stage 76 message box appears on activation instead of '74' then '76'.
;                       Was wondering what is required to set it properly."

  Quest PROPERTY BBX_TestQuestProperty auto

; Description:
; ~~~~~~~~~~~~
; "I'm making an activator where, on Stage 73, it should display Message 1 AND also SetStage the Quest to Stage 74.
; Upon 2nd activation I want it to Set the Stage to 76 (So activating the activator X2 set the Stages to 74 and 76 respectively)."


; -- EVENT --

EVENT OnActivate(ObjectReference akActionRef)
    myF_Action(akActionRef)
ENDEVENT


; -- FUNCTION --

;-----------------------------------------------
FUNCTION myF_Action(ObjectReference akActionRef)
;-----------------------------------------------
IF (akActionRef == Game.GetPlayer() as ObjectReference)            ; make sure player activation only
ELSE
    RETURN    ; - STOP -
ENDIF
;---------------------
IF ( BBX_TestQuestProperty )
ELSE
    Debug.Notification("Missing quest property")
    RETURN    ; - STOP -
ENDIF
;---------------------
IF BBX_TestQuestProperty.IsStageDone(76)
    RETURN    ; - STOP -    last stage has been already set, nothing more to do
ENDIF
;---------------------
    IF (BBX_TestQuestProperty.GetCurrentStageID() == 73)        ; current quest stage has to be 73
        BBX_TestQuestProperty.setStage(74)                      ; now set stage 74
        Debug.MessageBox("Stage 74 Successful.")

    ELSEIF BBX_TestQuestProperty.IsStageDone(74)                ; if quest stage 74 is already set
        BBX_TestQuestProperty.setStage(76)                      ; now set stage 76
        Debug.MessageBox("Stage 76 Successful.")
    ENDIF
ENDFUNCTION

 

 

Link to comment
Share on other sites

Thanks! Came up with this thanks to your input and it works like a charm:

 

Scriptname AAX_C2Q3ArdaalinePrisonCrystal extends ObjectReference
GlobalVariable Property AAX_C2Q3CrystalCount Auto
Quest Property AAX_C2Q3Property Auto
Event OnActivate(ObjectReference akActionRef)
If AAX_C2Q3CrystalCount.GetValue() < 1
AAX_C2Q3CrystalCount.SetValue(AAX_C2Q3CrystalCount.GetValue() + 1)
AAX_C2Q3Property.SetStage(75)
AAX_C2Q3Property.SetObjectiveDisplayed(75)
AAX_C2_Q3_ArdaalinePrisonCrystal01.Disable()
AAX_C2_Q3_PrisonCrystalBeam01.Disable()
Debug.MessageBox("You disrupt the flow of magicka by distorting the configuration of the crystals.")
elseIf AAX_C2Q3CrystalCount.GetValue() == 1
AAX_C2Q3Property.SetStage(75)
AAX_C2Q3Property.SetObjectiveDisplayed(77)
AAX_C2_Q3_ArdaalinePrisonCrystal01.Disable()
AAX_C2_Q3_PrisonCrystalBeam01.Disable()
Debug.MessageBox("You disrupt the flow of magicka by distorting the configuration of the crystals.")
Endif
endEVENT
ObjectReference Property AAX_C2_Q3_ArdaalinePrisonCrystal01 Auto
ObjectReference Property AAX_C2_Q3_PrisonCrystalBeam01 Auto
Link to comment
Share on other sites

  • Recently Browsing   0 members

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