• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Voting System

Level 5
Joined
Jun 30, 2008
Messages
84
Voting System by PureOwnage
Note: Please note that this comes from my thehelper.net account.
Table of Contents
I: What is a Voting System?
II: How do I make it?
II:1 Making the buttons and dialog
II:2 Giving your Vote
II:3 Winning Triggers
II:4 Result Triggers
II:5 Difficulty Triggers
III: Tips and Tricks
IV: Wrap Up

What is a Voting System?
A voting system is a system run by dialogs and variables. A voting system can be used to create a fair kicking system, a way of fairly selecting modes and many more useful systems. There are at least 3 variables for the casting the vote, winning, and setting the difficulty for every difficulty. Also, 4 variables for the dialog box and buttons. For more tips for the this system, look at the tips and tricks located near the bottom of this post.

How do I make it?
Well first of all, I suggest you study dialog basics made by AceHart: Dialog Box Tutorial - Choose a Hero (thehelper.net)

II:1 Making the buttons and dialog

This voting system is based for TD's.

Starting off, you will need 5 variables. Online_Players (As a player group); Players_User (As a player group also); Easy , Normal, and Hard (As a dialog button), and finally for the most important part, make a variable called Voting (as a Dialog)

Set Online_Players to this:
Code:
Set Online_Players = (All players matching (((Matching player) slot status) Equal to Is playing))

And Players_User to this:
Code:
Set Players_User = (All players controlled by a User player)

Then we need to make the dialog box and the dialog buttons by doing this:
Code:
Dialog
    Events
        Time - Elapsed game time is 4.00 seconds
    Conditions
    Actions
        Set Online_Players = (All players matching (((Matching player) slot status) Equal to Is playing))
        Set Players_User = (All players controlled by a User player)
        Dialog - Clear Voting
        Dialog - Change the title of Voting to Difficulty
        Dialog - Create a dialog button for Voting labelled Easy - 5 Armor Redu...
        Set Easy = (Last created dialog Button)
        Dialog - Create a dialog button for Voting labelled Normal - 0 Armor Re...
        Set Normal = (Last created dialog Button)
        Dialog - Create a dialog button for Voting labelled Hard - 5 Armor Bonus
        Set Hard = (Last created dialog Button)
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) is in Online_Players) Equal to True
                        ((Picked player) is in Players_User) Equal to True
                    Then - Actions
                        Dialog - Show Voting for (Picked player)
                    Else - Actions
                        Do nothing
The variables will detect if a player is a user and if he or she is playing.

It should look like this so far:
DialogFix3.png


II:2 Giving your Vote

Create 3 variables, EasyVote, NormalVote, and HardVote (real variables)
And then make three different triggers.
Code:
Easy Vote
    Events
        Dialog - A dialog button is clicked for Voting
    Conditions
        (Clicked dialog button) Equal to Easy
    Actions
[code=jass]
Custom script:   call DisplayTextToPlayer( Player(0), 0, 0, GetPlayerName( Player(0) ) + " has voted for Easy" )
Set EasyVote = (EasyVote + 1.00)
[/CODE]
Code:
Normal Vote
    Events
        Dialog - A dialog button is clicked for Voting
    Conditions
        (Clicked dialog button) Equal to Normal
    Actions
[code=jass]Custom script:   call DisplayTextToPlayer( Player(0), 0, 0, GetPlayerName( Player(0) ) + " has voted for Normal" )
Set NormalVote = (NormalVote + 1.00)
[/CODE]
Code:
Hard Vote
    Events
        Dialog - A dialog button is clicked for Voting
    Conditions
        (Clicked dialog button) Equal to Hard
    Actions
[code=jass]Custom script:   call DisplayTextToPlayer( Player(0), 0, 0, GetPlayerName( Player(0) ) + " has voted for Hard" )
Set HardVote = (HardVote + 1.00)
[/CODE]

It should look something like this:
Dialog2.png

II:3 Winning Triggers
Make 3 variables, EasyDiff, NormalDiff, and HardDiff (all boolean)
Add some text saying that easy ,normal , and hard won and it should look like this:
DialogFix2.png


II:4 Result Triggers

Well people may want to know how many votes a difficulty got so to make it, do this:
Code:
TimeUp
    Events
        Time - Elapsed game time is 10.00 seconds
    Conditions
    Actions
        Game - Display to (All players) the text: |c0000FF00NOTICE:|r Voting has ended.
        Game - Display to (All players) the text: |c00FFFF00Results:|r
        Game - Display to (All players) the text: <Empty String>
        Game - Display to (All players) the text: (|c0000FF00Easy:|r + (String(EasyVote)))
        Game - Display to (All players) the text: (|c00FFFF00Normal:|r + (String(NormalVote)))
        Game - Display to (All players) the text: (|c00FF0000Hard:|r + (String(HardVote)))
        Set TimeUp = True
The empty string is only for spacing. It will make your Results look better....
It should look like this:
TimeUp.png


II:5 Difficulty Triggers

Time to give the modifiers!
Make a trigger similar to this:
DialogFix.png

You can modify the part where it says a unit enters Buff.
This is based off a TD map so you can change it so that you put a whole entire map under a region called buff.

Making the spells are easy. Make 3 similar spells to Spiked Carapace each having a different defense bonus.

III: Tips and Tricks

Other ways to use this system is to use different bonus effects and buffs. For example, you can do something like -20 speed for easy, 0 for normal, and +20 for hard. Giving color to your voting system makes it more appealing to the eye.

IV: Wrap Up
Thank you for looking at this tutorial.


Changelog (Tutorial):

Version 1.01: Fixed Winning Triggers
Version 1.02: Fixed Grammar Errors
Version 1.03: Made Dialog Easier to Make


Changelog (System):
Version 1.01: Made Result System
 
Last edited:
Top