How to get a device class from "creative_object_interface"?

I have doors with lock devices on them in the level, I have tagged all the locks with “door_lock” and want to lock/unlock via verse;

    UnlockAllDoors():void=
        # Get all the players in the experience.
        AllPlayers := GetPlayspace().GetPlayers()

        for:
            TaggedDevice : GetCreativeObjectsWithTag( door_lock{} ),
            DoorLock := TaggedDevice,
            FirstAgent := AllPlayers[0]
        do:
            DoorLock.Unlock(FirstAgent)

However I do not know how to reference the lock_device class to call Unlock -

Does anyone know what I am missing?

Hey, you have to cast it to a lock_device before :

for:
    TaggedDevice : GetCreativeObjectsWithTag( door_lock{} ),
    DoorLock := lock_device[TaggedDevice], # this line
    FirstAgent := AllPlayers[0]

I think they already show that somewhere in the Gameplay Tags article :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.