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

Show Pip what Kit just switched on

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

10 / SCRIPT 2 OF 5

1. Script ID: relay_sync. Name it Relay Sync. Think of it as the room’s setup list. Each time Pip enters, it checks the shared stage, shows the right pieces, and puts the pin back in its socket if she has already fixed it.

Code example
func run():
Code example
    var stage = int(Runtime.variables.get("lift_stage", 0))
Code example
    for id in ["relay_box", "link_pin"]:
Code example
        await SetObjectVisible({"entityId": id, "visible": stage > 0})
Code example
    await SetObjectVisible({"entityId": "arc", "visible": stage == 1 or stage == 2})
Code example
    await SetObjectVisible({"entityId": "lift_gate", "visible": stage < 4})
Code example
    await SetObjectVisible({"entityId": "nell", "visible": stage == 4})
Code example
    if stage >= 3:
Code example
        await AttachPoints({"entityId": "link_pin", "point": "tip",
Code example
            "targetId": "relay_box", "targetPoint": "socket"})
Code example
    if stage == 1 and ActivePlayer() == "new_character":
Code example
        await SetVariable({"name": "lift_stage", "value": 2})
Code example
        await ActivateCamera({"cameraId": "socket_cam", "duration": 0.7})
Code example
        await ShowMessage({"text": "Pip: The cover is open. There's the empty socket."})
Code example
        await ActivateCamera({"cameraId": "main_camera", "duration": 0.5})

2. Run it on every entry. Select the Relay Room record itself in the database. Open Room Events. Under When Enters Room — Step 1, choose Run Visual Script › Relay Sync. Use the ordinary entry event. “First Time” would already be spent when Pip first comes through the hatch. Apply and save.

[1] When Enters Room runs on the return trip. [2] Relay Sync reads the shared stage.

Why change 1 to 2 before moving the camera? Stage 1 means the reveal is still owed. Setting 2 spends that reveal once. The 0.7-second blend draws Pip’s eye to the socket. The 0.5-second return gives the player the normal room view for the repair.

Page 11 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