ModObjectiveGlobal - Quest: Difference between revisions

Jump to navigation Jump to search
imported>Thingy Person
(→‎Syntax: This is a non-native function, so why not put the whole thing here?)
imported>Thingy Person
Line 7: Line 7:
== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
bool Function ModObjectiveGlobal(float afModValue, GlobalVariable aModGlobal, int aiObjectiveID = -1, float afTargetValue = -1.0, bool abCountingUp = true, bool abCompleteObjective = true, bool abRedisplayObjective = true)
bool Function ModObjectiveGlobal(float afModValue, GlobalVariable aModGlobal, int aiObjectiveID = -1, float afTargetValue = -1.0, bool abCountingUp = true,  
bool abCompleteObjective = true, bool abRedisplayObjective = true)
aModGlobal.Mod(afModValue)
aModGlobal.Mod(afModValue)
UpdateCurrentInstanceGlobal(aModGlobal)
UpdateCurrentInstanceGlobal(aModGlobal)
if aiObjectiveID >= 0
if aiObjectiveID >= 0
; display/complete objectives automatically
if afTargetValue > -1
if afTargetValue > -1
if (abCountingUp && aModGlobal.value >= afTargetValue) || (!abCountingUp && aModGlobal.value <= afTargetValue)
if (abCountingUp && aModGlobal.value >= afTargetValue) || (!abCountingUp && aModGlobal.value <= afTargetValue)
if (abCompleteObjective)
if (abCompleteObjective)
; complete objective
SetObjectiveCompleted(aiObjectiveID)
SetObjectiveCompleted(aiObjectiveID)
return true
return true
Else
Else
; fail objective
SetObjectiveFailed(aiObjectiveID)
SetObjectiveFailed(aiObjectiveID)
return true
return true
Endif
Endif
elseIf (abRedisplayObjective)
elseIf (abRedisplayObjective)
; redisplay objective
SetObjectiveDisplayed(aiObjectiveID, true, true)
SetObjectiveDisplayed(aiObjectiveID, true, true)
Else
Else
Line 30: Line 27:
endif
endif
elseIf (abRedisplayObjective)
elseIf (abRedisplayObjective)
; no target value, always redisplay objective
SetObjectiveDisplayed(aiObjectiveID, true, true)
SetObjectiveDisplayed(aiObjectiveID, true, true)
Else
Else

Navigation menu