Skip to reading
Progress Bars, Hints & Journals

27. Use a guarded interaction script

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

This complete record can run when the player inspects the dial. It starts the quest if necessary, completes only an active dial objective and makes the first hint available:

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    if QuestState("restore_workshop") == "inactive":
        await StartQuest({"questId": "restore_workshop"})
        await SetQuestHidden({
            "questId": "restore_workshop", "hidden": false
        })
        await SetQuestTracked({
            "questId": "restore_workshop", "tracked": true
        })
    if ObjectiveState("restore_workshop", "inspect_dial") == "active":
        await CompleteObjective({
            "questId": "restore_workshop",
            "objectiveId": "inspect_dial"
        })
    await UnlockHint({"topicId": "machine", "answerNumber": 1})
    return true

Apply the record and run it from the dial’s intended verb interaction. The script does not force the inspect stage, so examining the dial again during repair cannot rewind the quest. Unlocking answer 1 again is harmless because the hint action preserves the highest count.

QuestState returns inactive when there is no state, then active, completed or failed as the quest changes. ObjectiveState reports inactive, active, completed or failed for the current objective state. Treat those results as decisions in the story logic, not as display text.

Page 44 of 53Permalink
Go to page