• 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.

Looking for a way to show income

Status
Not open for further replies.
Level 4
Joined
Dec 10, 2015
Messages
85
So, I'm looking for a way to show the income in my map in a board.
The income is based on the amount of building owned by the player and the amound of ressources (represented by control point) owned by the team.
For example, if you have 3 gold income building and your team has 5 small control point and 1 big control point, you get :
(3 x 5 x 4) + (3 x 1 x 10) +100 = 190 as income
I would like to have a way to show this income in a board that will be updated over time. The income is gave to every player every 30 seconds.
It must be updated every 30 seconds or every time the income change (everytime an income building is built or everytime a control point is captured)

If someone can send me a trigger for this, it would be very helpful, thanks a lot :)
 
Level 9
Joined
Apr 23, 2010
Messages
312
Set variables for each player in your 30 second income interval that finds all those buildings/towers for the specific player. Example...
  • Untitled Trigger 001
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Set TempPlayerGroup = (All players matching (((Matching player) slot status) Equal to Is playing))
      • Player Group - Pick every player in TempPlayerGroup and do (Actions)
        • Loop - Actions
          • Set PlayerInteger = (Player number of (Picked player))
          • Set TempGroup = (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to *Your Building*))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set GoldBuildings[PlayerInteger] = (GoldBuildings[PlayerInteger] + 1)
      • Custom script: call DestroyForce(udg_TempPlayerGroup)
Do this for each building you want to add to the income then add them all together with your equation and display it to the board. Also
you will need to create a new integer variable for each type of building you want to add to your equation, so in addition to "GoldBuilding[]" you should also have something like "LargeCP[]" and "SmallCP[]".

Are you using a multiboard or leaderboard?
 
Level 4
Joined
Dec 10, 2015
Messages
85
I don't know honnestly, it will be my first time using board, what is the best between those two in this case?

BTW, I will add more building to the map later that will increases the income by even more.
For exemple, another gold building income that instead of adding 4 per small control point and 10 per great control point, there will be another building adding 12 per small ressources and 30 per great ressources.
Is there a simple way to do it even if I add more income building later?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Assuming you already know how to calculate the values of your income (because your income triggers work), all you have to do is show them in a multiboard/leaderboard.

First you want to make a variable so you can access your multiboard at any time (and update it's fields).
Then at map init (or 0.00 elapsed gametime because iirc, this wont work on init), you create a new multiboard and store it in your variable.

Then you have to decide how many rows and columns you want to have.
The amount of columns should be easy to do... ussually 1 for the player names and 1 for each value that you want to show.

The amount of columns is harder because you dont want to show 12 players when you are playing 1v1 but you dont want to show only 2 players when you play with 12 either.
You need 1 for the "header" texts/icons.
You need 1 for each player.

You set the static values like the title, header row values and maybe some more and set the display stuff right (proper size per column, hide/show icons/text, colored text, etc).

Every once in a while, you want to update your multiboard.
You loop through all players that are playing and set the values in the multiboard to the values of each player.
At the beginning of the loop (still outside of the loop), you set an integer variable to 1 (or 2) and increase it every iteration of the loop.
You use that as row index of your multiboard.
 
Level 4
Joined
Dec 10, 2015
Messages
85
okay, I have some problem right now with all this
First, I think I shall use multiboard for showing Gold AND lunmber income
now, when you say to make a variable so I can access the multiboard at any time, I'm not sure to get it right. I mean, how do I do that, associate a multiboard to a variable?
What's the variable type should be?
I'm stuck here right now

PS: Sorry for not answering for a while, didn't worked on my map for a while ^^''
 
Level 9
Joined
Apr 23, 2010
Messages
312
okay, I have some problem right now with all this
First, I think I shall use multiboard for showing Gold AND lunmber income
now, when you say to make a variable so I can access the multiboard at any time, I'm not sure to get it right. I mean, how do I do that, associate a multiboard to a variable?
What's the variable type should be?
I'm stuck here right now

PS: Sorry for not answering for a while, didn't worked on my map for a while ^^''

To start the multiboard make sure the event is NOT initialization, but game duration 0.0 time instead. For some reason multiboards wont work properly, below is an example.

For the variable just create a new one (whatever name you want) with a variable type of 'Multiboard', like Wietlol said this will make it much easier to update your multiboard later.

  • Start Up
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 4 columns and4 rows, titled Statistics
      • Set MultiBoard = (Last created multiboard)
 
Status
Not open for further replies.
Top