• 🏆 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] Desync on DisplayTextToForce?

Status
Not open for further replies.
Level 1
Joined
Apr 27, 2013
Messages
2
Hi there,

I'm not really new to JASS but I've never given it any thought til now,
and now that I have I'm not quite sure whether I got it right, so I thought this would be a good place to ask:

JASS:
function DisplayTextToForce takes force toForce, string message returns nothing
    if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
        // Use only local code (no net traffic) within this block to avoid desyncs.
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
    endif
endfunction

Will
JASS:
call DisplayTextToForce( GetPlayersAllies(Player(0)), "something" )
actually (besides from leaking a force) potentially desync the string table between allies and enemies of player red on the first usage,
because it will write "something" only for his allies? :eekani:


~dizzied by his own thoughts,
SB
 
Fortunatly not ^^.
You pass "something" as the argument of a function, wether you are an ally of Player(0). The string is stored and appears in the executed code, even if it is not used for display.

In other words :
JASS:
function RegisterString takes string s returns nothing
endfunction

...
    // That line will register the string, even if it does nothing with it.
    call RegisterString("something")
...
 
Status
Not open for further replies.
Top