ID:177743
 
Okay, I was trying to do this before, but I butchered it all up.

mob
var/recov=200

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

proc/HealLoop()
vitality=min(vitality+1,max_vitality)
spawn(healtime-recovery) HealLoop()


This works, now, what I want it to do, is that when you die, you go to the hospital (/turf/medic/blah blah) according to your insurance plan. I've tried a few different ways, but they ended up messing up big time.


Basically, the more insured you are, the more treatment (and faster treatments) you get, so you can be on your way out.


Thanks.


-ST
Sariat wrote:
Okay, I was trying to do this before, but I butchered it all up.

> mob
> var/recov=200
>
> New()
> ..()
> spawn(healtime) HealLoop()
>
> proc/HealLoop()
> vitality=min(vitality+1,max_vitality)
> spawn(healtime-recovery) HealLoop()
>
>

This works, now, what I want it to do, is that when you die, you go to the hospital (/turf/medic/blah blah) according to your insurance plan. I've tried a few different ways, but they ended up messing up big time.


Basically, the more insured you are, the more treatment (and faster treatments) you get, so you can be on your way out.


Thanks.


-ST

Honeslty, right now all i can think of is make a var. For instance: insurnaceplan, as your var. When they have better insurance have the var risen up 1, Then, when they die, have it check there var. Upon doing that have it setup whatever way you want. So -
if(usr.insurranceplan==1)
usr << "Hey, Patient, You got no insurance. HAHAHAHA!"
sleep(100000)
usr << "Finnaly done")
else if(usr.insurranceplan==2)
usr << "Hey, You got 'Okay' insurance HAHAHAH"
sleep(10000)
usr << "Finnaly done"


I don't know what i just typed, it's not tabbed right. But im sure youll get it ;)

RaeKwon
If you want to have faster treatment for better insured people, here is my suggestion.

the lower the value of var/insuranceplan is, the faster you'll get healed.

for(health, health != healthmax, health++)
sleep(insuranceplan)

For better treatment for better insured people, try something like

for(health, health != healthmax - ((insuranceplan - 1) * 5),health++)
sleep(insuranceplan)

That way for every points your insurance is above 1 you dont get healed 5 points. I am making 1 the highest insurance or else there would be no delay. But you might not want a delay for the best insurance. This way, if your insurance plan is 1, you get healed to max, but if it is lower, it takes longer and you don't get healed to max. I hope this helps you.
In response to RaeKwon
Well, I was trying to check what kind of turf you were on. So if you have "Basic" insurance, you would go to a hospital bed. (/turf/medic/Basic)

And in the heal check, if you were on the "Basic" turf, you would get back HP faster, depending on that turfs "Heal Rate". So, if the "Basic" turf had a heal rate of 3, you would get back 2 of your health every time the Heal proc was called.

turf/medic
var/healrate = 1
basic
healrate = 2
advanced
healrate = 3
premium
healrate = 4

//And so on and so on.



I hope that made sense.....


-ST
In response to Sariat
Sariat wrote:
Well, I was trying to check what kind of turf you were on. So if you have "Basic" insurance, you would go to a hospital bed. (/turf/medic/Basic)

This can be accomplished using istype(), because it accepts text strings (I'm pretty sure it does). So you might try something like this.
for(var/turf/medic/T in world)
if(istype(T,"/turf/medic/[src.insurance]"))
src.density = 0 //switch density off to make sure you're moved
src.Move(T)
src.density = 1


And in the heal check, if you were on the "Basic" turf, you would get back HP faster, depending on that turfs "Heal Rate". So, if the "Basic" turf had a heal rate of 3, you would get back 2 of your health every time the Heal proc was called.

> turf/medic
> var/healrate = 1
> basic
> healrate = 2
> advanced
> healrate = 3
> premium
> healrate = 4
>
> //And so on and so on.
>


To check for turfs in your location, simply use a for list proc to check for turfs in view(0), like so:
mob/proc/healloop()
for(var/turf/medic/T in view(0,src))
src.life += T.healrate
//etc
In response to WizDragon
Ah! Thanks!