• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] BlzGetMouseFocusUnit desync

Status
Not open for further replies.
Level 6
Joined
Mar 27, 2019
Messages
51
Hey,

I'm trying to use BlzGetMouseFocusUnit() for proper Unit Detection for Mouse Hover, it has to be Multiplayer compatible, I read that it causes desyncs because it stores the value locally and doesn't sync to others. Anyways is there a simple way to sync the udg_Temp_Unit or whatever must be synced?
I never used SyncMethods and need a explaination for these, they seem a bit complicated.

  • Local
    • Events
      • Player - Player 1 (Red) types a chat message containing - as An exact match
    • Conditions
    • Actions
      • Custom script: set udg_Temp_Unit = BlzGetMouseFocusUnit()
      • Game - Display to (All players) for 1.00 seconds the text: (Name of Temp_Unit)
 
Level 5
Joined
Oct 16, 2007
Messages
67
I don't know of a simpel way.
If you are willing to use jass (or lua, whatever you chooser) there is a way.

I would use a unit index system. Use a trigger with the sync event BlzTriggerRegisterPlayerSyncEvent to receive the index. Send it in a local Player block using BlzSendSyncData.

Made an example, in the SyncTrigger you would use the number to get back to the unit. (Didn't test it in multiplayer)

In theory you could use the unit handle, but sadly the handles are not synced between player which can lead to desyncs.
 

Attachments

  • BlzGetMouseFocusUnitSync.w3m
    18.3 KB · Views: 24
Status
Not open for further replies.
Top