ID:1521160
 
Code:
mob/proc/Bleed(br,bs)
for()
var/i
usr.health -= br
sleep(10)
bleed = br
ChkBld(bs)
mob/Move()
if(bleed)
if(/obj/blood in usr.loc)
return
new/obj/blood(usr.loc)
..()


Problem description:
This is the code I have so far. It works except I want the game to check if there is already blood on a tile before it adds some, and for the script to iteriate a variable until it equals bs, at which point it sets br back to 0. The way the script works, is when you want something to make something bleed you call usr.Bleed(br,bs) where br is the amount of damage per second and bs is the amount of second. So far I have the first part down, but need help with it stopping when it reaches bs, and only putting one blood on a square.
Oh and the ChkBld is meant to be a proc that checks to see if the i equals bs, then returning 1 or 0.
If the blood serves on other purpose other than visual it could be made an image.

You should probably be careful of using returns in procs like move(). Perhaps just do:

if(bleed && !(locate(/obj/blood/) in loc)) new/obj/blood(loc)


Move() should have src not usr in it. Since it's the src that is moving. As such you don't need to type out src.loc either.
I'm not sure if path in loc even works, so I assume you should be using locate().


As for Bleed proc. Look up "c++ for loop" on google? You should be able to skim enough off that.
Thanks, I forgot that for() had iteriation built into it.


hehehe lol

You are enveloped in a powerful explosion!
Your body goes limp and pale as you bleed profusely, fountains of blood gushing out!
You drop dead on to the floor!