Skip to content
#271
Auto-translated

BlueHeavenHero
Can someone explain to me how to use the SetObjectiveState script? Many people suggested using it when I asked how to create an object that gives a quest.
Ideally, with examples, because I won't understand much without them.
SetObjectiveState changes the state of a quest with the name objectiveName for a specific player. For quests belonging to a specific player, the playerID parameter is ignored. For global quests, if the playerID parameter is specified, it indicates for which player the quest state should be changed; otherwise, the quest state is changed for the first player.

In simple terms, the script activates a quest, completes/fails it.

SetObjectiveState("prim1", OBJECTIVE_ACTIVE) -- the first parameter is the quest name, the second is the status.
function PRIM3_COMPL()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, '4', nil)
if GetCurrentPlayer()==1 then
SetObjectiveState("prim3", OBJECTIVE_COMPLETED) -- the same, but with a different quest status.
print("32")
end
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER, '4', 'PRIM3_COMPL')

Statistics

Welcome our newest member: den