Give the pickup its Take action
On this page
18. Pick up and use the power cell
Select power_cell in the lab, open Verb Actions and choose Take. Add this guarded sequence:
1. If Variable - name = cell_taken; equals = true
True
1. Show Message - text = The cell is already in your parts tray.; duration = 3.2
False
1. Set Variable - name = cell_taken; value = true
2. Add Inventory - itemId = cell
3. Set Variable - name = score; value = 20
4. Set Variable - name = objective; value = Use the power cell on the blue relay.
5. Set Object Visible - entityId = power_cell; visible = false
Use Set Variable for the score values here, not Add Score. The demo sets milestone scores to 20, 45, 70 and 100. Those values should not accumulate on repeat clicks.
Its Look action is Show Message: A cube with a job: power the relay. The default Take verb makes a context click pick it up; the explicit Look verb can still inspect it.
Add the cell-on-relay rule#
Open Inventory item cell, then Inventory Actions. Add a rule with ID cell_on_relay. Choose the target relay from the current project; the stored qualified target is entity:relay. Add the sequence below.
cell > cell_on_relay#
Targets: entity:relay
1. If Variable - name = powered; equals = true
True
1. Show Message - text = The relay is powered.; duration = 3.2
False
1. Set Variable - name = powered; value = true
2. Remove Inventory - itemId = cell
3. Set Variable - name = score; value = 45
4. Set Variable - name = objective; value = Use the relay to reach the beacon deck.
5. Show Message - text = The relay comes online. Click it to reach the beacon deck.; duration = 3.2
If you want the player to form a use-on sentence, allow the Use preposition on the item and set the Use verb's preposition text to on. Test selecting the cell in Inventory and then clicking the relay. The rule belongs to the carried item; a plain Use click on the empty relay is a different event.
Give the relay its own Use action#
If powered is true, Change Scene to roof at spawn entry. Otherwise, show The relay needs a power cell. This means using the item powers the relay, then using the relay takes the player to the deck. That two-step behavior is intentional.
