ModObjectiveGlobal - Quest

From the Fallout4 CreationKit Wiki
Revision as of 16:59, 2 December 2015 by imported>Plplecuyer (→‎Parameters)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: Quest Script

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.

Syntax[edit | edit source]

bool Function ModObjectiveGlobal(float afModValue, GlobalVariable aModGlobal, int aiObjectiveID = -1, float afTargetValue = -1.0, \
  bool abCountingUp = true, bool abCompleteObjective = true, bool abRedisplayObjective = true, \
  bool abAllowRollbackObjective = false)

Parameters[edit | edit source]

  • afModValue: The value to add to aModGlobal
  • aModGlobal: The global variable we are modifying
  • aiObjectiveID: ObjectiveID to redisplay whenever this function is called.
    • Default: -1 (no objective)
  • afTargetValue: 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)
  • abCountingUp: True to count up to target value, false to count down
    • Default: true
  • abCompleteObjective: True to complete the objective when target value is reached, false to fail the objective.
    • Default: true
  • abRedisplayObjective: True to re-display the objective every time the function is called, false to only show on success/failure.
    • Default: true
  • abAllowRollbackObjective: True to re-open a completed objective
    • Default: false

Return Value[edit | edit source]

True, if there is a target value and the global value reaches the target value.

Examples[edit | edit source]

; 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

See Also[edit | edit source]