I have triggered a custom life bar in the UI which shows the life of the player hero, and I am wondering if I need to build as many life bars as there is human players and to show only the good one to the player. Or if I can identify the player behind the computer and react only if his hero life changes. I'd like to avoid to update many bars instead of only one.
Not sure if I explain well, it is a dark point for me. I wonder what is synchronized between players and what is not.
I have seen triggers for a native progress bar and I still don't understand how it works. It seems to not be synchronized, each player sees his own progress bar even if in the triggers there is only one progress bar displayed, so I am a bit lost.
My custom bar is not a progress bar, it is done with a dialog image and I change his size.
Actually I don't know how I could show only the good life bar to a player -.-
Players are saved as integers, so anytime you reference a player you are using an integer 0-15.
When you update a dialog/dialog item, you update it for a player group. If you are only updating for one player, you can use the function Convert Player to Player Group. Thus you only need one dialog and not one per player.
The easiest way to run actions by player is using a Pick each player in Player Group loop, where you can then reference each player with the Picked Player function. The All Players group will cycle through all 15 players, so typically you want to use the Active Players group. If instead you are updating a dialog from an event handler, use things like Triggering Player or Owner of Unit(Triggering Unit) to get the player's integer.
Here is a completely arbitrary example of how you could change the text of a dialog item to show a player their own name.
but it only works for dialog items, dialogs itself cannot be changed on a per player basis. for example if you want to change the size of a dialog for one player only, that's not possible
I created a dialog "lifebar" and you will likely find that using a periodic to update all of the bars at once will still be your best bet, in almost all situations.
Using a periodic of .3 to run a loop to calculate the lifebar size and alter it accordingly (which should actually be done as a repeat forever, with a wait .3 real time at the end) should not cause much of a lag issue. Having a trigger to register every time a units vitals change, well, that will run 60 times a second. Even that many fired and failed conditions will likely be more problematic than simply updating all dialogs at once.
Hello,
I have triggered a custom life bar in the UI which shows the life of the player hero, and I am wondering if I need to build as many life bars as there is human players and to show only the good one to the player. Or if I can identify the player behind the computer and react only if his hero life changes. I'd like to avoid to update many bars instead of only one.
Not sure if I explain well, it is a dark point for me. I wonder what is synchronized between players and what is not. I have seen triggers for a native progress bar and I still don't understand how it works. It seems to not be synchronized, each player sees his own progress bar even if in the triggers there is only one progress bar displayed, so I am a bit lost.
My custom bar is not a progress bar, it is done with a dialog image and I change his size.
Actually I don't know how I could show only the good life bar to a player -.-
Players are saved as integers, so anytime you reference a player you are using an integer 0-15.
When you update a dialog/dialog item, you update it for a player group. If you are only updating for one player, you can use the function Convert Player to Player Group. Thus you only need one dialog and not one per player.
The easiest way to run actions by player is using a Pick each player in Player Group loop, where you can then reference each player with the Picked Player function. The All Players group will cycle through all 15 players, so typically you want to use the Active Players group. If instead you are updating a dialog from an event handler, use things like Triggering Player or Owner of Unit(Triggering Unit) to get the player's integer.
Here is a completely arbitrary example of how you could change the text of a dialog item to show a player their own name.
but it only works for dialog items, dialogs itself cannot be changed on a per player basis. for example if you want to change the size of a dialog for one player only, that's not possible
Thanks for your answers, I understand better.
I created a dialog "lifebar" and you will likely find that using a periodic to update all of the bars at once will still be your best bet, in almost all situations.
Using a periodic of .3 to run a loop to calculate the lifebar size and alter it accordingly (which should actually be done as a repeat forever, with a wait .3 real time at the end) should not cause much of a lag issue. Having a trigger to register every time a units vitals change, well, that will run 60 times a second. Even that many fired and failed conditions will likely be more problematic than simply updating all dialogs at once.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
I don't know. Sure life is a real so it must change very often particularly with regene. But when the player is full life, life doesn't vary.
Am I wrong thinking the fewer interval on SC2 is 0.0625 s ? It is 16 times per second.