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

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
abAllowRollbackObjective = by default, function assumes you do not want to rollback a completed objective; make this TRUE to reopen an already completed objective if aModGlobal goes below/above target value


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
  8. boolabAllowRollbackObjective=false

    CK Wiki Description

    True to re-open a completed objective

    • Default:false

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 myBool__abAllowRollbackObjective

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

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.