ok, well, i have the icons for the stamina and mana bars i will be using for my game, from the max, to 3/4, to 1/2, to 1/4, to low, to empty. I want to make them appear on the top part of my screen. I was told i may have to use two maps somehow. Anyways, here is the code im starting off with but have no idea how to continue.
obj
hb
icon='healthbar.dmi'
layer=MOB_LAYER+3
proc
update(mob/M,hp,mhp)//arguements for the proc (The owner of the Healthbar,the owners hp, the owners maxhp
var/V=(hp/mhp)
var/obj/hb/A=new
if(V>=1) A.icon_state="full"
else if(V>=0.75) A.icon_state="3/4"
else if(V>=0.50) A.icon_state="1/2"
else if(V>=0.25) A.icon_state="1/4"
else if(V<0.25) A.icon_state="low"
else if(V<=0) A.icon_state="empty"
If there is a nicer way that i can go about doing this so it actually goes up w/each little percentage chance without me having to painstakingly re-icon every single one, please tell =)
THANK-YOU =D
ID:158078
Nov 6 2009, 6:54 pm (Edited on Nov 7 2009, 3:56 pm)
|
|
In response to Delra
|
|
mob
proc addHP(var/N) HP += N HP = min(HP, MaxHP) winset(src, "healthbar", "value=[(HP/MaxHP)*100]") addMP(var/N) //same as above /*addExp(var/N) exp += N //while() instead of if() in case you gain enough exp in one go to gain multiple levels while(exp > maxexp) exp -= maxexp*/ //LEVELUP! winset(src, "expbar", ...) Bars.dm:15:error:...: compile failed (possible infinite cross-reference loop) help please?..... i dont know why the expbar is necesary or where i would need to create one.. |
In response to Jotdaniel
|
|
Jotdaniel wrote:
http://www.byond.com/developer/Jotdaniel/Multitilestatmeter Well i added it in, and it just kept at the blank meter, and the screen got smaller... this stat bar stuff is the hardest thing ive encountered so far in byond |
In response to Darkjohn66
|
|
I didn't tell you to copy and paste, those are demo's not libraries. I pointed that out as an example.
|
In response to Jotdaniel
|
|
Jotdaniel wrote:
I didn't tell you to copy and paste, those are demo's not libraries. I pointed that out as an example. i gave credit =| |
In response to Darkjohn66
|
|
You need to actually understand what you try to compile, not copy-and-paste stuff from the forum. In this case, there are VERY OBVIOUS portions of that which are meant to be filled in with actual code.
|
In response to Darkjohn66
|
|
What I sent you was NOT to be copy-pasted, whatsoever...
A great place to start for newbies. Read it in it's entirety, and you'll understand why the code didn't work... at all... |
In response to Darkjohn66
|
|
I don't care if you give me credit or not, but it's no wonder the damn thing doesn't work if you copy and pasted it. That was my point the last post.
|
In response to Jotdaniel
|
|
Ok i finnally got it working. Thank you all for your help i appreciate it.
|
The power of PEMDAS.