• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Private Multiboard for each Player

Status
Not open for further replies.
Level 11
Joined
Jun 21, 2007
Messages
505
I have a question too: i want to make a private MULTIBOARD for each player like in AzerothGrandPrix - there're private Multiboards for each player. I just need to show a multiboard, but only for one specific player and make others not to see it. (For example i want to make a Muiltiboard show player's resources - other players must not see it, but they can see theirs)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
You have to use the GetLocalPlayer() native to do this.
GetLocalPlayer() returns the player of the PC that runs it, so will never be the same on 2 different PCs in the same game with the exception of just as the map finishes loading (which it then returns the PC that loaded first).

If you combine that fact with an if statement you can make the calls and actions in it to only happen to that player. This will cause the player to be kicked if any major non graphic action is run as it will not be run for the other players and so the game falls OOS.

JASS:
if GetLocalPlayer() == Player(0) then
    //all calls and opperations preformed here will only be done for Player 1 (red).
    //This is where you display your multiboard as it will then only run the display multiboard opperation for that player so the multiboard will remain hidden to all other players.
endif
//

Simply create 1 multiboard for each player and display them using a JASS system like above. This is the easiest way to work but not nescescarily the most efficent.

You may also try local updating, where it only updates to show the players stats and stuff like that. This is less demanding since instead of all multiboards having to be updated for all players, only 1 player worth of updating is preformed per person and so naturally less opperations are run which means less demanding. This however is a lot more risky and not recomended unless you really understand and know what your doing as it is quite easy to cause an OOS by bad coding doing this.
 
Level 11
Joined
Jun 21, 2007
Messages
505
use
JASS:
if GetLocalPlayer() == Player(x) then
       //X = the player number. after then put all your actions, and then type endif

I don't understand that, but i think, if i want to make a private Multiboard for each player i shall do this
JASS:
if GetLocalPlayer() == Player(0) then
If GetLocalPlayer() == Player(1) then
If GetLocalPlayer() == Player(2) then
If GetLocalPlayer() == Player(3) then
If GetLocalPlayer() == Player(4) then
If GetLocalPlayer() == Player(5) then
endif
("(Up to 11)")

and write this by my own in an empty trigger converted to custom text... :ask:
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
[trigger="Clear ?"]Events
Time - Time becomes equal to 25:00 (kidding)
Conditions
If All sheeps are alive (no maps with sheeps harmed on creation)
Actions
Multiboard - Create sum board
Multiboard - Hide Last Created Multiboard
Custom script: if GetLocalPlayer() == Player(0) // 0 is red 1 is blue etc etc
Multiboard - Show Last Created Multiboard
Custom script: endif[/trigger]
 
Last edited:
Level 11
Joined
Jun 21, 2007
Messages
505
  • Events
    • Time - Elapsed game time becomes equal to 0.00 seconds
  • Conditions
    • True equal to True
  • Actions
    • Multiboard - Create a multiboard with # columns and # rows with Title <TITLE>
    • Multiboard - Hide (last created multiboard)
    • Custom script: if GetLocalPlayer() == Player(0)
    • Multiboard - Show Last Created Multiboard
    • Custom script: if GetLocalPlayer() == Player(1)
    • Multiboard - Show Last Created Multiboard
    • Custom script: if GetLocalPlayer() == Player(2)
    • Multiboard - Show Last Created Multiboard
    • Custom script: endif
:ask: :ugly: :ask:
Right?
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
Just a small remark in case you don't know jass is case sensitive: what Need_O2 as well as the others said: "if" has to be written lowercase. Not "If", like it's written in the post above.

LOL sorry sorry sorry
I always type if in lowercase :/
damn I got own3d

Its not right
1- Delete the True Equal to true
2- Make "if"s in lowercase
3- Put "Custom script: endif"s after each Multiboard - Show Last Created Multiboard not only to last one

It should display it for first 3 players after you fix that
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
It's quite easy though...

If you use
  • Custom script: if GetLocalPlayer() == Player(0) then
Every action you put behind the script will ONLY happen for Player(0). For example: if you show a multiboard, the multiboard will only be shown to player 0. In other words: you could create 2 DIFFERENT multiboards, then show the first one to player 0, the second one to player 1.

Please note that you must put
  • Custom script: endif
after EVERY occurance of the "GetLocalPlayer' script. Everything that comes behind the "endif" will happen to every player again, instead of only to player 0.

A correct example of usage would be:
  • Multiboard - Create a multiboard with 3 columns and 3 rows with Title <First Multiboard>
  • Multiboard - Hide (last created multiboard)
  • Custom script: if GetLocalPlayer() == Player(0) then
    • Multiboard - Show Last Created Multiboard
  • Custom script: endif
  • Multiboard - Create another multiboard with 5 columns and 5 rows with Title <Second Multiboard>
  • Multiboard - Hide (last created multiboard)
  • Custom script: if GetLocalPlayer() == Player(1) then
    • Multiboard - Show Last Created Multiboard
  • Custom script: endif
 
Level 11
Joined
Jun 21, 2007
Messages
505
The final answer on this thread. Reasoning from this i will continue it with the question: I want to make SPECIAL rows in a multiboard. The rows are rectangles which are filling in over time...

See the picture:
i-13.jpg


Could someone tell me how to make like that (i mean that special row which is gonna fill in with different colors over a few seconds)
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
Well 12 Multiboards
store them in each value
show each one to only one player
and change its fields

LoL that thing is pro (No missunderstandations, I can make one)
 
Level 11
Joined
Jun 21, 2007
Messages
505
I think i could just use "|" or "I" or "l" (L) symbol and put them all at the same color... And I know how do i do that: maximum and minimum number of "|"s is... 15. (Cost of tech (medium is 200)):(# of scientists)=# of seconds to wait until the tech research will be finished. Store at a variable the # of elapsed seconds and store # of seconds which is required to wait until the tech will be researched. # of "|"s to put to the row will be -
"15x((seconds required to wait until research is finished seconds)-(elapsed seconds)):100"

But I have no idea how to make a rectangle and fill that in with squares!
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
I managed to get a bar system to work, but I failed to get the nice borders around it and an accurate bar system. Some one really needs to show how it is done.

When I try making the bar's borders, I get uggly gaps along the Y axes and I never could overcome those (only could overcome the X axes gaps).
 
Level 11
Joined
Jun 21, 2007
Messages
505
Note: the image was stretched pretty inaccurately, really the square borders are straight.

yea because of that you make 50 rows with small width
I don't understand: are rows horizontal lines, if columns are vertical, then rows must be horizontal. If rows are vertical then Need_02 says true. If rows are horizontal lines then i have no idea what he's said. :/
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Its Need_O2 and when you set size of multiboard item it gets sized horozintally (think misspeled)
so lots of icons with %1-2 size will look like that

I'll try making that someday (no promises)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
JASS provides NOthing more than GUI does FOR MULTIBOARDS
(except of some more speed increasement <less function calls>)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
CreateUnit(GetLocalPlayer(),type,etcetc) = Bad problems
DisplayTextToPlayer(GetLocalPlayer(),0.,0.,"You are fine") = Success
 
Level 11
Joined
Jun 21, 2007
Messages
505
Alternative to adding a ton of endifs (and better), you can just replace every if after the first with 'elseif' (without the quotes)

I don't understand this thing: You type "if GetLocalPlayer() == Player(#)" as a condition. All actions that are under it will be done because that condition is true. But quote says that it's able to use "elseif". Then that means that all actions under "elseif" will be done because the condition "if GetLocalPlayer() == Player(#)" is false. Then that condition is true and false at the same time! o_O
1) How can a condition at If/Then/Else be false and true at the same time, so all actions between if and elseif and endif will be done no matter what condition says. 2) +Plus that condition sets a player for who the actions will be done, but it's a condition, not action. ((For each integer A from 0 to 11 do action kkots says:))"All the time during the game ''GetLocalPlyer() == Player(integer A)'' - it's true, but it's false too because actions under "elseif" are done! :ask:

  • Events:
  • Conditions:
    • Custom script: GetLocalPlayer() == Player(0)
  • Actions:
    • Floating Text - etc
  • Events:
  • Conditions:
  • Actions:
    • Custom script: if GetLocalPlayer() == Player(0) then
    • Unit - Hide
    • Custom script: elseif
    • Custom script: if GetLocalPlayer() == Player(1) then
    • Unit - Hide
Right?
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
here's how your custom scripts must look like:

  • Custom script: if (condition # 1) then
  • Custom script: elseif (condition # 2) then
  • Custom script: elseif (condition # 3) then
  • Custom script: endif
any line containing "elseif (Condition) then" is optional and does not necessarily need to be added. If you use ANOTHEr "if () then" statement INSIDE an if/then statement, remember to close it with "endif" too. for example:

  • Custom script: if (condition # 1) then
  • Custom script: if (condition # 2) then
  • Custom script: endif
  • Custom script: endif
Note how - using this script - you'll ONLY proceed to checking if condition 2 is true IF condition 1 is already true.

Keep in mind that:
  • Custom script: if (condition # 1) then
  • Custom script: elseif (condition # 2) then
  • Custom script: endif
is the same as saying

  • Custom script: if (condition # 1) then
  • Custom script: else
  • Custom script: if (condition # 2) then
  • Custom script: endif
  • Custom script: endif
Note how you need to write endif TWICE. This is because you "open" a new if/then/endif statement inside another if/then/endif statement. This is the main reason why "elsif" was added, to make your script easier.

to refer to "Integer A" in a loop in a custom script, use:
bj_ForLoopAIndex

for example:
  • For (each integer A) from 1 to 12 do
    • Custom script: if GetLocalPlayer() == Player(bj_ForLoopAIndex - 1) then
    • Do Nothing
    • Custom script: endif
I don't exactly understand what you mean with your first question though...
 
Level 11
Joined
Jun 21, 2007
Messages
505
I said that actions in "if" are done because GetLocalPlayer() condition is true. Actions in "elseif" or "else" are done because GetLocalPlayer() condition is false. Question: why is "GetLocalPlayer() == Player(#)" condition is true and false at the same time? +why it also sets a player for who the actions will be done?
(If "GetLocalPlayer" is a condition (because it's used in If/Then/Else at the place where condition should be)...)

((GetLocalPlayer is a condition, it's true, and it's false, and it does things that actions do))

  • Custom script: if GetLocalPlayer() == Player(#) then
  • Custom script: <actions>
  • Custom script: elseif GetLocalPlayer() == Player(#) then
  • Custom script: <actions>
  • Custom script: endif
  • Custom Script: if <condition> then
  • Custom script: <actions>
  • Custom script: else
  • Custom script: <actions>
  • Custom script: endif
  • Custom script: if <condition> then
  • Custom script: if <condition> then
  • Custom script: <actions>
  • Custom script: endif
  • Custom script: else
  • Custom script: <action>
  • Custom script: endif
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
Because the condition is NOT true and false at the same time. compare that trigger with saying:

  • If (all conditions are true) then do (then actions) else do (else actions)
    • If - conditions
      • Player Comparison - (triggering player) equal to Player 1 (red)
    • Then - actions
    • Else - actions
      • If (all conditions are true) then do (then actions) else do (else actions)
        • If - conditions
          • Player Comparison - (triggering player) equal to Player 2 (blue)
The condition "type" obviously is the same: it's a player comparison. However, the conditions themselves aren't the same because you're seeing whether triggering player is player 1 OR player 2.

In the getlocalplayer() function, a "player" variable is returned. Thus, when you say something like
if GetLocalPlayer() == Player(0) then
then GetLocalPlayer() will actually be *replaced* by the player behind the computer. Imagine that the trigger is running for player 0. This is what happens:

Custom script: if Player(0) == Player(0) then
Custom script: <these actions will happen because player 0 IS player 0>
Custom script: elseif Player(0) == Player(1) then
Custom script: <these actions won't happen because player 0 IS NOT player 1>
Custom script: endif

The same trigger runs for player 2, and every other player. However, for those players, GetLocalPlayer() will return Player(1) or Player(2)
Resulting in:

Custom script: if Player(1) == Player(0) then
Custom script: <these actions won't happen>
Custom script: elseif Player(1) == Player(1) then
Custom script: <these actions will happen>
Custom script: endif

As every trigger runs on every computer simultanously, all those if/then/else clauses will be checked. However, for player 0, other things will happen than for player 1, because other conditions are true.
 
Level 11
Joined
Jun 21, 2007
Messages
505
AAAI have finnaly understood the GetLocalPlayer FUNCTION with ultimate help of hiveworkshop community. GetLocalPlayer is PRIVATELY sent to each engine of each player who is playing the game. Then GetLocalPlayer works as a SPECIAL CONDITION which means the next value: "# OF PLAYER/OWNER of engine to which the GetLocalPlayer was sent. "GetLocalPlayer"s are 12, and engines don't see the "GetLocalPlayer"s of others. Then GetLocalPlayer works as a SPECIAL CONDITION which means the next value: "# OF PLAYER/OWNER of engine to which the GetLocalPlayer was sent. GetLocalPlayter=player/owner of engine to which the "GetLocalPlayer" was sent (IT'S AUTOMATICALLY TRUE BUT FOR OTHERS IT IS NOT). The If/Then/Else trigger stops for that engine because for that engine the condition says true (else won't go any further), but for others the If/Then/Else wil continue because their private "GetLocalPlayer" says false. If "GetLocalPlayer" is true, the actions will only be done for a single player, because "GetLocalPlayer" was sent to a private engine.


More simple explain:
You have got an ice-cream. Everybody has got an ice-cream. And for everybody the ice-cream says different integer.
Then there's a lottery guy who says who is the winner: he says integers in order from 1 to 12.
If the sounded integer matches the number on your ice-cream, you get a prize.
AT THE END EVERYBODY SHALL WIN (different prizes). AND OTHERS DON'T KNOW WHAT PRIZE YOU'VE GOT.
Ooo... ice-cream... :cool:
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Actually, GetLocalPlayer simply just returns the player who's computer is running the trigger. This means that when GetLocalPlayer is run, the value of it that is returned is not the same as the other player's computers as you can have only 1 computer per player. There is nothing magical about it, just that it is one of the few natives (if not the only) that returns a non syncronised value.

Thus as it is not syncronised, it is possiable to use it to preform actions for only a specific player, as the value will always be unique and constant from other human players.

GetLocalPlayer only works with human players, as AI or neutral players are not run from a different computer.
 
Level 11
Joined
Jun 21, 2007
Messages
505
God, I've got how that "Special filling in Row" is made: the creator simply used WEU (World Editor Unlimited). http://www.wc3campaigns.net/tools/weu/. I read features it includes and it said there, that it's able to make rectangles/rows and fill them in in a row.
(oops, they prohibited me to create threads. may be i said something wrong.)
There's able function "power" - Power, X, Y. Could somebody tell what how does it count? (i've heard it's connected with determining hero's XP required per level)
 
Last edited:
Status
Not open for further replies.
Top