• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] texttags and desyncs

Status
Not open for further replies.
Level 19
Joined
Dec 12, 2010
Messages
2,078
accordint to this thread
https://www.hiveworkshop.com/forums/triggers-scripts-269/getlocalplayer-texttags-192757/

i tried to use locally created texttags, but got tons of desync while testing.
whats wrong with me? did anyone actually tested locally created Texttags in multiplayer aside from "assuming"?
JASS:
function imitategold takes player whichPlayer, unit whichUnit, integer gold returns nothing
local texttag t
call SetPlayerState(whichPlayer,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(whichPlayer,PLAYER_STATE_RESOURCE_GOLD)+gold)
if GetLocalPlayer()==whichPlayer then
set t=CreateTextTag()
call SetTextTagText(t,"+"+I2S(gold),.025)
call SetTextTagPosUnit(t,whichUnit,-0.4)
call SetTextTagColor(t,255,220,0,255)
call SetTextTagVelocity(t,0,.03)
call SetTextTagVisibility(t,true)
call SetTextTagFadepoint(t,2)
call SetTextTagLifespan(t,3)
call SetTextTagPermanent(t,false)
endif
 
Last edited by a moderator:
When I make text tags, the only part I put in a local player block is who gets to see it. But if you're code doesn't desynch, then it's just as good or better even.

JASS:
							set tt = CreateTextTag()
							call SetTextTagText(tt, "Exp +" + I2S(R2I(expGain)), 0.02)
							call SetTextTagVisibility(tt, false) //hide text tag
							if players[i] == GetLocalPlayer() then //show tag only if its the owning player
								call SetTextTagVisibility (tt, true)
							endif
							call SetTextTagPosUnit(tt, m, 0)
							call SetTextTagColor(tt, 190, 0, 255, 255)
							call SetTextTagVelocity(tt, 0, 0.04)
							call SetTextTagPermanent(tt, false)
							call SetTextTagLifespan(tt, 3)
							call SetTextTagFadepoint(tt, 2)
							call AddHeroXP(m, expGain, true)
 
I think it worked for me always with only setting string localy:
JASS:
if GetLocalPlayer() == p then
    set s = ("I'm a texttag")
endif
set t =  CreateTextTag()
call SetTextTagText(t, s, x)
call SetTextTagPosUnit(t, u, 0)
call SetTextTagColor(t, 255, 255, 255, 255)
call SetTextTagVelocity(t, x, y)
call SetTextTagPermanent(t, FALSE)
call SetTextTagFadepoint(t, x)
call SetTextTagLifespan(t, x)
 
you can create, and should create texttags inside local block, but never do "+"+I2S(gold), because you desnyc the string table, which may, and as it seems in your case leads to desync. Create the string outside the local block, and store it inside variable. This way all players will have the same entries in their string table
 
never had string desync either. assuming that one object could have multiply names and there are could be any operations over them - its not possible.

PurgeandFire - yeah, seems like i was a fool and included gold inc line into local code 1st time, thats why tests failed :<
 
Status
Not open for further replies.
Back
Top