Turn Order Help

I am making a DND-themed RPG game where all your actions are based on dice rolls. There is a mechanic called Initiative that determines your turn in combat. But I don’t know how to have the randomized dice roll determine the turn in battle.
Link to the Beta Battle: Flowlab Game Creator - The Mythical Blade of Zorisc - DND Story (Work In Progress)

3 Likes

here is something you could do:

First, assign a number to each player. Basically just 1,2,3, etc.
When the dice is rolled for a player assign the roll to a variable.

Then, when everyone has rolled, a message is sent to EVERY player. (from a managing object, whichever one you are using to control the battle)

When a player receives that message they send (dice roll * 10)+(player number) back to the manager using “respond to last message”.

Then when the manager receives that message it adds the value to a number list.

Once a message has been received from every player, the manager can sort the number list (there is a behavior for that).

Now that the list is sorted you can get the highest rolled number, then the second highest, etc.
Each index in the list also has the corresponding play number in the “1’s” place.

Feel free to ask any questions if it doesn’t make sense. If you don’t get it at all I could try making an example.

1 Like

There is also something called “Initiative Bonus,” Which adds to your turn roll, but I think I got it.

The formula:
((a + b) * 10) + c
a = dice roll
b = initiative bonus
c = player number

(I was good in algebra btw)

But the thing is… I never used list before. So I need some help with how to use it.

I’m pretty much an expert on lists what would you like to know?

So basically, the numbers are based on this formula

((a + b) * 10) + c
a = dice roll
b = initiative bonus
c = player number

And want to go from the biggest number to the smallest to determine the turns.

I pretty sure the List Order behavior has an option to order things from small to large, or larger to small