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

Help with Healthbar...

Status
Not open for further replies.
Level 12
Joined
Mar 13, 2020
Messages
421
Hi Guys i need help with the Healthbar Code...

Screenshot (18).png

it works for Singleplayer but when i try to get it to work for more players...
it desync i tryed it with multiinstances of wc3 (local)
and i dont know... how to make this working...
if anyone of you could help me to understand/bring it to work...
 
Level 12
Joined
Mar 13, 2020
Messages
421
Create your frames after all players have finished loading -> 1 second elapsed.
Use GetLocalPlayer() as little as possible. It seems to work fine with BlzFrameSetVisible().
I readed our last Conversation again and then i noticed that you said hide frames for some players...
now i got it but there is one thing i dont get...

[trigger]Player 1
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Custom script: if GetLocalPlayer() == Player(0) then
Custom script: call BlzFrameSetVisible(BlzGetFrameByName("MyBarEx",3) , false)
Custom script: call BlzFrameSetVisible(BlzGetFrameByName("MyBarEx",4) , false)
Custom script: endif[/trigger]

i used this method and it works but.. how i force a player to press esc xD

EDIT: Found it...
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
For new frames, I create unique frames for each player, hide ALL of them by default, and then use GetLocalPlayer + BlzFrameSetVisible to show each player their own frames.

Example:

For index = 0, 24 do
healthbar[index] = BlzCreateFrame(...)
BlzFrameSetVisible(healthbar[index], false)
If GetLocalPlayer() == Player(index) then BlzFrameSetVisible(healthbar[index], true)
 
Level 12
Joined
Mar 13, 2020
Messages
421
For new frames, I create unique frames for each player, hide ALL of them by default, and then use GetLocalPlayer + BlzFrameSetVisible to show each player their own frames.

Example:

For index = 0, 24 do
healthbar[index] = BlzCreateFrame(...)
BlzFrameSetVisible(healthbar[index], false)
If GetLocalPlayer() == Player(index) then BlzFrameSetVisible(healthbar[index], true)

the same i did now i created them and then turned the visible off and with getlocalplayer turn all on again after the game starts did not tested with full lobby (8Players) but with 2 Multiinstance wc3 it worked so far
our last conversation got it for me so i started looking into things i readed one time and found things like getlocalplayer showing only things for one player and then i got it..
thx uncle you are a hero :p
 
Status
Not open for further replies.
Top