HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multiboard simple question

02-09-2009, 11:34 AM#1
Flame_Phoenix
Hi guys I am making a selection system for the races on my map. This system uses trackables and icons. The main idea is:
1 - when a player moves the mouse over a trackable a multiboard is created for that player that displays information about the race
2 - when the player clicks the trackable the race is selected and the games starts bla bla bla (you get the point)

Everything is going well so far, except for one little thing:
- How do I create a multiboard that is visible for only 1 player ? This is the only way I know for the system to be MUI.

I appreciate any possible help, and I give credits to people who help me solve this simple problem.

Thx in advance Flame_Phoenix.
02-09-2009, 12:10 PM#2
Earth-Fury
Collapse JASS:
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif
02-09-2009, 12:26 PM#3
Flame_Phoenix
hã !?
What is "GetLocalPlayer()" for ? and how do I detect him ?
Also, If I use GetLocalPlayer() will the other players of the game also see the multiboard that was created?

Sorry about so many questions, I never used that native before in my life =P
02-09-2009, 12:48 PM#4
Earth-Fury
http://www.wc3campaigns.net/showthread.php?t=96726
02-09-2009, 01:20 PM#5
Flame_Phoenix
Ah, thx for the link!
However, won't that cause a desync ? (I dunno, you are the expert here) =P.
02-09-2009, 01:27 PM#6
Earth-Fury
Quote:
Originally Posted by Flame_Phoenix
you are the expert here

Quote:
Originally Posted by Earth-Fury
Collapse JASS:
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif
02-09-2009, 01:42 PM#7
Flame_Phoenix
Collapse JASS:
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif
So, what is "p" after all?

Collapse JASS:
local player p

or

Collapse JASS:
local player p1 = Player(0)
local player p2 = Player(1)
local player p3 = Player(2)
local player p4 = Player(3)


if GetLocalPlayer() == p1 then
    call MultiboardDisplay(mb, true)
elseif GetLocalPlayer() == p2 then
    call MultiboardDisplay(mb, true)
//so on until player 4
endif
02-09-2009, 02:21 PM#8
Anitarf
Quote:
Originally Posted by Flame_Phoenix
Collapse JASS:
local player p1 = Player(0)
local player p2 = Player(1)
local player p3 = Player(2)
local player p4 = Player(3)


if GetLocalPlayer() == p1 then
    call MultiboardDisplay(mb, true)
elseif GetLocalPlayer() == p2 then
    call MultiboardDisplay(mb, true)
//so on until player 4
endif
That would display the multiboard for all players, which kind of defeats the purpose of GetLocalPlayer...
02-09-2009, 02:34 PM#9
Veev
You check GetLocalPlayer() against whatever player is currently triggering whatever it is that makes that multiboard show up.

So... Just a really quick example:
Collapse JASS:
If GetLocalPlayer == Owner of Casting Unit then
 Show Multiboard
Endif
02-09-2009, 02:37 PM#10
Flame_Phoenix
Quote:
That would display the multiboard for all players, which kind of defeats the purpose of GetLocalPlayer...
Oh rit, so I guess that I will have the code:

Collapse JASS:
local player p = GetLocalPlayer()
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif

Correct ?
02-09-2009, 04:26 PM#11
Ammorth
No, if you are using trackables, the tracking player will be the triggering player:

Collapse JASS:
local player p = GetTriggeringPlayer()
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif

To avoid desyncs, you need all players to have the multiboard created and the text set, but only display it for the player you want. If you create a multiboard for each race and then hide/show them locally for each player, depending on what they track on, you will not have any problems.
02-09-2009, 04:52 PM#12
Flame_Phoenix
Quote:
To avoid desyncs, you need all players to have the multiboard created and the text set, but only display it for the player you want. If you create a multiboard for each race and then hide/show them locally for each player, depending on what they track on, you will not have any problems.
Oh sweet mother of God ... what have I done ... lol
That seems quite complicated (multiboard thing). Anyway dismembering your sentence:

Quote:
you need all players to have the multiboard created
So, all players, including computer players and players (human that left or are not playing) must have their "own" multiboard, or must have access to a single global multiboard?

Quote:
and the text set
I don't get this. Since each player may want to pick a different race, the text (description of each race) will be different =S

Quote:
but only display it for the player you want
I do this by using the code:
Collapse JASS:
local player p = GetTriggeringPlayer()
if GetLocalPlayer() == p then
    call MultiboardDisplay(mb, true)
endif
rigth ?

Quote:
If you create a multiboard for each race and then hide/show them locally for each player, depending on what they track on, you will not have any problems.
Let me see if I get it, I have 6 races, so I have to create 6 multiboards at the start of the game. When a player moves his mouse I use your piece of code and he see it right?
The final retsult will be something like this:

Collapse JASS:
local player p = GetTriggeringPlayer()
if GetLocalPlayer() == p then
    //call HideAllOtherMultiboards()
    call MultiboardDisplay(trackRace1, true)
endif

I feel like a baby on this, I am definitely discovering new terrain, I am sorry if my questions seem newb (well, they are) but I appreciate the help of all people involved and please don't get mad at me for not understanding things at first.
02-09-2009, 06:46 PM#13
Veev
Do not change the text locally (it may or may not work, I've never tested it. Would be nice if someone could confirm). Make each multiboard and then hide the ones that need to be hidden for the players.

Your last block of JASS code should do what you want it to do.
02-09-2009, 07:39 PM#14
Bobo_The_Kodo
like this flame
Collapse JASS:
function Actions takes nothing returns nothing
    if GetLocalPlayer() == GetTriggeringPlayer() then
        call MultiboardDisplay( Multiboard1, true )
    endif
endfunction


//... init function
set Multiboard1 = CreateMultiboard()
// ... setup multiboard stuff

And you don't have to hide other multiboards, because multiboards are not displayed by default
02-09-2009, 08:00 PM#15
Flame_Phoenix
Thx for helps guys. You missed a small thing Kodo, when will have to hide all previous opened multiboards of the player, but now thx to you guys I have the image of what I need to do inside my head. Thx all.
I will keep this thread updated.

As for now, +rep to all for being nice guys/girls (well, who knows?) =P