Forum rules - please read before posting.

Leaderboard

I have made a very simple leaderboard, where I with variables compare them to one another and based on that output to a specified label.

Is there any way to make "loop", say if I had 20 players without having to go through each "manually" and without making a custom script?
Right now it's pretty much "a tree", first comparing two, eliminating one, comparing the next etc...can this be more "automated"?
Any direction would be much appreciated
Cheers, Dan

Comments

  • This is to what, arrange variables in order?

    I don't know what your current arrangement looks like, but you could simplify things by using ActionList parameters to set the Variables being checked dynamically.

    However, I'd recommend custom scripting if you can - even if something can be done with a network of Actions, sometimes a task is just better suited to dedicated code.  It wouldn't take much to take an array of variables, sort by value, and then set a series of labels accordingly.  You will have to provide more detail about the specifics of your situation if you need more advice on that, though.
  • edited September 2017
    Yes, it was meant to arrange variable in order.
    I have made a score system, mimicking the likes in Hay Day, Farmville etc, where the level will increase when a score has been reached and based.

    I have "hardcoded" the the other players (kind of old amiga games etc) to give it some competitive element.

    I have a variable for the level and a variable for the score - the way I so far has done it is just to compare the score - and the one with the highest score will be number 1 - then I eliminate that and look who is second etc. For labels I both output namel, level and score (was also trying to come up with a "profile pic" solution, but wasn't sure how to correctly show a specific for a specific person - suddenly it reminded me of some database stuff)

    If there is a smarter way to do this, I would love to learn - it was exactly some kind of array solution I was looking for. I'm having so much fun coming up with all kind of stuff with actionLists, but if it's not possible, then I have to go with dedicated code - that right now is a little more out of skillset - 
    I intent to have 10 players on the list (9 are hardcoded so I can play and test scores and change if needed) - where I need to show name, level and score and a profile pic. 
    Any direction would be much appreciated.




  • edited September 2017
    So the "hardcoded" scores are in Actions rather than other variables?  About the labels, I meant where/how are you displaying them?  As Variable tokens?

    About custom code, as this isn't specifically adventure-related I would recommend asking on the Unity forums about it.  Ignoring AC for the moment, look into having a script get the player's score from a regular integer that you can set in it's Inspector, and check against a List of other scores, i.e.:

    public int playerScore;
    public List<int> otherScores = new List<int>();

    Once you've got a script and can turn those into an array of strings (the labels), we can help you connect it back to AC, i.e. reading the player score Variable and writing the labels to Menus.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.