Is there a way to attach multiple same devices to do the same?

Hello there!
In my current verse code I’ve attached a player spawner device to “PlayerSpawner”

    @editable
    PlayerSpawner : player_spawner_device = player_spawner_device{}

And in the void OnBegin I subscribe with the PlayerSpawner on SpawnedEvent another void. Is there a way to attach for example a 2nd player spawner device & use the same name “PlayerSpawner” to do exact the same thing without having to rewrite everything over and over again?

You can create an array of a device type and then iterate through the array with a for loop to Subscribe, like this:

@editable
PlayerSpawners : []player_spawner_device = array{}

OnBegin<override>()<suspends>:void=

    for (PlayerSpawner : PlayerSpawners):
        PlayerSpawner.SpawnedEvent.Subscribe(SomeFunction)
2 Likes