Hello. I am new to verse and uefn in general and I am trying to understand it. I am having trouble following this tutorial for making an escape room game.
For the Verse Switch State Puzzle: 10. Verse Switch State Puzzle | Epic Developer Community (epicgames.com)
I am stuck on the very beginning as line 19 “item_switch_puzzle” apparently has an unknown identifier. I am not sure what to do since there is only a few steps to get to where I am at so I am unsure how to progress.
Thank you for your time and help, here is my code:
using { /Fortnite.com/Devices }
using { /Verse.org/Native }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Simulation }
See Create Your Own Device Using Verse for how to create a verse device.
A Verse-authored creative device that can be placed in a level
An event handler class to handle switch interactions
This event handler is attached to events in the loop above
switch_event_handler := class():
PuzzleDevice : item_switch_puzzle
Switch : switch_device
OnSwitchPressed(InPlayer : agent) : void =
Print("Clicked")
PuzzleDevice.CheckSequence(InPlayer)
switch_state_puzzle := class(creative_device):
@editable
Switches : []switch_device = array{} #References the switches players can interact with
var SwitchSubscriptions : []cancelable = array{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends> : void=
Print("Loading Switch Puzzle")
# Looping through each switch and adding event handlers for each switch
for (SwitchIndex -> Switch : Switches):
Print("Switch {SwitchIndex} added")
Switch.TurnedOnEvent.Subscribe(switch_event_handler{PuzzleDevice := Self, Switch := Switch}.OnSwitchPressed)
Switch.TurnedOffEvent.Subscribe(switch_event_handler{PuzzleDevice := Self, Switch := Switch}.OnSwitchPressed)