JAVA (Just another Voting Asset)

Siretu

Starcraft 2 Editor Moderator
Staff member
For previous maps I just searched SC2mapster for a voting system instead of writing my own but I felt all the ones I found lacked some key features. So for my new map I decided to write a very customizable voting system with all the features I feel are needed.

You specify the amount of things to vote for, the amount of choices each thing you vote for has(so you can vote for one thing that has two options and one that has three), you also specify the names of the different things, possibly the timeout timer.

You can also specify some constants on the dialog but they come with some decent values.

One of the things I like about it is that it automatically scales up your dialog depending on the amount of buttons you have so you don't have to specify the exact width and height.



The colored line shows the different constants you can change to change the dialog's size.

Blue is Vote Edge Offset.
Red is Choice Gap
Yellow is Vote gap(basically the distance between the different things you vote for)
Pink is Choice Button Width
White is Choice Button height.

Features:
  • Automatically scales width and height to fit your settings.
  • Allows you to vote for several different things with different amount of choices.
  • Timeout timer
  • Allows you to change your votes around.

Tutorial:

Basically, there are 2 parts to edit.

* The appearence of the dialog box
* The polls and all the button info.

Dialog Appearence:

The library comes with some default values that work fine. If you do want to edit it, the variables you need to edit are: Vote edge offset, choice gap, vote gap, choice button width and choice button height. Use the picture above for reference on how to use them.

Poll info:

There's a couple of places to modify to fix this part.

First place is the Init Vote Options function. It comes with some default stuff(that you probably want to change) but it should help you to get started.

Basically:
Vote Options.Polls = the amount of polls(things to vote for)
Vote Options.Choices[x] = the amount of choices for the Xth poll.
Vote Option.Choice Names[x][y] = The name of the Yth choice on the Xth poll
Vote Options.Poll names[x] = Name of the Xth poll.

To modify the things that happens when a choice is voted for, go to Apply vote results. For each poll you need a switch and for each choice you need a case in the switch. You should be able to figure it out from the defaults in there.

You might also want to modify the Timeout time. That is the time you have to vote before the vote expires.


Download: View attachment JAVA.SC2Lib
 

GFreak45

I didnt slap you, i high 5'd your face.
is this system capable of getting an average number out of the votes? ie: someone votes for 0 and someone votes for 150 and it returns 75
 

Siretu

Starcraft 2 Editor Moderator
Staff member
No, but it should be relatively easy to implement.

Edit:

I haven't tried this out but the apparent solution would be to modify the "Voting Done" function and change:

Trigger:
  • General - For each integer a from 0 to (Vote Options.Polls - 1) with increment 1, do (Actions)
    • Actions
      • Variable - Set max = 0
      • General - Pick each integer from 0 to 9, and do (Actions)
        • Actions
          • Variable - Set Total votes[(Picked integer)] = 0
      • Player Group - For each player b in (Active Players) do (Actions)
        • Actions
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • Player Vote[a]<b> != -1
            • Then
              • Variable - Modify Total votes[Player Vote[a]<b>]: + 1
            • Else
      • General - For each integer b from 0 to Vote Options.Choices[a] with increment 1, do (Actions)
        • Actions
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • max &lt; Total votes<b>
            • Then
              • Variable - Set max = Total votes<b>
              • Variable - Set max index = b
            • Else
      • Variable - Set Player results[a] = max index
    • </b></b></b></b>


to
Trigger:
  • General - For each integer a from 0 to (Vote Options.Polls - 1) with increment 1, do (Actions)
    • Actions
      • Variable - Set total = 0
      • General - Pick each integer from 0 to 9, and do (Actions)
        • Actions
          • Variable - Set Total votes[(Picked integer)] = 0
      • Player Group - For each player b in (Active Players) do (Actions)
        • Actions
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • Player Vote[a]<b> != -1
            • Then
              • Variable - Modify total: + (Integer(Vote Options.Choice Names[a]<b>))
            • Else
      • Variable - Set Player results[a] = (total / (Number of players in (Active Players)))
    • </b></b>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is online though at night
  • The Helper The Helper:
    You would probably have to take a loan to get the Rice cert it is like 14l
  • The Helper The Helper:
    I was hoping you were going to say you wanted to be a cook and wished to open up a Food Truck there are so many opportunities for that here
  • The Helper The Helper:
    you can only open the bar if you sell food and a food truck in the parking lot counts
  • The Helper The Helper:
    here in houston
  • The Helper The Helper:
    most bars are struggling to build food prep and even some I know are doing there own food trucks
  • The Helper The Helper:
    but yeah man you should come to Houston there is so much more opportunity here than San Antonio. Just look at all the homeless people on the Riverwalk and downtown there you cannot even walk down the street without getting mobbed them
  • The Helper The Helper:
    check out this place apparently it is the best roommate site out there roommates.com lol
  • Varine Varine:
    The homeless people reminded me of New York
  • Varine Varine:
    I'll check it out, my lease expires in like a few months so I need to figure something out.
  • Varine Varine:
    I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
  • Varine Varine:
    I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
  • Varine Varine:
    Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
  • The Helper The Helper:
    i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
  • The Helper The Helper:
    Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
  • The Helper The Helper:
    Just not enough food trucks
  • The Helper The Helper:
    a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
  • The Helper The Helper:
    He is in the different food facebook groups in houston and posts videos of him making his food
  • The Helper The Helper:
    he is killing it
  • jonas jonas:
    @Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
  • jonas jonas:
    I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
  • jonas jonas:
    My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
  • Ghan Ghan:
    The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
  • tom_mai78101 tom_mai78101:
    I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top