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

[Trigger] How to calculate the position of players in multiboard?

Status
Not open for further replies.
Hi,

The multiboard should look like this

==title==
player kills
Alliance 0
-
-
-
Horde
-
-
-

Will you advice me how to set the positions(rows) of the existing players, so I can later change their column 2, kills?

This is what I did and it's kinda working, but I think it's wrong :thumbs_up:

  • Multiboard - Change the number of rows for (Last created multiboard) to (2 + ((Number of players in Team_ALLY) + (1 + (Number of players in Team_HORDE))))
I wanto to put the "horde" row after the alliance player...
  • Multiboard - Set the text for (Last created multiboard) item in column 1, row (2 + (Number of players in Team_ALLY)) to |c00FF0303Horde|r
I want to set the player position...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Owner of Paladin) controller) Not equal to None
    • Then - Actions
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row (2 + (Player number of (Owner of Paladin))) to (Name of (Owner of Paladin))
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row (2 + (Player number of (Owner of Paladin))) to Show text and Show icons
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row (2 + (Player number of (Owner of Paladin))) to ReplaceableTextures\CommandButtons\BTNHeroPaladin.blp
    • Else - Actions
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
Have an array of integers that stores what row each player is in. When you initially add players to the multiboard set the array value using the player's number (id) as the index of the array.
Kind of like that but you need more complex logic for row allocation that takes account of things like headers and spaces. You also need a system for when players leave (unless they still affect the game) to reallocate the rows and resize the board.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
Its the same question I answered... You just map the players to rows without spaces between them. This generally is done by mapping players sequentially.

Example...
Row 1 and 2 are headers, skip them.
Starting at row 3, give a number to everyone in team 1. Team 1 has players 1, 5 and 8 so player 1 is given row 3, player 5 is given row 4 and player 8 is given row 5.
Row 6 is defined as another header since it comes after team 1's listings.
Starting at row 7, give a number to everyone in team 2. Team 2 has players 2, 3, 4 and 6 so player 2 is given row 7, player 3 is given row 8, player 4 is given row 9 and player 6 is given row 10.
If there are any spare rows left over, resize the multiboard to remove them.
If a player leaves and no longer should be listed on the board, repeat mapping process from start without the player who left.

Rows become a sequence of space which you allocate from for certain purposes. In the example above rows 1, 2 and 6 were allocated for headers where as the other rows up to 10 were used for certain players. This is dynamic row allocation (hint, use integer variables) so the mappings will chance if the players change, eg without player 5 row 5 would be the header for team 2 and there would be 9 rows. You can do this mapping before you actually make the board and then from these mappings make the board (so no resizing needed).
 
Wait a second can't it be done like this
  • Multiboard - Change the number of rows for (Last created multiboard) to (2 + ((Number of players in Team_ALLY) + (1 + (Number of players in Team_HORDE))))
  • Multiboard - Set the text for (Last created multiboard) item in column 1, row (2 + ((number_of_playing_alliance_players) - ((number_of_playing_alliance_players - 1,-2 etc)))
  • Multiboard - Set the text for (Last created multiboard) item in column 1, row (2 + (number_of_playing_alliance_players + 2) to |c00FF0303Horde|r
  • Multiboard - Set the text for (Last created multiboard) item in column 1, row (3 + ((number_of_playing_alliance_players) - ((alliance players - 1)))
 
Don't you see that this is the calculation for moving? When a player leave I will decrease the value of number of_horde/alliance_players by -1. Do the calculation I wrote and tell me.

row = 2/3 + (number of_alliance/horde_players - (number of_alliance/horde_players - (number of player ))

plus there cannot be a "-"value in the result because if the hero does not exist this cannot be calculated.

edit: and I figuired out that this is upside down calculated order but who cares :D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
Yes that idea will work if done correctly. Basically you needed to have the rows as dynamic values as opposed to constants. Using variables to map the rows would have a caching effect and so make updating more efficient but if you seldom update it will not really be a problem anyway (also the GUI multiboard BJ functions are so inefficient anyway a bigger optimization is to switch to JASS).
 
I don't know how to do it in JASS. And on first place, I actually have no idea how to calculate the changing position of the players. ( I dont think now my calculation will be ok :( ). They all must have fixed position and the only change is that they go up if the player on upper position is not playing.
 
Last edited:
Status
Not open for further replies.
Top