Sign In Register

How can we help you today?

Start a new topic
Answered

How to dictate the order in which turns are taken?

Hello, 


The game I am making requires that turns be taken in a certain order.  For example.


Let's say I have  some scriptData called  activePlayers  and this is an array of  PlayerName & PlayerId  as such.


{"name":Spark.getPlayer().getDisplayName(), "id":Spark.getPlayer().getPlayerId()}


However, I want allow the user to "sit in a specific seat"  around a table.    So my 10 seats would look something like this.


var seatsArray = [

     {"name":"Berry", "id":"254568sdf8sd6f84sdf7"},

     {"name":"Ringo Star", "id":"254568sdf8sd6f84sdf8"},

     {"name":"Sam", "id":"254568sdf8sd6f84sdf9"},

     {"name":"Bob", "id":"254568sdf8sd6f84sdf10"},

]


I think you catch my drift.

If I want to say, Bob goes first,  Ringo Goes second and Sam goes third and Berry goes last then how would I do this?


As a matter of fact, i am okay with it going clockwise and just specifying a turn starting point

The important part is that I can speficy who goes first.  However, it is preferred if I can control who's turn it is next.


Thanks,





Best Answer

Hi Marco,


If you have the challenge set to "Turn Based" you can use "challenge.consumeTurn" to take the turn of any player, though I am not 100% sure if it only works on the next player or which ever player is specified.


I'll look into it in greater detail tomorrow. It may be a case of not setting your challenge to turn based and keeping track of the turns in cloud code yourself.


Shane

1 Comment

Answer

Hi Marco,


If you have the challenge set to "Turn Based" you can use "challenge.consumeTurn" to take the turn of any player, though I am not 100% sure if it only works on the next player or which ever player is specified.


I'll look into it in greater detail tomorrow. It may be a case of not setting your challenge to turn based and keeping track of the turns in cloud code yourself.


Shane

Login to post a comment