This is it! This is a victory for me! The most difficult script I’d ever made. After a long long long long research with my retarded friends (they can’t make it clear), and ignorant unity answers people, i finally can make this script works! Back then, Door Script and Elevator Script are the most difficult script when i was new to Unity (not sure if new to Unity or just retarded).
How Does It Work ?
Well… It’s pretty simple. I design the concept on conversation lesson (thursday). And this is the concept i made
- Add new script that manages player’s current rank. I named it RANKERS.JS
- On rankers.js, i set the Distance to Waypoint value same with waypoint’s player distance
- On waypointer.js, it has 18 lengths player distance float array that manages distance to waypoint according to their car id and then sort it.
- Back on rankers.js, it checks sorted distance in waypoint script, which ones that has same distance to waypoint value with distance sorter and then return the index.
It’s so simple. Simplest than i checked on google. However, this script still has some bugs.
- Current Rank always be #1 if other player are too far or in other waypoint. SOLUTION : I’ll attach Distance Sorter script to GM.
- It doesn’t work when you just started the game.
I hope i can fix this.