| 05-14-2009, 09:17 PM | #1 |
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 |
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 |
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 JASS:set MultibarArray[i] = MultibarHelper.create(Hero[i], MultiboardArray[i], 1, 0, 9, MULTIBAR_TYPE_HEARTS_UP, MULTIBAR_HELPER_HEALTH) 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 |
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 |
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 |
I'm pretty damn sure you can't use GetLocalPlayer like that. -Av3n |
| 05-15-2009, 08:28 PM | #7 | |
Quote:
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 |
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 | |
Quote:
Well i will make a test. |
| 05-16-2009, 09:34 AM | #10 |
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 |
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 | ||
Quote:
Quote:
|
