HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help Requested For Making vJass Multiboard

05-14-2009, 09:17 PM#1
Zaraf
I'd like some help with making a vJass multiboard please. The multiboard I currently have is problematic and I've used "| | | | | |" for the health bar. I'd much rather use Ammorth's multibars, but I'm having difficulty figuring everything out in how to do it. For example, the health bar shown is only for your hero, and other player hero's health bars are not shown. Yet below it are stats from all players. Mixing this public and local type of thing in the same multiboard has been causing me grief, especially with GetLocalPlayer causing desyncs.

Here is what my current multiboard looks like:



I want the same multiboard, but instead of the health bar across the top, I'd like the white bordered Zelda hearts from Ammorth's Multibars.

http://www.wc3c.net/showthread.php?t=98138

Anyone able to help please? Thanks!
05-15-2009, 03:53 AM#2
Av3n
you'll have to use the 1 multiboard per player trick here: http://www.wc3c.net/showthread.php?t=81262

Then you'll need to read the documentation of Ammorth's Multibars properly.
Other than that, you'll need to to show us your multiboard code to help you properly.

-Av3n
05-15-2009, 04:48 AM#3
Ammorth
As stated by Av3n, you'll need to create a multiboard and its corresponding multibar for each player. For the creation, do not use get local player. Stick them into an array or something, so all players have the multiboards and multibars available. The trick is to use GetLocalPlayer() only when calling MultiboardShow(). This will stop all desyncs as the data will be global, but only the visual aspect is local.

Now, for the healthbar, you are going to have to experiment with the number of columns used by the bar, to fit your current board. Currently, it appears you use 3 columns. For the multibar to work, you will need more than that, maybe 10 columns overal.

So, create a multiboard with 10 columns. Set up the first 3 columns like normal (with the player name and icon, their lives and their level), then make the remainning cells to have a width of 0 with no icon of text. This will effectively stack all of the unused cells on the right of the board, making it appear like they don't exist.

For the multibar, you won't have to worry about re-sizing or setting up the cells that the bar uses, the script does it automatically.

So, assuming health is cell 0,0 (1,1 in GUI), you would call
Collapse JASS:
set MultibarArray[i] = MultibarHelper.create(Hero[i], MultiboardArray[i], 1, 0, 9, MULTIBAR_TYPE_HEARTS_UP, MULTIBAR_HELPER_HEALTH)
to make a bar on the first row, second column, using the 9 remaining columns.

Hopefully you understand.

If you are not sure, you can always check the test map. There I have a few bars implemented and the code to setup the multiboards is shown.
05-15-2009, 12:51 PM#4
Troll-Brain
I hardly think it would cause a desync if you use only one multiboard but define a local unit for the function MultibarHelper.create

Like that :


Code:
globals
   unit array U
endglobals

function blablabla ...
local integer i = 0

// create all units for all players
loop
exitwhen i == max of players possible
set i = i + 1
if the player match the conditions (probably is an human player and is currently in game) then
   set U[i]=CreateUnit...
endif
endloop


call MultibarHelper.create(U[GetPlayerId(GetLocalPlayer())],...) // or use a set if you need to keep the track of it
endfunction
05-15-2009, 02:04 PM#5
Zaraf
Thanks for the responses. I've heard both things now. Some people say you REQUIRE separate multiboards for EACH player, while others say you can do this with a single multiboard (and still prevent desyncs).

Can the people who say this requires separate multiboards please comment on the point regarding just a single multiboard? I'd like to hear what they say about this, and if there are any drawbacks.

Thanks
05-15-2009, 08:00 PM#6
Av3n
I'm pretty damn sure you can't use GetLocalPlayer like that.

-Av3n
05-15-2009, 08:28 PM#7
Troll-Brain
Quote:
Originally Posted by Av3n
I'm pretty damn sure you can't use GetLocalPlayer like that.

-Av3n
And why ?
It's not like you create an handle locally.

It would fail if Ammorth's code will pause the timer or use .execute , ExecuteFunc,TriggerExecute and such things which open a "new thread", but i don't see these things here.
05-15-2009, 09:34 PM#8
Av3n
It just doesn't look right like that, that's why I posted that you can't use GetLocalPlayer like that.

Well we'll see what happens with it.

-Av3n
05-16-2009, 08:01 AM#9
Troll-Brain
Quote:
Originally Posted by Av3n
It just doesn't look right like that, that's why I posted that you can't use GetLocalPlayer like that.

Well we'll see what happens with it.

-Av3n
For me it looks right.
Well i will make a test.
05-16-2009, 09:34 AM#10
Troll-Brain
Ok you were right Av3n, it desync, however i'm too lazy to test where the desync happens.
05-16-2009, 04:41 PM#11
Ammorth
As long as all the units passed to the system are still around (their handles are not invalid), I don't think the desync would be within the system.

The safest approach is to create a multiboard for each player. The amount of memory used is small and it has been deemed a safe approach. You will also need to create a multibar for each multiboard, corresponding to the proper unit, but then just hide/show the multiboards locally.
05-16-2009, 09:06 PM#12
Troll-Brain
Quote:
Originally Posted by Ammorth
As long as all the units passed to the system are still around (their handles are not invalid), I don't think the desync would be within the system.
That's what i thought, it didn't desync while the multiboard isn't updated to a different value depends the player, i used the health bar like i've said upper.

Quote:
The safest approach is to create a multiboard for each player. The amount of memory used is small and it has been deemed a safe approach. You will also need to create a multibar for each multiboard, corresponding to the proper unit, but then just hide/show the multiboards locally.
Sure it's the safest but i was pretty sure you could update a multiboard locally, strange.