Vote Difficulty

AnthraxXx

New Member
Reaction score
25
Hello there,

I'm trying to make a Vote Difficulty option instead of having Red pick it, as this is rather unfair and not everyone will be happy with this. I see in a lot of other maps (I'm making a TD) that other people can "Vote" to choose a difficulty, and if one person chooses too low and other choose too high it averages it out and finds the "middle" option of the two.
Eg 2 Players:
Player 1 Chooses Easy
Player 2 Chooses Hard
The Difficulty Option is Normal.

My map will have 7 players, so you won't need to write out the whole trigger. Just tell me what I need to copy and change to suit my needs.

I've done the dialog I guess, but can't finish it as I don't know how to do the vote system.

I've searched the forums and googled it and have found no tutorials indicating how to do this. If you are too lazy to write it out but know a place which could tell me then just reply with a link/PM me it.

+rep to anyone who helps.

Thanks!
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Assuming your votes are stored in an array,
something like
set Votes[1] = Votes[1] + 1 when "easy" was selected:

Set Total = 0
Set Count = 0
For each Integer A from 1 to <number of options>
- If Votes[Integer A] greater than 0
- - Set Count = Count + 1
- - Set Total = Total + Votes[Integer A]

Average = Total / Count

If you need, or want, to round up / down:
Average = Integer(Real(Total) / Real(Count) + 0.5)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top