if GetLocalPlayer() == GetEnumPlayer() then

Chocobo

White-Flower
Reaction score
409
I don't really understand that well, I just want someone explains what it does really..
Here is full trigger to show their own multiboard to all players..

Code:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_ShowMultiboardforPlayer(  )

Code:
function Trig_ShowMultiboards_Func001A takes nothing returns nothing
if GetLocalPlayer() == GetEnumPlayer() then
    call MultiboardDisplayBJ( true, udg_PlayerMultiboard[GetConvertedPlayerId(GetEnumPlayer())] )
endif
endfunction

function Trig_ShowMultiboards_Actions takes nothing returns nothing
    call ForForce( GetPlayersByMapControl(MAP_CONTROL_USER), function Trig_ShowMultiboards_Func001A )
endfunction

function InitTrig_ShowMultiboardforPlayer takes nothing returns nothing
    set gg_trg_ShowMultiboardforPlayer = CreateTrigger(  )
    call TriggerAddAction( gg_trg_ShowMultiboardforPlayer, function Trig_ShowMultiboards_Actions )
endfunction
 

Jazradel

Helping people do more by doing less.
Reaction score
102
GetLocalPlayer() forces Warcraft III to run the action for only that player.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Well not always ^^.
Code:
if IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS) then
will always run.

GetLocalPlayer() returns the player that runs on the local computer, ie it will be different on each computer that is executing the script.

GetEnumPlayer() is just Picked Player.

I think you can make your script alot easier by just typing
Code:
call MultiboardDisplayBJ( true,udg_PlayerMultiboard[GetConvertedPlayerId(GetLocalPlayer())] )
Insteed of the ForForce line.
 
D

Dino.pl

Guest
GetLocalPlayer() forces Warcraft III to run the action for only that player.
No... GetLocalPlayer() gets local player :D
I don't really understand that
Which part isn't clear for you?
Why is it executed for the local player only?
Or something else?
 
D

Dino.pl

Guest
Chocobo said:
Code:
Why is it executed for the local player only?
That's the question.
It's simple.
Every function is executed locally (on each player's computer), so if a statement like
Code:
if (GetLocalPlayer() == whatever_you_want)
returns false, the code inside it won't be executed for the local player.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top