Hey all, I have a custom dialog health bar, and I am having trouble in my attempts to resize the health bar when the relevant unit's life changes.
I was attempting to do so in a trigger that runs when any unit (with a specified behavior that I have given to all relevant units) changes life. The trigger would then set the size of the health bar image (set up as Health_Bar[owner of unit(triggering unit)]) to the same Y size as before but a new X size based on the unit's Life/Life Maximum percent, for all players.
I think the problem is possibly in my conversion of the real Life values to integers, but I really can't be sure. I don't know if there's something I need to do after resizing the health bar to make the change appear, or what.
I would really appreciate it if somebody could show me how to resize a health bar!! Thanks :D
Edit: Figured out the solution!
The X value that I used for resizing my health bar is as follows:
Variable - Set X = (Integer((MaxX * (((Triggering Unit) Life (Percent) (Current))/100.0))))
The basic premise is to convert real to integer, then using arithmetic (real) to set the real value in the conversion equal to the largest X value you want multiplied by the life percent divided by 100 (maximum percent).
The X value that I used for resizing my health bar is as follows:
Variable - Set X = (Integer((MaxX * (((Triggering Unit) Life (Percent) (Current))/100.0))))
The basic premise is to convert real to integer, then using arithmetic (real) to set the real value in the conversion equal to the largest X value you want multiplied by the life percent divided by 100 (maximum percent).
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey all, I have a custom dialog health bar, and I am having trouble in my attempts to resize the health bar when the relevant unit's life changes.
I was attempting to do so in a trigger that runs when any unit (with a specified behavior that I have given to all relevant units) changes life. The trigger would then set the size of the health bar image (set up as Health_Bar[owner of unit(triggering unit)]) to the same Y size as before but a new X size based on the unit's Life/Life Maximum percent, for all players.
I think the problem is possibly in my conversion of the real Life values to integers, but I really can't be sure. I don't know if there's something I need to do after resizing the health bar to make the change appear, or what.
I would really appreciate it if somebody could show me how to resize a health bar!! Thanks :DEdit: Figured out the solution!
The X value that I used for resizing my health bar is as follows:
Variable - Set X = (Integer((MaxX * (((Triggering Unit) Life (Percent) (Current))/100.0))))
The basic premise is to convert real to integer, then using arithmetic (real) to set the real value in the conversion equal to the largest X value you want multiplied by the life percent divided by 100 (maximum percent).
@deleted_7920358: Go
Figured out the solution!
The X value that I used for resizing my health bar is as follows:
Variable - Set X = (Integer((MaxX * (((Triggering Unit) Life (Percent) (Current))/100.0))))
The basic premise is to convert real to integer, then using arithmetic (real) to set the real value in the conversion equal to the largest X value you want multiplied by the life percent divided by 100 (maximum percent).