Background for Skyrim SE
Member of the Quest script
boolfunctionModObjectiveGlobal(floatafModValue, GlobalVariableaModGlobal, intaiObjectiveID=-1, floatafTargetValue=-1, boolabCountingUp=true, boolabCompleteObjective=true, boolabRedisplayObjective=true)

Description

Wiki Description

Mods a global variable in a threadsafe way. Optional parameters allow automatic redisplay and completion (or failure) of a quest objective using this global variable.

Documentation Comment

thread-safe way to modify a global value
optional parameters:
aiObjectiveID = objective ID to redisplay
afTargetValue = value you're counting up (or down) towards -- if included, function will return TRUE when the global reaches the target value
abCountingUp = by default, function assumes you're counting up towards the target value; make this false to count DOWN towards target value
abCompleteObjective = by default, function assumes you're completing the objective once you reach the target value; make this false to FAIL the objective
abRedisplayObjective = by default, function asssume you want to redisplay the objective every time the global is incremeneted; make this FALSE to only display the objectives on complete or failure


Parameters

  1. floatafModValue

    CK Wiki Description

    The value to add to aModGlobal

  2. GlobalVariableaModGlobal

    CK Wiki Description

    The global variable we are modifying

  3. intaiObjectiveID=-1

    CK Wiki Description

    ObjectiveID to redisplay whenever this function is called.

    • Default:-1 (no objective)
  4. floatafTargetValue=-1

    CK Wiki Description

    Value you're counting up (or down) towards -- if you pass in a non-negative number, function will return TRUE when the global reaches the target value

    • Default:-1.0 (no target value)
  5. boolabCountingUp=true

    CK Wiki Description

    True to count up to target value, false to count down

    • Default:true
  6. boolabCompleteObjective=true

    CK Wiki Description

    True to complete the objective when target value is reached, false to fail the objective.

    • Default:true
  7. boolabRedisplayObjective=true

    CK Wiki Description

    True to re-display the objective every time the function is called, false to only show on success/failure.

    • Default:true

Examples

; Adds 1 to MyGlobal
MyQuest.ModObjectiveGlobal(1, MyGlobal)
; Adds 1 to MyGlobal, updates objective 10
MyQuest.ModObjectiveGlobal(1, MyGlobal, 10)
; adds 1 to ExteriorDefenderDeadCount, updates objective 30, sets stage 60 when it reaches ExteriorDefenderTotal
if MyQuest.ModObjectiveGlobal(1, ExteriorDefenderDeadCount, 30, ExteriorDefenderTotal.value)
  SetStage(60)
endif

Auto-Generated Example

float myFloat__afModValue
GlobalVariable myGlobalVariable__aModGlobal
int myInt__aiObjectiveID
float myFloat__afTargetValue
bool myBool__abCountingUp
bool myBool__abCompleteObjective
bool myBool__abRedisplayObjective

bool returnedValue = myQuest__toCallFunctionOn.ModObjectiveGlobal(myFloat__afModValue, myGlobalVariable__aModGlobal, myInt__aiObjectiveID, myFloat__afTargetValue, myBool__abCountingUp, myBool__abCompleteObjective, myBool__abRedisplayObjective)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.