ID:177721
 
This is really stressing me out... I've had a bad day to begin with. So here:

mob/var
insurance = /turf/medic/Free // insurance type
inhospital = 0

mob/proc/hospital()
var/area/T = usr.insurance
for(T in world)
if(Move(T))
src << "You have made it into a hospital bed!"
src.inhospital = 1
return


//HEAL CHECK


mob
var/healtime=200

New()
..()
spawn(healtime) HealLoop()


proc/HealLoop()
if(vitality<=0 )
if(inhospital == 0)
hospital()
else
..()
if(inhospital == 1)
for(var/turf/medic/T in view(0,src))
src.vitality += T.healrate
vitality=min(vitality+1,max_vitality)
spawn(healtime-recovery) HealLoop()


NOw, it keeps on sending me to the hospital...over and over and over and over and over and over and over and over and over and over and over and over and over and over and over and over and over and over and over again.

Help is GREATLY appreciated.

-ST
Your code was a bit hard to interpret, but I did the best I could to make it as much like your code as I could.

mob/var
insurance = /turf/medic/Free
healtime = 200

turf
medic
Enter(mob/M)
if(src.type != M.insurance)
src << "Sorry, your insurance doesn't cover this type of healing.\n"
return FALSE
HealLoop(M)
return TRUE


proc/HealLoop(mob/M)
var/turf/A = locate(M.loc)
if(A.type != M.insurance)
return
var/recovery = min(M.vitality+1,M.maxvitality) - M.vitality
M.vitality = recovery + M.vitality
spawn(healtime-recovery)
HealLoop()

If that's not what you were after, then I can modify it to suit your needs. :)
In response to Malver
No No No, I'm trying to make it so that it moves you to a Hospital if your health is below 0. (Depending on your insurance)
In response to Sariat
Sariat wrote:
No No No, I'm trying to make it so that it moves you to a Hospital if your health is below 0. (Depending on your insurance)

Oh.

Okay, then have a check in your damage proc..

if(src.vitality < 1)
for(var/turf/medic/M in world)
if(M.type == src.insurance)
src << "Off to the hospital with ye!"
src.loc = M

Is that what you're after?
It may be even more interesting to allow player made insurance. A player buys an insurance computer. Then it creates its own custom plans which are basically just a text variable set by the insurer. Then also there are 2 other variables one that shows who the insurer is and who the patient is. (signatures basically). Players also play doctor's. A player would log onto the medical network enter the patients name and the computer searches all registered agencies for insurance data. Then it reads the description and validates signatures then calls the agency for insurance money transactions and while the money is transferredoperates on the patient. Also insurance may not cover patient care and require the patient to pay. This would allow a more immersive RPG style game and make secret identities useful by being able to have a job.
In response to Malver
Gahhh! Ugh, all you have to do is set your health to 0 or 1 or whatever, as long as it's above the limit, when you go to the hospital.
In response to Garthor
Garthor wrote:
Gahhh! Ugh, all you have to do is set your health to 0 or 1 or whatever, as long as it's above the limit, when you go to the hospital.

What are you talking about?

He wants it to send you to the hospital if you health drops below zero.
In response to Malver
No, on the next healloop(). So you can be looted in that small time frame :)
In response to Sariat
Sariat wrote:
No, on the next healloop(). So you can be looted in that small time frame :)

Well, your original post didn't really tell me much of anything, so I had to do what I could with the information that I had.

Did it help at all, or did my time go to waste? >:)
In response to Garthor
Don't return with your damn for loops! If you have more than one area of hospital then it will locate you over and over until it's done looping.

for(T in world)
src.Move(locate(T.x,T.y,T.z))
break//stops looping
In response to Super16
Super16 wrote:
Don't return with your damn for loops! If you have more than one area of hospital then it will locate you over and over until it's done looping.

I didn't return, but I know what you are getting at. Thanks for pointing that out. I tend to do that a lot without realizing it.

Nasty habit. :P