client/New()
new/obj/Main/a(src)
new/obj/Main/b(src)
new/obj/Main/c(src)
new/obj/Main/d(src)
new/obj/Main/e(src)
new/obj/Main/f(src)
new/obj/Main/g(src)
new/obj/Main/h(src)
new/obj/Main/i(src)
new/obj/Main/j(src)
// new/obj/Hearts/h1(src)
// new/obj/Hearts/h2(src)
// new/obj/Hearts/h3(src)
..()
mob
var
curheart=3
maxheart=3
maxhearthp=4
obj/he1
obj/he2
obj/he3
h1d=4
h2d=4
h3d=4
obj/maxheartse
health=12
maxhealth=12
hearts=3
maxhearts=3
verb
define()
usr.he1=new/obj/Hearts/h1(client)
usr.he2=new/obj/Hearts/h2(client)
usr.he3=new/obj/Hearts/h3(client)
usr.maxheartse=usr.he3
usr.maxhearthp=usr.h3d
testverb(n as num)
usr.health-=n
healthcheck()
recover(n as num)
usr.health+=n
healthcheck()
proc
healthcheck()
if(usr.hearts>=usr.maxhearts)usr.hearts=usr.maxhearts
var/a=(usr.h1d*usr.maxheart)-4+usr.maxhearthp
var/b=usr.health
if(a!=b)
a-=usr.h1d
a-=usr.h2d
b-=usr.h1d
b-=usr.h2d
a=b
if(usr.maxhearthp<=0)
usr.curheart-=1
if(usr.maxheartse==usr.he3)
usr.maxheartse=usr.he2
usr.maxhearthp=usr.h2d
if(usr.maxheartse==usr.he2)
usr.maxheartse=usr.he1
usr.maxhearthp=usr.h1d
if(usr.maxhearthp>=5)
usr.curheart+=1
if(usr.maxheartse==usr.he1)
usr.maxheartse=usr.he2
usr.maxhearthp=usr.h2d
if(usr.maxheartse==usr.he2)
usr.maxheartse=usr.he3
usr.maxhearthp=usr.h3d
usr.maxhearthp=(usr.health-12)+4
if(usr.maxhearthp>=4)usr.maxhearthp=4
if(usr.maxheartse==usr.he3)usr.he3.icon_state="[usr.maxhearthp]"
if(usr.maxheartse==usr.he2)usr.he2.icon_state="[usr.maxhearthp]"
if(usr.maxheartse==usr.he1)usr.he1.icon_state="[usr.maxhearthp]"
if(usr.maxheartse==usr.he3)usr.maxhearthp=h3d
if(usr.maxheartse==usr.he2)usr.maxhearthp=h2d
if(usr.maxheartse==usr.he1)usr.maxhearthp=h1d
obj/Hearts
icon = 'Hearts.dmi'
icon_state = "4"
screen_loc = "10,10"
New(client/C)
C.screen+=src
h1
screen_loc = "9:15,10"
h2
screen_loc = "9:23,10"
h3
screen_loc = "9:31,10"
Problem description:
I'm trying to make a heart system similar to that seen in the Zelda game series. Each heart is divided into quarters (hence the health variable being 12 (3 heart containers * 4 health per heart). I want to make it so you can gain more heart containers throughout the game and have your health go up when recovered and down when injured.
However, so far all I've been capable of doing is making the first of three hearts (I haven't tried it with more than 3 hearts) can gain and lose fractions, but the remaining two hearts do not change, even if health goes below 8.
Does anyone know how to do this? I'd assume that lists would be of help, and those are pretty much my weak point when it comes to programming.
Thanks in advance.
if(whatever)
if(!whatever)
Sorry I cant really help you though.But what I just said, could possibly fix it.change what needs to be changed, and see.