Hey everyone, I’m pretty new to Verse, and have been trying to develop an extremely simple teleport system for having multiple maps in the game.
I currently have a working system that teleports all players to the proper maps (randomized) and the teleporters are working properly.
The problem is that I want it teleport each player to a different teleporter in the array (or atleast until it runs out of teleporters in the array). Currently it seems to teleport all players through all teleporters in the selected array once before ending at the last one.
@editable
Map1Teleporters:[]teleporter_device = array{}
@editable
Map2Teleporters:[]teleporter_device = array{}
@editable
Map3Teleporters:[]teleporter_device = array{}
@editable
DelayGame:float = 2.0
MapCount:int = 2
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
RandomMap:int = GetRandomInt(0, 0)
Print("{RandomMap}")
Sleep(DelayGame)
if (RandomMap = 0):
for (Map1TP : Map1Teleporters):
Map1TP.Enable()
RandomIndex:int = GetRandomInt(0, Map1Teleporters.Length - 1)
for:
Player : GetPlayspace().GetPlayers()
FortCharacter := Player.GetFortCharacter[]
do:
if (SelectedTP := Map1Teleporters[RandomIndex]):
SelectedTP.Teleport(Player)
Print("Red")
else if (RandomMap = 1) :
for (Map2TP: Map2Teleporters):
Map2TP.Enable()
for:
Player : GetPlayspace().GetPlayers()
FortCharacter := Player.GetFortCharacter[]
do:
Map2TP.Teleport(Player)
Print("Yellow")
else if (RandomMap = 2) :
for (Map3TP: Map3Teleporters):
Map3TP.Enable()
for:
Player : GetPlayspace().GetPlayers()
FortCharacter := Player.GetFortCharacter[]
do:
Map3TP.Teleport(Player)
Print("Green")
I should also mention I’m aware all the Else If’s are a non efficient way to do it, but for now I don’t need efficient, just need it to work.