• 🏆 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!

Would this cause a desync?

Level 4
Joined
Jun 16, 2012
Messages
25
1707285904444.png

context: Player 10 (Light Blue) is npc. His heroes have the shop sharing ability, allowing other players to use the "Pick Hero" custom ability which selects that hero.

wanted to know if this slop would cause a desync.
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,957
Changing unit ownership to a local player can cause a desync if you're not checking factors that are in sync. The lack of conditions in the trigger is very weird though. You are changing the ownership of the unit to the local player without defining who the local player is? What are you trying to achieve here, why do you use the local player? Also, it's not very good practice to name your variables "GetLocalPlayer", why don't you name it "LocalPlayer" instead for example? Note that even if you set your "udg_GetLocalPlayer" to the local player the reference itself is not to the actual local player, but the variable itself, so it becomes very misleading to name your triggers along with the functions you use to define them, as those may change.
 
Level 4
Joined
Jun 16, 2012
Messages
25
Changing unit ownership to a local player can cause a desync if you're not checking factors that are in sync.
word

To test it, you can launch any number of clients through the BNET app and play LAN with yourself. Just make sure that after launching the second client you immediately return to the first client and click "Play Offline" - it may take a moment to appear. I think if you wait too long then it will cause problems and you'll have to exit out and try again.
found a way to test it too and ended up fixing it
 
Top