HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to make a voting system?

02-09-2004, 11:23 PM#1
Huh
I'm trying to set my map up with a player selectable difficulty level (think Enfos team survival). In my map however, the harder diff. levels will simply increase the speed of which mobs spawn. I have an idea as to how to setup the diff. speeds for each diff. level, but I have no clue how to set up a vote to choose with difficulty is selected.

My map has 10 players max. I want to make it so the difficulty level selected by the most players (this will be done with dialog boxes) is the one that gets set. How could i do this? I know its pretty simple with triggers, but I've never done anything like that before so I could use some advice :)

-Huh
02-10-2004, 12:05 AM#2
tassadar920
Just make a few integers for each possibly choice of difficulty, and then hav ea few if statements and whichever one is found to be biggest sets the difficulty.
02-10-2004, 01:32 AM#3
Huh
Ok I've got the variables setup etc. How do I compare them to each other in order to decide what difficulty gets set? ATM I have 3 diff. levels. A trigger has event- dialog button is clicked. then it has 3 if/than/else statements, one for each diff. level. They are condition- button clicked = **, action- set integer to integer +1. One of those statements for each difficulty. Now I just need a way to compare the 3 integers to see which ones the highest...

-Huh

edit- nevermind i think i figured it out. Thanks tass
02-10-2004, 02:23 PM#4
shadow)ps(
dont know exact trigs, but basically, make triggers that compare one integer to other integers, i think its in integer comparison in conditon. do, for example. easy's integer is more than medium and hard. then change it around to make it medium more than easy and hard, etc etc. thats how i have mine set up, which is a pretty good setup.
02-10-2004, 07:33 PM#5
Huh
ya i have it setup that way, but problem is when theres only 2 people (as in testing with my friend) playing, and we both pick different diff. levels. when that happens, if i have conditions set to greater than, it will not fire either trigger for difficulty level because neither one is bigger than the other. If i have them set to greater than or equal to, it fires them both because theyre both equal to each other.

Perhaps I could use greater than, and make a separate if/than/else with conditions that Or- any conditions are true... easy = normal, easy = hard, normal = hard, actions- fire normal difficulty trigger.
Would that not cause any ties to automatically go to normal? Havnt had a chance to test it with my friend yet so post if you think it would work.
02-10-2004, 07:37 PM#6
LegolasArcher
Make some Greater than or equal to
02-10-2004, 07:46 PM#7
MysticGeneral
If there are 2 players, do this...

Variables Needed:
Hard (Dialog Button Array size x players)
Easy (Dialog Button Array size x players)
VoteDialog (Dialog Array size x players)
TotalHard (Integer)
TotalEasy (Integer)

Triggers:

Code:
Dialog Setup and Show
    Events
        Time - Elapsed game time is 0.01 seconds
    Conditions
    Actions
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                Dialog - Create a dialog button for VoteDialog[(Integer A)] labelled Hard
                Set Hard[(Integer A)] = (Last created dialog Button)
                Dialog - Create a dialog button for VoteDialog[(Integer A)] labelled Easy

Code:
Dialog Add Vote
    Events
        Dialog - A dialog button is clicked for VoteDialog[1]
        Dialog - A dialog button is clicked for VoteDialog[2]
    Conditions
    Actions
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) Equal to Hard[(Integer A)]
                    Then - Actions
                        Set TotalHard = (TotalHard + 1)
                    Else - Actions
        For each (Integer A) from 1 to 2, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) Equal to Easy[(Integer A)]
                    Then - Actions
                        Set TotalEasy = (TotalEasy + 1)
                    Else - Actions

Sorry a bit buggy (wc3c)
02-10-2004, 08:06 PM#8
Huh
MysticGeneral .. thats almost exactly how i have mine setup :)

Theres another trigger though that compares the integers to each other. Problem I was having was with the comparisons. I think i have it worked out though. If it still doesnt work after i get my friend to help me test, ill post a reply.
02-10-2004, 08:09 PM#9
MysticGeneral
PM me if you would like me to setup your triggers and such for 5 points.
02-10-2004, 10:26 PM#10
Huh
Ok, I'm still getting is if more than one variable is equal to another, then it spawns them both. In my last single player test, I picked easy, but as a result normal and hard were equal so it started the easy AND normal trigger (normal is default if variables are = to one another). I don't know WHY this is so difficult for me lol.

I just want it to do this:

There will be 1-10 players in the game.
At start, dialog box has 3 buttons, easy,normal,hard.
If easy has the most clicks, then game is set to easy, same for normal and hard.
I don't want it to start two difficulty levels at the same time which is what keeps happening for me.
Anyone see a big flaw in my thinking here?
How can i tell the trigger to only start the highest integer (variable)? LegolasArcher mentioned make some greater than or equal to.. which ones? I tried using greater than or equal to but as a result, if two integers were equal than it started both difficulty levels. ARGH lol. Plz post if you see the solution ^_^

-Huh
02-11-2004, 01:17 AM#11
Huh
Jeez I'm running out of ideas here. Any help at all is appreciated...

-Huh
02-11-2004, 01:38 AM#12
Bulletcatcher
Code:
If 
  totalNormal greater than or equal to totalHard 
  totalNormal greater than or equal to totalEasy 
Then
  <Do Normal Difficulty Actions>
Else
  If
    totalEasy greater than or equal to totalHard
  Then
    <Do Easy Difficulty Actions>
  Else
    <Do Hard Difficulty Actions>

This will pick the difficulty with the most votes, preferring Normal over the others, and Easy over Hard.
02-11-2004, 01:52 AM#13
Huh
Wow thanks a ton bulletcatcher! I'm gonna try to get my buddy to help me test it over b.net to see how it works. It's alot cleaner than my other setup. Man i really hope it works, because after this all i have left to do is teach myself how to make trigger enhanced spells ^_^.

-Huh
02-11-2004, 02:30 PM#14
shadow)ps(
if that doesnt work, just check the reply i made on my oiriginal posting for leaderboard help.