About MultiboardSetTitleText() and GetLocalPlayer()

REND.Soul.42

New Member
Reaction score
0
Hi! This is my very first thread. I'm currently loving this forum :)

I have a question: can you use MultiboardSetTitleText() and GetLocalPlayer() like this?

What I want to happen is like in DOTA's multiboard title (different title for each player).

JASS:
function MyFunction takes nothing returns nothing
    local string s
    local integer i = 0
    loop
        exitwhen i > 11
        set s = "You are Player " + I2S(i+1) + "!"
        if ( GetLocalPlayer() == Player(i) ) then
            call MultiboardSetTitleText(udg_My_Multiboard, s)
        endif
        set i = i + 1
    endloop
endfunction

The string is added to everyone's string table and then the multiboard title is set locally.
Will this cause a desync? I'm starting to become more paranoid about desyncs... o_O

If it is indeed fine to do, I just don't have to use MultiboardGetTitleText() ?

EDIT: I think the code above desyncs players.. How about this?
JASS:
function MyFunction takes nothing returns nothing
    local string array s
    local integer i = 0
    loop
        exitwhen i > 11
        set s<i> = &quot;You are Player &quot; + I2S(i+1) + &quot;!&quot;
        set i = i + 1
    endloop
    call MultiboardSetTitleText(udg_My_Multiboard, s[GetPlayerId(GetLocalPlayer())])
endfunction
</i>


Will this work? :/
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Both will work. Setting the title text is fine to do locally. HOWEVER, multiboards that you have to manage with solely GetLocalPlayer() become a mess! Trust me, you don't want to do it. After a while, you are going to have to locally set a field every time you want to adjust the text. It will become a pain.

A much better way would be to create a multiboard array, and have one board per player. Then just hide for all other players, and only show for the player with that index. (the index in the array) Now, this is a bit more annoying when you want to set a field for all the multiboards because you will have to loop, but it saves you a lot of annoying dealings with GetLocalPlayer(). Just a suggestion, you don't have to use it if it actually ends up being more annoying that way.
 

REND.Soul.42

New Member
Reaction score
0
Oh, I see. That was a relief! ^^ I thought it would cause a desync.

Well, I managed to it with just one multiboard for all and setting the text locally. It took a bit of effort but it works dandy. ;)

Thanks for the help! :D
btw.. how do you add rep here?
 

dracolich

TH.net Regular
Reaction score
15
A much better way would be to create a multiboard array, and have one board per player
no fucking way.
what a point to have 10x more boards for nothing?
:facepalm:
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
no fucking way.
what a point to have 10x more boards for nothing?
:facepalm:
If it is easier. I suppose I shouldn't have said "much better way" because it isn't always easier. However, doing a GetLocalPlayer() block for every change is a bit annoying. You can always make a function for it, but then it still becomes a bit annoying to keep track of everything.

Of course, it isn't necessary. However, there won't be much of a memory difference so it isn't really a problem to have them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top