• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Vote for number of Kills

Status
Not open for further replies.
Level 7
Joined
Apr 13, 2008
Messages
183
Hi All!
I need help with at trigger:
At the beginning of the game a menu pops up for all players and they can between 3 options:
20 Kills to win
30 Kills to win
40 Kills to win
After every player has chosen an option the game finds the option the most people clicked and sets the number of kills needed to win to the chose amount (The Kills should be a variable I think). And after someone gets the chosen amount of kills he wins.
Thank you! :thumbs_up:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I want to give you the honor of creating the trigger, though it would be a lot faster if I did it myself, since explaining everything takes a while I guess ^^

Kills should always ve a variable, yes... (with an array).
You will need to think about: which vote will win when 2/3, or all of them have equally much votes? (e.g.: there are 3 players, everyone picked another option).
I personally like the avarage, though: if everyone picks another option, the avarage is obviously the middle option, if 2 players pick 40, another one 20, the avarage is 33.
Then every player gets what he wants, so there will be no whining.

To start with the trigger, you should make a dialog and show it to everyone (unless you choose another method), then you create a trigger with the event "Dialog - dialog button is clicked" or something like that and as condition "Boolean variable[number of triggering player] = false" (I'll explain that later on).
Inside that trigger, place 3 if/then/elses, each one with the condition "Dialog - clicked dialog button is (1/2/3)".
In the actions, you should increase an integer variable, if the first option is picked (first if/then/else), set the variable to [variable + 20], the second [variable + 30], the third [variable + 40].
Also, when a dialog button is clicked (doesn't matter which one, you can leave it outside the if/then/elses), set the boolean variable with as array the number of the triggering player to true (at map init, set that variable of all non-playing slots to true as well), so a player may only vote if they did not vote yet and if they are playing and not NPC's.

When the boolean variable for all players is true, then do:

Set KillsReq = Integer/(# playing users).

And you're done :D
 
Status
Not open for further replies.
Top