Skip to reading
First Light, Part 4: The Message in the Machine

Let Kit power the remote line

Edition 0.86.3.4

Part 4 of the First Light course. Build a two-character rescue using shared variables, attach-point alignment, sparks, a camera close-up, separate journals and a timed lift reserve.

Download PDFView illustrations

09 / SCRIPT 1 OF 5

Make one script per page for the next five pages. Use Adventure Database › Add › GDScript. Enter the Script ID and Name shown. In the code editor select the starter text, replace it with the whole block, then click Validate › Apply Changes › Save Project. Keep the indentation. Leave the event checkboxes clear. Only the final script needs Keep global instance alive.

1. Script ID: gate_breaker. Name it Gate Breaker. The first click powers the line. A later click charges the reserve, but only after Pip has fitted the pin.

Code example
func run():
Code example
    if ActivePlayer() != "player":
Code example
        return
Code example
    if QuestState("behind_wall") != "completed":
Code example
        await ShowMessage({"text": "Kit: I need to know which line to feed."})
Code example
        return
Code example
    match int(Runtime.variables.get("lift_stage", 0)):
Code example
        0:
Code example
            await SetVariable({"name": "lift_stage", "value": 1})
Code example
            await ShowMessage({"text": "Kit: Auxiliary feed on. Pip, check the relay!"})
Code example
        1, 2:
Code example
            await ShowMessage({"text": "Kit: I have power. Pip needs to seat the pin."})
Code example
        3:
Code example
            if Runtime.variables.get("lift_seconds", 0) <= 0:
Code example
                await SetVariable({"name": "lift_seconds", "value": 30})
Code example
                await ShowMessage({"text": "Kit: Charged! Tab to Pip and press the relay."})
Code example
            else:
Code example
                await ShowMessage({"text": "Kit: The reserve is already charged."})
Code example
        4:
Code example
            await ShowMessage({"text": "Kit: The lift is back in service."})

2. Wire the breaker. Open Gatehouse › Scene Objects › Auxiliary Breaker › Verb Actions. Set Default Verb to Use. Under Use Verb — Step 1, choose Run Visual Script (or Run Script) and select Gate Breaker. Apply and save. The selector accepts the GDScript you just wrote.

[1] What the click does. [2] Which script to run. The stage check keeps a second click from refilling a live reserve.

Page 10 of 16Permalink
Go to page

Continue your 3D adventure

  1. Part 1First Light, Part 1: Your First 3D Adventure
  2. Part 2First Light, Part 2: Three Knocks
  3. Part 3First Light, Part 3: Behind the Wall
  4. Part 4First Light, Part 4: The Message in the Machine
  5. Part 5First Light, Part 5: The Clockmaker’s Secret
  6. Part 6First Light, Part 6: The Final Hour