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

MultiBoard Local JASS

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
Hi everyone,
i sent a full day reviewing all Local Multiboard with GetLocalPlayer
and even though it look very easy...
I couldn't do it because explanation were quite vague and a Jass Noob like me need to get lot of precision, because obvious things might not be obvious to me...


I won't ask you for the standard easy:

[Jass=Multiboard]function Trig_Show_MultiBoard_Actions takes nothing returns nothing
local integer i = 1
call TriggerSleepAction( 0.00 )

loop
exitwhen i > 12
set udg_Multiboard = CreateMultiboardBJ( ROWS, COLUMNS, "TITLE" )
call MultiboardDisplayBJ( false, udg_Multiboard )
set i = i + 1
endloop

set i = 1
loop
exitwhen i > 12
if ConvertedPlayer(i) == GetLocalPlayer() then
call MultiboardDisplayBJ( true, udg_Multiboard )
endif
set i = i + 1
endloop
endfunction

//===========================================================================
function InitTrig_Show_MultiBoard takes nothing returns nothing
set gg_trg_Show_MultiBoard = CreateTrigger( )
call TriggerAddAction( gg_trg_Show_MultiBoard, function Trig_Show_MultiBoard_Actions )
endfunction[/code]

wich i couldn't make to work anyway....

but i will ask your Help (to All Jass Master) for some very specific Triggers:

I would like to create let's say 3 Multiboards for each players, each 3 multiboards local to 1 player...

Let me explain:
Player 1 can swap between Multiboard_Stats(1) , Multiboard_Game(1) and Multiboard_Score(1) by clicking "ESC" key...
Player 2 same but Multiboard(2) , Player 3 Multiboard(3) , etc....


So i need to create 12x3 = 36 multiboards

then:

TriggerA (normal GUI trigger)
game elapsed time 0.10 create all the multiboards and hide all Multiboard for all players

TriggerB (JASS local Trigger)
game elapsed time 1.00 pick everyplayer and show multiboard_Stats(x) for local player(x)
set integer BoardPlayer(x) = 1


TriggerC (JASS local Trigger)
player x skip cinematic
if BoardPlayer(x) = 1
then hide multiboard_Stats(x) show multiboard_Game(x) and set BoardPlayer(x) = 2
else if BoardPlayer(x) = 2
then hide multiboard_Game(x) show multiboard_Score(x) and set BoardPlayer(x) = 3
else hide multiboard_Score(x) and show multiboard_Stats(x) and set BoardPlayer(x) = 1


Could someone Help me do the two JASS trigger using local to show and hide the correct Multiboard for correct local players...
if you could post a demo map doesn't matter if the multiboard have only 2 row and column and no value,
i just need the map as an example on how to do the JASS part.


Thanks for your time reading...
and Thanks in Advance for your Help ^^
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Map attached.
It's not a complicated system, so you should be able to figure it out.

The first trigger sets up all multiboards, the second one changes them for each player.
I skipped TriggerB and combined it with TriggerA, at least that's what I thought your TriggerB meant.

Well, you'll see I guess ^^
 

Attachments

  • Multiboards.w3x
    17.2 KB · Views: 99

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
Wow thanks a lot ap0calypse !!

I didn't tested it yet, but i looked at the trigger, it look good...
and very very simple...

the customscript: with check the MB number+12 , etc...
i wouldn't have been able to do it myself, it is so hard to mess with number and with variable and loop in JASS...

i will try it in my map right away
i will give rep if i can :)
if anything goes wrong i will tell you... thanks a lot
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well, that custom script (involving MBnumber) is just a bit of calculating etc :p

Multiboards 1-12 are the "first" multiboards for player 1-12.
Multiboards 13-24 are the "second" multiboards for player 1-12 (so you have to do it -12)
Multiboards 25-36 are the "third" multiboards for player 1-12 (so you have to do it -24).

A quick way is setting it to MBNumber*12 - 11 (if MBNumber == 2: 2*12-11 = 13, so the second multiboard for the first player).
That's all, really.

I'm glad I could help, and I would really like to know if there's something wrong with it so I can fix it ^^
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
Well actually i didn't had time to do it right away
the multiboard i use are quite big 14 column and 18 row so i am cutting it into 3 multiboards
but i have to redo many things, change some value, reorganise all, and maybe add a 4th multiboards (i hope i won't need)
so i will do it tomorrow, it should take me all day to redo all and reorganise, then i will put everything in your triggers and test....
i will tell you tomorrow if it work (but from the outside look i don't see any flaw...even if i am not sure i would be able to detect flaws in JASS)

thanks a lot, i will be sure to send you feedback...
your my life saver if it works :p
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
this might be off-topic but...
why?

call TriggerSleepAction( 0.00 )

It doesn't do anything :S
and waits are insufficiënt. I don't get the point in using that, could you elaborate?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
this might be off-topic but...
why?

call TriggerSleepAction( 0.00 )

It doesn't do anything :S
and waits are insufficiënt. I don't get the point in using that, could you elaborate?

It actually still waits about 0.1 seconds (of course, this could vary between about 0.05 seconds to 0.30 seconds, since waits are extremely unreliable).
And yes, some say minimum wait time is 0.27 seconds, but that's a matter of game-time vs real-time as far as I'm concerned. According to my "research", the minimum wait was 0.06 seconds.

That trigger probably runs at map init (you can see it doesn't have any events, meaning it can only run at map init, never, or when activated by another trigger).
Since multiboards cannot be shown at map init, using a wait is required (or using the event "X time elapsed").
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
It actually still waits about 0.1 seconds (of course, this could vary between about 0.05 seconds to 0.30 seconds, since waits are extremely unreliable).
And yes, some say minimum wait time is 0.27 seconds, but that's a matter of game-time vs real-time as far as I'm concerned. According to my "research", the minimum wait was 0.06 seconds.

That trigger probably runs at map init (you can see it doesn't have any events, meaning it can only run at map init, never, or when activated by another trigger).
Since multiboards cannot be shown at map init, using a wait is required (or using the event "X time elapsed").

hmm well the trigger can be run by other triggers too right xD?
but thanks for the explenation. I forgot about the fact that it's actually a multiboard, didn't think about it being run on initialization xD
thank you, just what I needed to know :)
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
Well Ap0calypse
i did the Testing and it work Perfectly !!!

well maybe there is just the create trigger jass script wich maybe has a little miss,
because when i tried solo and before the second trigger run (press esc)
the board shown was for player 2... and i was player 1.
but as soon as i pressed ESC everything worked absolutly perfectly for all board...
i tested solo so i don't know if local worked, but since i created 12 multiboard for each board, and considering the correct board showed always for player1... i can conclude that all works perfectly !!!

ok i will add you to special Thanks in the map i am updating ^^


I have also 2 others questions for you since you seem to be good with triggers...

1) just curious, When i turn a GUI trigger into custom script the two top switch change...
in GUI enable X initially on X
in JASS enable X run on map initialisation O


why does it change and why does it remove the X ?
is run on map ini not equal to initially on? and what does it do/mean?


2) this question is more important, i have a building neutral hostile or owned by player wich has the share_ability (shopability) , this enable all friendly player to click on the building ability....
I would like to be able to track wich player clicked the ability...is it possible?
if i do casting unit it will go wrong because the player clicking is not necessarly the owner of the building...

How do i know wich player used the building ability?

^^ thanks a lot for the multiboard
i hope i don't bother to much asking so many question....
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well Ap0calypse
i did the Testing and it work Perfectly !!!

well maybe there is just the create trigger jass script wich maybe has a little miss,
because when i tried solo and before the second trigger run (press esc)
the board shown was for player 2... and i was player 1.
but as soon as i pressed ESC everything worked absolutly perfectly for all board...
i tested solo so i don't know if local worked, but since i created 12 multiboard for each board, and considering the correct board showed always for player1... i can conclude that all works perfectly !!!
Wow, I didn't have that error at init... :/
Are you sure you have "-1" in: "if GetLocalPlayer() == Player(bj_forLoopAIndex-1) then"?


ABM said:
1) just curious, When i turn a GUI trigger into custom script the two top switch change...
in GUI enable X initially on X
in JASS enable X run on map initialisation O


why does it change and why does it remove the X ?
is run on map ini not equal to initially on? and what does it do/mean?
"Initially on" and "run on map initialization" are two completely different things.

Initially on:
When this is on, then a trigger with the event "Time - every X seconds" will start running from the beginning, a trigger with the event "Unit - a unit dies" won't do anything until a unit died.
Triggers like this can be turned on/off whenever you want (disabled triggers can never be activated in-game).

Run on map initialization:
This is equal to the GUI-event "Map initialization".
You might notice that such an event does not exist in JASS.

So if you enable this option with a trigger that has the event "Unit - a unit dies", it DOES do something at the start (because you're running it at map init).
On the other hand, an event like "Time - Every X seconds of game-time" with this option enabled will run once on map init, and then every X seconds.

You'll also notice that when you convert this trigger to custom text:
  • Change MB Copy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Display to (All players) the text: hay
The option will be enabled (because of the event).

ABM said:
this question is more important, i have a building neutral hostile or owned by player wich has the share_ability (shopability) , this enable all friendly player to click on the building ability....
I would like to be able to track wich player clicked the ability...is it possible?
if i do casting unit it will go wrong because the player clicking is not necessarly the owner of the building...

How do i know wich player used the building ability?
I'm sorry, I don't know.
The only thing I can come up with is to detect which player is selecting the building (not hard to do), but that's not always correct either (because multiple people can select the unit at the same time, doesn't mean they actually cast the spell).
 
  • Like
Reactions: ABM

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • -------- The current multiboard of this player (default 1) --------
      • Set CurrentMB[(Integer A)] = 1
      • Custom script: if GetLocalPlayer() == Player(bj_forLoopAIndex-1) then
      • Multiboard - Show Multiboard[(Integer A)]
      • Custom script: endif
Well here is the trigger...for the create MB...
and it does show the player 2 start until the next trigger start to run :p

about the local player click event i will ask on the forum since you don't know ....

[To moderator]
You can add Solved to this thread ^^
 
Last edited:
Status
Not open for further replies.
Top