Page 1 of 1
Cmud Help Needed - Health Bar
Posted: 10 Feb 2017 15:21
by Kitriana
Does anyone know how to create a health bar in cmud?
If so -- can you provide a step by step explanation for someone who is not tech savvy (that would be me)
Thanks!
Re: Cmud Help Needed - Health Bar
Posted: 10 Feb 2017 20:39
by Jooli
I have this in a status window. See the attached xml
Then enable status window on Window menu.
Re: Cmud Help Needed - Health Bar
Posted: 10 Feb 2017 20:40
by Melarec
I'm not sure how to do it properly, but a clunky way to do it is:
Two divs; one nested in the other; exact same size; no padding or margin.
Use JS to adjust the nested div's width compared to its parent.
(It's been a while, but I'm pretty sure you just use percentages for this..)
Tie width values to specific heath points (In JS) Example:
Health at 15 out of 20; "width: 75%;" or better: "width: 15/20;" And it should do the maths itself.
Or, for a more Genesis-like system:
Health at 'Very Hurt' ; "width: 45%;" (or whatever)
This would require a lot of recursive if/else/then's, though.. (I think.)
(<--Wrong.. A string list works better. Thanks for the reminder, Jooli
)
With the number system, all you need are replaceable variables.
Hope this helps/gives some ideas.
EDIT: Herp, that's a much better way than mine, Jooli..
Re: Cmud Help Needed - Health Bar
Posted: 10 Feb 2017 20:40
by glantri
There is code for that
here. It works like the web client.
Re: Cmud Help Needed - Health Bar
Posted: 11 Feb 2017 21:06
by Kitriana
thanks guys -- i'll take a look and see if i can implement
Re: Cmud Help Needed - Health Bar
Posted: 27 Feb 2017 20:02
by Cerin
I tried to get both to work, but neither of them want to keep my health or the enemies health updated for some reason. Just copied to notepad and saved as xml for both, but they have the same problem. Any fix for it?
Re: Cmud Help Needed - Health Bar
Posted: 28 Feb 2017 12:14
by Jooli
For my script it gets update when you do health enemy, so make a trigger to do health enemy together with your combat special