here is the error
runtime error: type mismatch
proc name: Hit (/mob/proc/Hit)
source file: game.dm,106
here is the verb and associated procs
verb
punch (src as mob in view(1))
if (usr.Hp <= 0) usr << "You can't do that your out cold!"
else AccChk (src)
proc
AccChk ()
var
TAcc = rand ((usr.Acc / 2), (usr.Acc * 1.25))
TAc = rand ((src.Ac /2), (src.Ac * 1.25))
if (TAcc >= TAc) src.Hit (src)
else Miss (src)
Hit (TAcc)
src.Hp = src.Hp - TAcc
oview () << "[usr] hit [src] for [TAcc] Damage."
if (src.Hp <= 0) KO ()
else return
Miss ()
oview () << "[usr] misses [src]."
return
KO ()
src.Status = "Unconcious"
return
Please help me make that go away.. ~.~
ID:149236
Jun 13 2002, 11:20 am
|
|
In response to ACWraith
|
|
ok.. i did that.. its half working
but something funny is going on.. 1. the damage miss or bounce message is echoed to the victim.. but not the attacker 2. the attacker is hitting, missing our bouncing himself in this message.. and finaly. 3. The attacker does actualy damage themselves.. they can even knock themselves out.. what the hell is going on.. (edited code) verb punch (src as mob in view(1)) if (usr.Hp <= 0) usr << "You can't do that your out cold!" else AccChk (src) proc AccChk () var TAcc = rand ((usr.Acc / 2), (usr.Acc * 1.25)) TAc = rand ((src.Ac /2), (src.Ac * 1.25)) if (TAcc >= TAc) src.Hit(TAcc) else Miss (src) Hit (TAcc) src.Hp = src.Hp - TAcc oview () << "[usr] hit [src] for [TAcc] Damage." if (src.Hp <= 0) KO () else return Miss () oview () << "[usr] misses [src]." return KO () src.Status = "Unconcious" return |
In response to EzrahChan
|
|
Don't use usr in procs. If you have to use a mob other than src, try passing that mob as a proc argument.
PS: Why do you pass src as an argument into procs which don't take arguments? |
[snip]
[snip]
[snip]
In AccChk(), you call Hit() with src, which is a mob, as the argument. However, in Hit(), you subtract the argument, TAcc, as if it is a number. (I'm assuming that HP is a num.) In AccChk(), did you want to call src.Hit(TAcc)?