How to make a in-race ranking system

Well that’s what I used in my game.

Have the laser increment a global scoped counter when anyone hits the laser. Have the counter be linked to a player scoped property. There should be one counter per laser. I’m pretty sure that’s the basics. There’s a few things that I added onto it to make the game work better.

1 Like

Unfortunately, the method I used didn’t work. I’ll try to post everything that I did below, but if I missed anything I’ll add it once I notice.

First of all, I have a system to limit the number of players to 2. I am planning on increasing it to 10 once I figure the ranking system out, but for now I’m only having 2 players.

Secondly, I used a guide to give each player a player ID (stored in property ‘playerID’); for now it is only 1 or 2.

Here’s everything else I used:

Zones around the course that transmit on “checkpoint” when the player enters or exits them.

A counter that starts at 0, increments on “checkpoint”, and is linked to property “checkpoints”.

A number property called “checkpoints” that starts off as 0, is player scoped, and broadcasts on “updatePlacement” when changed.

A trigger that triggers on “updatePlacement” and transmits on “updatePlacementActual” [1] and has the following block when triggered:
Set property: (Create text with [“checkpoints”, Get Property: playerID]) (Value: Checkpoints)

A trigger that triggers on updatePlacementActual and transmits on showPlacement1 with the following block when triggered:

set variable playerID to Get Property: playerID

if (playerID = 1) do {
if (Get Property: checkpoints1 ≥ Get Property: checkpoints2) do {
Set Property: (playerRank) (Value: 1)
} else {
Set Property: (playerRank) (Value: 2)
}
}
if (playerID = 2) do {
if (Get Property: checkpoints2 ≥ Get Property: checkpoints1) do {
Set Property: (playerRank) (Value: 1)
} else {
Set Property: (playerRank) (Value: 2)
}
}

There is a relay that broadcasts on “showPlacement” when receiving on “showPlacement1”.

There is a number property called playerRank with player scope starting at 0.

There is a number property called checkpoints1 with global scope starting at 0.

There is a number property called checkpoints2 with global scope starting at 0.

There is a game overlay with player scope with the following block when receiving on channel showPlacement:

if (getProperty: playerRank = 1) do {
Set text: "You are currently in 1st place.
}
if (getProperty: playerRank = 2) do {
Set text: "You are currently in 2nd place.
}

When I tested on two separate tabs, my main tab wouldn’t switch away from the default text (even when entering/exiting the zones) until the second tab entered a zone, and then the two tabs would show the exact same thing. Then for some reason switching tabs made the player limiter glitchy, so I used two computers, and it was the same problem, except the main computer/tab never updated.

This is a bit long, so if you need clarification on anything, let me know.


  1. I realized I’d need another trigger to actually update the placements. ↩︎

3 Likes

@here, I’m bumping this because it’s been a few days and there’s been no replies.

1 Like

I’m bumping this again with an update: I tried replacing the “Get Property: playerID” in the first trigger with “Convert Number To Text: Get Property: playerID” and it still doesn’t work.

TBH it isn’t that complex, the most complex part is comparing all of the properties, but right now I’m just having two players to test.

Wait, what do you do to compare all the properties?

Here’s the system I made for two players:

if (playerID = 1) do {
 if (Get Property: checkpoints1 ≥ Get Property:  checkpoints2) do {
  Set Property: (playerRank) (Value: 1)
 } else {
  Set Property: (playerRank) (Value: 2)
 }
}
if (playerID = 2) do {
 if (Get Property: checkpoints2 ≥ Get Property:  checkpoints1) do {
  Set Property: (playerRank) (Value: 1)
 } else {
  Set Property: (playerRank) (Value: 2)
 }
}

What about for more players?

I am planning to add more if blocks when I add more players.

Ok, I was just seeing if you had something super efficient, because I’ve been working on comparing a bunch of number properties without a ton of if statements

1 Like

Unfortunately I don’t think there’s a way. You could create a help topic for that though just to double-check.

I have an idea. Basically have a counter for each property, and have each of them count down. When each hits zero it will trigger a trigger that concatenates the order they hit zero into a new property that can be used. It’s hard to explain :man_shrugging:

2 Likes

Bump since this still has yet to be solved

remember you said you couldn’t use zones, what about the coordinate device, checking on different x and y coordinates?

that should go well with my idea, but i am not sure if this could actually work

Edit: i just realized about scope, the device does not say anything about scope

I can’t use too many properties, not zones.

The tracks are a little too complex for that.

that makes a lot of sense, i will see if i can find anything tomorrow

1 Like

Hi, you can use this : ` can at the start and end of code to make it look nice
three of them if it’s multi line like yours
also please properly indent your code

tada!
    if (7 > 4) {
        variable++
    } else {
     somethin
    }
4 Likes

I can’t do indents on mobile, so I had to use spaces, but hopefully it’s more readable now!

2 Likes

Bump