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

How to make multiborad for each player

Status
Not open for further replies.
Level 5
Joined
Feb 6, 2008
Messages
134
How to make multiboard for each palyer?

Player 1 has own multiboard with name X and other vaules than player 2...
Player 2 has own multiboard with name Y and other vaules than player 1...
...
 
its pretty hard, you have to make 12 multiboards, then change them seperately

to show a multiboard to a single person use this code

  • Actions:
    • Custom Script: if GetLocalPlayer() == Player (0)
    • Multiboard - Show multiboard 1
    • Custom Script: endif
    • Custom Script: if GetLocalPlayer() == Player (1)
    • Multiboard - Show multiboard 2
    • Custom Script: endif
Note: Player 0 is player 1 in gui, so just do player 1 minus 1
 
what do you mean by "for each player" ?
Like this:
  • Multiboard
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 1 columns and 1 rows, titled Lumber
      • Multiboard - Set the width for (Last created multiboard) item in column 1, row 1 to 7.00% of the total screen width
      • Multiboard - Minimize (Last created multiboard)
      • Multiboard - Maximize (Last created multiboard)
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 1 to UI\Feedback\Resources\ResourceLumber.blp
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Lumber
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Show icons
      • Custom script: if ( GetLocalPlayer() == Player(0) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
      • Custom script: if ( GetLocalPlayer() == Player(1) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
      • Custom script: if ( GetLocalPlayer() == Player(2) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
      • Custom script: if ( GetLocalPlayer() == Player(3) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
      • Custom script: if ( GetLocalPlayer() == Player(4) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
      • Custom script: if ( GetLocalPlayer() == Player(5) ) then
      • Multiboard - Show (Last created multiboard)
      • Custom script: endif
?

(sorry to barge in, I also need it :D)
 
Level 9
Joined
Dec 12, 2007
Messages
489
ehm.... supertoinkz, what you did is just the same way with not using GetLocalPlayer(), because he wants to have different multiboard for each player, seeing from his description.
which means that ikillforeyou's solution is better and right in this case.
 
like

  • Events:
    • Time - elapsed game time is 0.01
  • Conditions:
  • Actions:
    • Multiboard - Create a multiboard with 1 row and 1 column
    • Multiboard - Change display size for column 1 row 1 in (Last created multiboard) to 4.00% of total screen length.
    • Multiboard - Set the text in column 1 row 1 in (Last created multiboard) to mltiboard 1
    • Set Multiboards[0] = GetLastCreatedMultiboard
    • all other actions and stuff, you know what i mean
    • Multiboard - Create a multiboard with 1 row and 1 column
    • Multiboard - Change display size for column 1 row 1 in (Last created multiboard) to 4.00% of total screen length.
    • Multiboard - Set the text in column 1 row 1 in (Last created multiboard) to mltiboard 2
    • Set Multiboards[1] = GetLastCreatedMultiboard
    • etc.
    • ----- then do this ----
      • for each integer a from 0 to the maximum players - 1
        • Custom script - if GetLocalPlayer() == Player(bj_ForLoopAIndex) then // i think i got bj_Foroop wrong, i dont have wc3 available for this.
        • Multiboard - show Multiboards[Integer A]
        • Custom script - endif
is that good?
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
The script is not resolved by server, but by each player simulatelously (the script is executed on each player's computer). By using GetLocalPlayer(), you can find out which player's computer is the script running at now (it returns different value for each player). That way, you can make the scripts work differently for each player. However, if you change anything game-related (unit position, hit points, player gold amount....), the game will split(desynchronize), disconnecting all players that have different values than the server. So practically you can use this to display things differently (unit vertex color, multiboard shown/hidden, minimap pings, text messages)..
This is an example, by blizzard:
JASS:
function PingMinimapForPlayer takes player whichPlayer, real x, real y, real duration returns nothing
    if (GetLocalPlayer() == whichPlayer) then
        call PingMinimap(x, y, duration)
    endif
endfunction
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,177
WC3 does not use servers.

It has the host process which keeps the game in sync and handles redirecting player orders to each other (why ping can cause problems and also why if the host leaves the game sometimes ends). Each player then executes all the code as the map progresses.

What causes a split is when the game engine detects that 2 or more players at a specific point in time have 2 separate game instances running (where 1 random number came out 1 and the other 2 for example), in which case it just splits the game into as larger synced groups as possible.

What GetLocalPlayer() does is return a Player which is separate for each computer, representing the player who owns the computer running the action.

So lets say me and my brother Dr Super Evil were in a game on battlenet.
The map then executes GetLocalPlayer() at some point in a script
Dr Super Good's PC returns Player(0), which is him.
Dr Super Evil's PC returns Player(1), which is my brother.

This means you can get a local or global to have a value which is different for every human player ingame, thus allowing you to run code only for one specific player. As computer players do not run their own instance of the game, they will logically never be a player returned by GetLocalPlayer(), likewise you can never get GetLocalPlayer() returning Players(12-15) as they are only ever AI and thus can not be played by a human.
 
Status
Not open for further replies.
Top