• 🏆 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!

Income leaderboard please help

Status
Not open for further replies.
Level 2
Joined
Jun 30, 2015
Messages
17
Hey guys, im currently making a map that i hope will be pretty popular, but thats not the point. Currently, we are putting the finishing touches on the map, but i cannot figure out how to display the current income for each player in a leaderboard. I know how to display integer values but because the income fluctuates as the game goes on, i need to figure out how to make the game display this. (Example if a player owns cities xyz, they recieve 18 gold when the income timer expires, and if they were to take over cities abc then their income would increase to 30)

please help soon, i was hoping to launch the first patch this weekend.:vw_wtf:
 
Level 2
Joined
Jun 30, 2015
Messages
17
But what do i do for when they take over another set of cities, how would i make it display that new number without having to set the conditions for every single city in the game. if i were to set it for every city, i would need 529 different triggers, which i am not up for.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You need an event for when a player has conquered another city.
I assume you know when that happens as it has to be triggerred in the first place.

At that moment, you do that
"Leaderboard - Change the value for Player (whatever) in (Your leaderboard) to IncomeInteger"
again
 
Level 2
Joined
Jun 30, 2015
Messages
17
IncomeInteger? is that a variable you guys made or is it in the game somewhere? i cant seem to find it in the list of variables... There are 23 different regions in the game so there are 529 different combinations of ownership, so unless that income integer thing is part of the game where it relays current income, ill just label the regions with some floating text.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
IncomeInteger? is that a variable you guys made or is it in the game somewhere? i cant seem to find it in the list of variables... There are 23 different regions in the game so there are 529 different combinations of ownership, so unless that income integer thing is part of the game where it relays current income, ill just label the regions with some floating text.

You are supposed to create this variable, it is not already existing.
 
Level 2
Joined
Jun 30, 2015
Messages
17
Does it track the income of a player through changes? like if i were to lose 5 gold per turn would the variable adjust? I know about regular integers and that they dont change but is this one any different? if you guys have ever played Middle Earth Risk by Kamuel or something like that, thats the type of income leaderboard i would like
 
Level 12
Joined
May 22, 2015
Messages
1,051
How do you have it set up currently? Is it just adding gold based on what cities the player has?

How is it added? Is there one single timer that gives all the players their money when it expires?

If it is not set up nicely using a variable to keep track of each player's income, you could potentially see how much gold each player has gained during an income cycle by checking their gold before adding any and checking it again after all the gold income has been added. Then you update the income to be the difference in gold.
 
Level 2
Joined
Jun 30, 2015
Messages
17
Event: I have it set up to Timer_income expires
Conditions: owner of city x is equal to owner of city y
owner of city y is equal to owner of city z
actions: add 18 gold to the owner of city x

ok SAUS how would i make it to where one variable represents the income of a player and store the difference as a new variable and display that in the leaderboard. i know how to display a variable but i dont know how i would display a before and after. and i would have to make the game redo this function every 70 seconds. does anyone know how Kamuel did his income system without doing every possible combination?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Is there a separate trigger for every city? That would make if very hard.
 
Level 2
Joined
Jun 30, 2015
Messages
17
no no, just for every set of cities, of which there are 23. example, lets say we have california as a region, if someone owns san diego, vegas, and sacramento, they get the 18 gold. ive just decided to label the regions with some floating text, they can find out how much they get per turn, if i figure out how to do it, ill add it in a future patch. thanks for the help though guys.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Ohhh I see. You don't get income per city, but rather income per set of cities.

For my solution, it would probably be easiest to put all of the income triggers into one trigger (one event and then have it check each set of cities). You'd have an array of integers big enough for each player.

Then you would have at the beginning (above the checks for all of the cities) a check to see how much money each player has has and store it into the array like this:
  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Set playerGold[(Integer A)] = ((Player((Integer A))) Current gold)
Note that 1 to 6 is just an example. Make it so it gets all the playing players (might be better to use a player group and instead of Integer A, use the convert player to integer function to store it in the right spot in the array).

And then at the end of the trigger, you'd have something similar to calculate how much gold was earned. Like this:
  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Set playerGold[(Integer A)] = ((Player((Integer A))) Current gold) - playerGold[(Integer A)]
This will get how much more gold they have compared to before. Then you update the multiboard with the numbers in the array.
 
Level 2
Joined
Jun 30, 2015
Messages
17
THANKS SAUS! i dont know all the details of what you just said, but i think i can figure it out with some practice. if you would like, for helping me out ill make you a wandering unit in the game. All the artists for the custom models are going to get one because i think its important for everyone to get credit for their work. If you guys are curious about the map, i started a thread about it. Heres the Link: http://www.hiveworkshop.com/forums/map-development-202/alternate-middle-earth-home-page-267247/ . It is title Alternate Middle Earth, more info in that other thread.
 
Level 2
Joined
Jun 30, 2015
Messages
17
would this work to start with SAUS?

Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Set NEWINCOME[(Integer A)] = (Player 1 (Red) Current gold)
Set Player2gld[(Integer A)] = (Player 2 (Blue) Current gold)
Set player3gld[(Integer A)] = (Player 3 (Teal) Current gold)
Set player4gold[(Integer A)] = (Player 4 (Purple) Current gold)
Set player5gld[(Integer A)] = (Player 5 (Yellow) Current gold)
Set player6gld[(Integer A)] = (Player 6 (Orange) Current gold)
Set player7gld[(Integer A)] = (Player 7 (Green) Current gold)
Set player8gld[(Integer A)] = (Player 8 (Pink) Current gold)
Set player9gld[(Integer A)] = (Player 9 (Gray) Current gold)
Set player10gld[(Integer A)] = (Player 10 (Light Blue) Current gold)
Set player11gold[(Integer A)] = (Player 11 (Dark Green) Current gold)
Set player12gld[(Integer A)] = (Player 12 (Brown) Current gold)
 
Level 12
Joined
May 22, 2015
Messages
1,051
would this work to start with SAUS?

Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Set NEWINCOME[(Integer A)] = (Player 1 (Red) Current gold)
Set Player2gld[(Integer A)] = (Player 2 (Blue) Current gold)
Set player3gld[(Integer A)] = (Player 3 (Teal) Current gold)
Set player4gold[(Integer A)] = (Player 4 (Purple) Current gold)
Set player5gld[(Integer A)] = (Player 5 (Yellow) Current gold)
Set player6gld[(Integer A)] = (Player 6 (Orange) Current gold)
Set player7gld[(Integer A)] = (Player 7 (Green) Current gold)
Set player8gld[(Integer A)] = (Player 8 (Pink) Current gold)
Set player9gld[(Integer A)] = (Player 9 (Gray) Current gold)
Set player10gld[(Integer A)] = (Player 10 (Light Blue) Current gold)
Set player11gold[(Integer A)] = (Player 11 (Dark Green) Current gold)
Set player12gld[(Integer A)] = (Player 12 (Brown) Current gold)

You should use one array variable. It should be like my example except replace 6 with 12. I can write the triggers to get the amounts, but it'll probably be a bit later. I am a bit busy for the next couple weeks.

Instead of "(Player 5 (Yellow) Current gold)" there should be something like "Conversion - convert player index to player" or something like that. I forget the exact name of the function, but you do it when you are selecting a player for finding how much gold they have. Basically, you want to choose that function and then put Integer A in there so it loops over all the players.

If you want to skip that way, then don't put the loop at all. You still want just 1 array variable, so it would look like this:
  • Events
  • Conditions
  • Actions
    • Set playerGold[1] = (Player 1 (Red) Current Gold)
    • Set playerGold[2] = (Player 2 (Blue) Current Gold)
    • Set playerGold[3] = (Player 3 (Teal) Current Gold)
    • Set playerGold[4] = (Player 4 (Purple) Current Gold)
    • Set playerGold[5] = (Player 5 (Yellow) Current Gold)
    • Set playerGold[6] = (Player 6 (Orange) Current Gold)
    • Set playerGold[7] = (Player 7 (Green) Current Gold)
    • Set playerGold[8] = (Player 8 (Pink) Current Gold)
    • Set playerGold[9] = (Player 9 (Gray) Current Gold)
    • Set playerGold[11] = (Player 10 (Light Blue) Current Gold)
    • Set playerGold[10] = (Player 11 (Dark Green) Current Gold)
    • Set playerGold[12] = (Player 12 (Brown) Current Gold)
Note how it is like playerGold[#] = Player # (...) CurrentGold. Using the loop from 1 to 12 will make it do all this without you having to write it 12 times.
 
Status
Not open for further replies.
Top