• 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.

[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?
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
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
...
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
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.
Top