• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] texttags and desyncs

Status
Not open for further replies.
Level 19
Joined
Dec 12, 2010
Messages
2,069
accordint to this thread
http://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:
Level 15
Joined
Aug 7, 2013
Messages
1,337
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)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
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
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
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.
Top