How can I assign a set device to a player?

For example I’m making a game in which for a feature I want players be able to summon a Sportbike for when they want to (Like the “Sparrows” in Destiny)
(That part I already got working.)

But I want for each player to have their own set Sportbike to summon when they trigger a Trigger. As of right now I’m using an Array to store the Sportbike Spawner Devices.
But I have no idea how to efficiently store each player in a map when they join the game. And be also how I can allow another player to take their place if the original player happens to leave the game.
All my attempts to do this just didn’t work or were very long.

Could anyone help?

You could use type alias, for example:

bikes_map := [player]int # instead of int, use whatever you use to identify bike

And then have a map for all players:

var AgentsMap : [agent]bikes_map = map{}

Manage it according so each player will have it’s own map of bikes.

1 Like

Thank you.
But I also just found out I could’ve created a class with all the functions required, and then create an array of the class to assign each player to using an Index.
Which seems more efficient.

2 Likes

Even better!

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