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

[Trigger] How to Create Multiboard for each player

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
I try to create Multiboard , but I don't know how to show Multiboard for each player. Can show example for me plz.

This is a quick example.

  • Create
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 5 columns and 2 rows, titled Players Info
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Players
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Hide icons
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to (Name of Player 1 (Red))
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 2 to Show text and Hide icons
      • Multiboard - Show (Last created multiboard)
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
You mean display it for the Player X, but not the Player Y ?

You have to use GetLocalPlayer().
However, if you can safely hide/show a multiboard in a local block, you can't handle it in a local block (like create/destroy multiboard items), else it will desync.

Also, you can't display (and maybe create) a multiboard/leaderboard on map init.
 
Level 6
Joined
Jun 19, 2010
Messages
143
I copied this several times. Hope this simple example helps you. Base on this you can make a complicated one.
  • Create Multiboard
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 18.00 seconds the text: (In Game |c00ffff00Match's score:|r |c0000ff00Jerry - Tom: |r + (|c0000ffff + ((String(gamescore[1])) + (|r + ( - + ((|c0000ffff + (String(gamescore[2]))) + |r))))))
      • Multiboard - Create a multiboard with 6 columns and 1 rows, titled (Scoreboard for + ((String((gamescore[1] + gamescore[2]))) + games))
      • -------- Width --------
      • Multiboard - Set the width for (Last created multiboard) item in column 1, row 1 to 1.60% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 2, row 1 to 7.00% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 3, row 1 to 1.50% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 4, row 1 to 1.50% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 5, row 1 to 1.60% of the total screen width
      • Multiboard - Set the width for (Last created multiboard) item in column 6, row 1 to 6.50% of the total screen width
      • -------- Text --------
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to |c00ffff00Jerry Tea...
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to (String(gamescore[1]))
      • Multiboard - Set the text for (Last created multiboard) item in column 4, row 1 to (String(gamescore[2]))
      • Multiboard - Set the text for (Last created multiboard) item in column 6, row 1 to |c00ff0000Tom Team|...
      • -------- Now set the fields for the first row, AND our player rows. --------
      • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Show icons
      • Multiboard - Set the display style for (Last created multiboard) item in column 2, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for (Last created multiboard) item in column 3, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for (Last created multiboard) item in column 4, row 1 to Show text and Hide icons
      • Multiboard - Set the display style for (Last created multiboard) item in column 5, row 1 to Show text and Show icons
      • Multiboard - Set the display style for (Last created multiboard) item in column 6, row 1 to Show text and Hide icons
      • -------- Icon & Numbers --------
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 1 to ReplaceableTextures\CommandButtons\BTNYouDirtyRat!.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 5, row 1 to ReplaceableTextures\CommandButtons\BTNPuss-in-boots.blp
      • Multiboard - Show (Last created multiboard)
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
phuc.. that isn't helpfull at all. Did you even read the question?

as Troll-Brain said, you need to use GetLocalPlayer() Which means doing something just for one player, but there are a lot of stuff you can't do because it may desync, so, you have to be very carefull. There are several tutorials here in Hive and in the-helper, and Wc3.net you can read to understand how GetLocalPlayer() works, and how can be used to display different data in different multiboards for different players.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
GetLocalPlayer basically returns the hosts computer meaning if you do something liek

if GetLocalPlayer() == Player(1)

For whoever is player 1, that condition will be true. But since in player 2, the local playe is player 2 not player 1 so the code will only be run for player 1. This is risky tho and can cause desyncs

To do this with the multiboard, before you put Show last created multiboard do Custom Script : if GetLocalPlayer() == Player(# of player you want to show for - 1) (because, in jass, player 0 = red, player 1= blue, etc.)

and than after show last created multiboard

Custom Script : endif
 
Level 5
Joined
Jan 4, 2009
Messages
118
Sorry,I'll try it, but It's doesn't work. I can't show multiboard for right owner player. because I don't know about condition to check player from native Native GetLocalPlayer().
Can show example to uses GetLocalPlayer() Condition, plz.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
For each integer A from 0 to 12 do
If GetLocalPlayer == GetPlayerConvertedId(bj_forLoopAIndex) then
...
endif

(Or something like that).
 
Level 10
Joined
Mar 31, 2009
Messages
732
JASS:
if (GetLocalPlayer() == ...) then

Instead of [ijass]...[/ijass] use:
For Event - Triggering Player - [ijass]GetTriggerPlayer()[/ijass]
For Owner of Triggering Unit - [ijass]GetOwningPlayer(GetTriggerUnit())[/ijass]

Tell me the condition you want and I will give you the correct code.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
My Condition is same Spartipilo's reply. but that It's work? And I wonder when I uses GetLocalPlayer() is dangerous. Example Dangerous to me. PLZ!!

What's your home nationality?

Anyway it's simple for triggering player

If getlocalplayer ==gettriggerplayer

For specific player

Player(#)

In a integer a loop

Bj_forloopAindex

Anyway the rule about not what to use in those blockss

Don't do anything with units items or destructibles and do not do anything that includes the words create or destroy.
 
Level 5
Joined
Jan 4, 2009
Messages
118
Sorry for my language.

I have a question about Condition. Now I can creates multiboard for many player, but Should I select event is refer to Triggerplayer()?
This Multiboard will show on the time of game is past 15 second (like DotA).

Tell me Plz. I don't know really.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
If your doing something like a command to show the multiboard, than the condition you would use is if GetLocalPlayer() == GetTriggerPlayer()
 
Level 5
Joined
Jan 4, 2009
Messages
118
But my trigger has event name "Time is elapsed". It's related to any Player. Can I uses GetTriggerPlayer()? And I should select any to fix that problem.

Plz tell me more

JASS:
function Create_MultiBoard takes nothing returns nothing

     local multiboard array mb
     local integer i = 0
     
     loop
        exitwhen i > 11
        set mb[i] = CreateMultiboard()
        call MultiboardSetRowCount(mb[i], 1)
        call MultiboardSetColumnCount(mb[i], 1)
        call MultiboardSetTitleText(mb[i], "MUULTIBOARD : "+GetPlayerName(Player(0)))
        
        if(GetLocalPlayer() == ????)then // This I wonder Can I use any refer target player????
            call MultiboardDisplay(mb[i], true)
        endif
        
        set i = i  + 1
     endloop
     
endfunction

//===========================================================================
function InitTrig_Create_MultiBoard takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEventSingle( t, 0.00 )
    call TriggerAddAction( t, function Create_MultiBoard )
    set t = null
endfunction

Or Have you suggestion other way please tell me more ....
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
Inside the loop :

JASS:
call MultiboardDisplay(mb[i], Player(i) == GetLocalPlayer())

This way it will be false for all players excepted for Player(i), then the multiboard will be showed only for the Player(i).

But instead of a local array variable, it should be global array variable, else you wouldn't be allowed to handle the multiboards later.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Player(i) to refer to the loop #.

and why is the multiboard array local? you wont be able to access it once endfunction
 
Level 5
Joined
Jan 4, 2009
Messages
118
Inside the loop :

Jass:
call MultiboardDisplay(mb, Player(i) == GetLocalPlayer())

This way it will be false for all players excepted for Player(i), then the multiboard will be showed only for the Player(i).


I 'll try on this, Thanks you.


why is the multiboard array local? you wont be able to access it once

Oh I don't know about it, Ok I will using Global instead.

Thanks for all reply.
 
Level 6
Joined
Jun 19, 2010
Messages
143
I play with this abit. So it'd be like this, right? but nothing happens in game!?!
JASS:
scope multiboard initializer MultiBoard
    globals
        multiboard array mb
    endglobals
    private function Create_MultiBoard takes nothing returns nothing
         local integer i=0     
         loop
            exitwhen i>11
            set mb[i]=CreateMultiboard()
            call MultiboardSetRowCount(mb[i],1)
            call MultiboardSetColumnCount(mb[i],1)
            call MultiboardSetTitleText(mb[i],"MULTIBOARD : "+GetPlayerName(Player(0)))        
            if GetLocalPlayer()==GetTriggerPlayer()then
                call MultiboardDisplay(mb[i],Player(i)==GetLocalPlayer())
            endif        
            set i=i+1
         endloop     
    endfunction
    private function MultiBoard takes nothing returns nothing
        local trigger t=CreateTrigger()
        call TriggerRegisterTimerEvent(t,0.00,false)
        call TriggerAddAction(t,function Create_MultiBoard)
        set t = null
    endfunction
endscope
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
JASS:
if GetLocalPlayer()==GetTriggerPlayer()then
    call MultiboardDisplay(mb[i],Player(i)==GetLocalPlayer())
endif

->

JASS:
call MultiboardDisplay(mb[i],Player(i)==GetLocalPlayer())

GetTriggerPlayer will return null here, also the if is not needed because GetLocalPlayer returns a different player on each pc, and then the boolean expression Player(i)==GetLocalPlayer() is already local (asynchronous).
 
Level 6
Joined
Jun 19, 2010
Messages
143
Yes, I've thought of no need for if condition and gone ahead in a couple of hours ago testing the script without the if in that loop (see below) but nothing happens.
JASS:
scope multiboard initializer MultiBoard
    globals
        multiboard array mb
    endglobals
    private function Create_MultiBoard takes nothing returns nothing
         local integer i=0     
         loop
            exitwhen i>11
            set mb[i]=CreateMultiboard()
            call MultiboardSetRowCount(mb[i],1)
            call MultiboardSetColumnCount(mb[i],1)
            call MultiboardSetTitleText(mb[i],"MULTIBOARD : "+GetPlayerName(Player(0)))       
            call MultiboardDisplay(mb[i],Player(i)==GetLocalPlayer())        
            set i=i+1
         endloop     
    endfunction
    private function MultiBoard takes nothing returns nothing
        local trigger t=CreateTrigger()
        call TriggerRegisterTimerEvent(t,0.10,false)
        call TriggerAddAction(t,function Create_MultiBoard)
        set t = null
    endfunction
endscope
 
Level 6
Joined
Jun 19, 2010
Messages
143
Status
Not open for further replies.
Top