• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Frames, behavior for each player

you create / get the frame access for everyone than you use GetLocalPlayer to change things for only some players.
GetLocalPlayer gives the players themself and then the code will behave different on each machine.
Lua:
frame = BlzGetFrameByName("UpperButtonBarMenuButton",0)
if GetLocalPlayer() == Player(0) then
    BlzFrameClearAllPoints(frame)
    BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)
end
Inside GetLocalPlayer() you can do most things to the frame except for trigger/events, creating or destroying them.
it is important that the first time a frame is directly mentioned in map script that it happens for everyone. As it will register an ID which is checked for multi player desync.
 
When I've done frames stuff, I've initialized stuff at or before 0.1 seconds into the game, assigned stuff to global variables variables and registered any triggers for buttons etc.

Then it's basically ready to go at any time.

Doing it this way is both simple to implement, use and takes care of all that frame registering.

Showing/hiding frames as well as updating text in frames is 100% safe to do in if GetLocalPlayer() == X blocks (where X is a Player or a function returning a Player such as GetTriggerPlayer()).
As always, you need to be a bit careful in any GetLocalPlayer() if-block, because many operations will cause desyncs if called in such an if!
 
Back
Top