[JASS] LocalPlayer question

Status
Not open for further replies.
Level 19
Joined
Oct 12, 2007
Messages
1,821
Hey there.

I've got a few systems in my map with floating texts, and I know it's possible to make them only appear for 1 player. So this is where I have to use the GetLocalPlayer function, but I never worked with it.
How does this work?

Would this work:
JASS:
local unit u = GetTriggerUnit()
local player p = GetUnitOwner(u)
if p == GetLocalPlayer() then
///all the floating text functions///
endif

So GetLocalPlayer only affects the lines between the if/then/endif?
 
You should create the floating text first outside the if/then/else and then show it to the wanted player inside the if/then/else to avoid desync.
Like this:
JASS:
...
local texttag tt = CreateTextTag()
call DoSomethingWithTheTextTag(blablabla)
if p == GetLocalPlayer() then
    call SetTextTagVisibility(tt, true)
endif
...
 
You should create the floating text first outside the if/then/else and then show it to the wanted player inside the if/then/else to avoid desync.
Like this:
JASS:
...
local texttag tt = CreateTextTag()
call DoSomethingWithTheTextTag(blablabla)
if p == GetLocalPlayer() then
    call SetTextTagVisibility(tt, true)
endif
...

Oke, problem solved. Thankyou:D
 
Status
Not open for further replies.
Back
Top