ID:148162
 
Hello, it's been awhile sense i've visted the boards, hope you guys are all doing well. Having a bit of a problem with my DeathCheck proc that i never have had before, which is making me very angry. Well here is the coding:


DeathCheck(mob/M)
if((src.life<=0)&&(src.alignment=="Good"))
src.loc+=new/obj/GoodBrain
src.life=lifemax/2
src.loc=locate("GoodBase")
else if(src.life<=0&&src.alignment=="Evil")
src.loc+=new/obj/EvilBrain
src.life=lifemax/2
src.loc=locate("EvilBase")

DeathCheckNPC(mob/M)
if(src.life<=0)
if(src.alignment=="Good")
src.loc+=new/obj/GoodBrain
del(src)
else if(src.alignment=="Evil")
src.loc+=new/obj/EvilBrain
del(src)

////Attack Coding:

Physical_Attack(mob/M in oview(1))
if(prob(usr.keensense-M.keensense))
M<<"You are able to avoid [usr.name]'s attack!"
usr<<"[M.name] is able to avoid the attack!"
else
usr.damage = (usr.extraordinarystrength)-(M.hardskin)
attackzerocheck(usr)
M.life -= usr.damage
M<<"[usr.name] slams you for [usr.damage]-damage!"
usr<<"You slam [M.name] for [usr.damage]-damage!"
if(M.sex=="Mob")
M.DeathCheckNPC()
else
M.DeathCheck()

It compiles all good and dandy but when it checks their life and their life is zero, I get this error:

"runtime error: type mismatch
proc name: DeathCheck (/mob/proc/DeathCheck)"

Its been a little while sense i've coded and the problem is probably really simple but just baffles me lol. Any help is much appreciated thanks in advance.

-Kalzinere
Well, I think it's becuase it checks if life is below zero...maybe it should be <1? just a guess, and also, please try to use the dm tags when you do code...it's alot easier to understand.

This is what text looks like in the <dm> tags!
Kalzimere wrote:
[snip]
src.loc+=new/obj/GoodBrain
[snip]
src.loc+=new/obj/EvilBrain
[snip]

These two lines are your problem. You can't add an atom to another atom* (at least I'm pretty sure you can't). The correct way to create an obj in a location is like this:

new/obj/GoodBrain(src.loc)

Where did you get that method of creating an object in a location from? Because I want to find the person who's spreading this habit, and knock their brains out through their ears with a long, spiky pole. =)

<font size=-3>*Random thought of the day: Would this create a molecule? =)</font>
In response to Crispy
Well you were right crispy, yeah i don't know why i did that, its been awhile sense i've coded so i wouldn't be surprised if i just made it up thinking it would work lol. Again Thanks for the help.

-Kalzimere