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!
Stuck in learning Frames in world editor. I'm using w3ts library, but can use LUA code. Can someone explain me how to show different state or Frames for certain 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!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.