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

Would this cause a desync?

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
JASS:
  if (IsSlayer(uD)) {
    DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 10, GetPlayerNameColored(Player(pD)) + "'s " + GetUnitName(uD) + " has fallen");
    StartSound(gg_snd_HPitLordWhat1);
  }


We we're playing the game and right when one of the player's Hero died which triggers the above code, he desyncd.

If so is it the sound or the text message that would cause it?

Let me know if you want me to paste the whole code.
 
Last edited:
Level 12
Joined
Dec 2, 2016
Messages
733
If isSlayer has even one GetLocalPlayer call, it will desync.

As it is, I don't see any possibility of desyncs in the code. If you say otherwise, I defer to the former statement above.

But the message is displaying to the local player, you say that if it is local player it will desync?


This is the isslayer function

JASS:
public function IsSlayer(unit u) -> boolean {
    return IsSlayerId(GetUnitTypeId(u));
}



This is the main function that happens on death


JASS:
private function OnDeath() -> boolean {
  unit u;
  unit uD = GetDyingUnit();
  unit uK = GetKillingUnit();
  integer uDId = GetUnitTypeId(uD);
  integer uKId = GetUnitTypeId(uK);
  integer pD = GetPlayerId(GetOwningPlayer(uD));
  integer pK = GetPlayerId(GetOwningPlayer(uK));

  UpdateOnDeath(uD, uK);

  if (IsSlayer(uD)) {
    DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 10, GetPlayerNameColored(Player(pD)) + "'s " + GetUnitName(uD) + " has fallen");
    StartSound(gg_snd_HPitLordWhat1);
  }
 
Try exposing the IsSlayerId function and UpdateOnDeath.

EDIT:

@MyPad said:
If isSlayer has even one GetLocalPlayer call, it will desync.

I am pertaining to the isSlayer function, due to the possibility of it returning a different value for each player.

Displaying in-game text messages with GetLocalPlayer would not desync at all as long as all the clients have the same string table.
 
Status
Not open for further replies.
Top