Difference between revisions of "ModObjectiveGlobal - Quest"

900 bytes added ,  07:42, 29 June 2013
→‎Syntax: This is a non-native function, so why not put the whole thing here?
imported>Jlundin
 
imported>Thingy Person
(→‎Syntax: This is a non-native function, so why not put the whole thing here?)
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 Function ModObjectiveGlobal(float afModValue, GlobalVariable aModGlobal, int aiObjectiveID = -1, float afTargetValue = -1.0, bool abCountingUp = true, bool abCompleteObjective = true, bool abRedisplayObjective = true)
  bool abCountingUp = true, bool abCompleteObjective = true, bool abRedisplayObjective = true)
aModGlobal.Mod(afModValue)
UpdateCurrentInstanceGlobal(aModGlobal)
if aiObjectiveID >= 0
; display/complete objectives automatically
if afTargetValue > -1
if (abCountingUp && aModGlobal.value >= afTargetValue) || (!abCountingUp && aModGlobal.value <= afTargetValue)
if (abCompleteObjective)
; complete objective
SetObjectiveCompleted(aiObjectiveID)
return true
Else
; fail objective
SetObjectiveFailed(aiObjectiveID)
return true
Endif
elseIf (abRedisplayObjective)
; redisplay objective
SetObjectiveDisplayed(aiObjectiveID, true, true)
Else
SetObjectiveDisplayed(aiObjectiveID, true, false)
endif
elseIf (abRedisplayObjective)
; no target value, always redisplay objective
SetObjectiveDisplayed(aiObjectiveID, true, true)
Else
SetObjectiveDisplayed(aiObjectiveID, true, false)
endif
endif
return false
endFunction
</source>
</source>