hey guys i have a noob question.

i'm trying to program this little text based RPG, i've made several but you're always controlling only 1 character and fighting 1 enemy, i want to change that and make you take control of 4 characters and fight 1-4 enemies at once (turn based)

the problem lies with checking who has the highest speed stat, i want to make an algorithm that selects who has the highest speed, put him in 1st place (attacking first) then who has the 2nd highest speed stat and so on.

There are many ways you could go about that. I don't have any algorithm, but one way, Get the speed, go through the other speeds and for each speed its faster than +1 to the priority. Hopefully the example below explains what i'm getting at. So the highest priority goes first.

Player Speed 1: 17 - Faster than 4 others
Player Speed 2: 13 - Faster than 2 others
Player Speed 3: 12 - Faster than 0 others

Enemy Speed 1: 14 - Faster than 3 others
Enemy Speed 2: 12 - Faster than 0 others
Enemy Speed 3: 18 - Faster than 5 others

What you are looking for is a sorting algorithm, there are a few of these and they vary in complexity from the recursive Quicksort to a simple Bubble sort.

This tutorial gives you code and a more in depth explaination:http://www.publicjoe.f9.co.uk/csharp/sort00.html

commented: Nice site suggestion. +6

A simple bubblesort will indeed do the trick here. Also, remember that classes like Array or List have a Sort method.

oh thanks a lot guys, i'll give this a shot.

a few days ago i tried doing it with a bunch of ifs and elses but with so many characters at once (possibly 8) there were just way too many combinations, it would have taken me about 1000 lines of code just to do that.

where's the "solve" button? >.>

What do you mean by "solve" button?

at the bottom of the page, just above the reply box is a link that says "Mark As Solved" :) Remember to come back if you need help with your sort