ID:146396
 
Code:
mob/Bump(mob/src)

if(istype(src,/turf))
return

var/to_hit = roll("1d[src.ac]")
src.name += usr.killlist
if(to_hit < usr.ac)
src << "Your attack missed [usr]"
return
else
var/damage_dice = roll("1d[src.str]")
var/damage = round(damage_dice - usr.dex)

if(damage < 0 )
src << "Your attack has no effect on [usr]"
return
else
usr.hp -= damage

if(usr.hp < 0)
src.score += usr.exp
src.exp += usr.exp
src << "You killed [usr]"
del(src)


Problem description:
Took it from a demo on the byond hub, altered it for basic combat to just test. Compiles fine, but when I bump into the monsters on the map I get this error:

runtime error: type mismatch
proc name: Bump (/mob/Bump)
usr: Shades (/mob/PC)
src: Shades (/mob/PC)
call stack:
Shades (/mob/PC): Bump(Cave Lizard (/mob/monster/Lizards/Cave_Lizard))


I just realised it is like a abuse of user on my part.
    src.name += usr.killlist

Is usr.killlist a list? You can't add a list to src.name I think.
In response to CIB
mob/Bump(mob/src)

if(istype(src,/turf))
return

var/to_hit = roll("1d[src.ac]")
src.name
if(to_hit < usr.ac)
src << "Your attack missed [usr]"
return
else
var/damage_dice = roll("1d[src.str]")
var/damage = round(damage_dice - usr.dex)

if(damage < 0 )
src << "Your attack has no effect on [usr]"
return
else
usr.hp -= damage

if(usr.hp < 0)
src.score += usr.exp
src.exp += usr.exp usr.Kills += 1
src << "You killed [usr]"
del(src)


I think that might work but i think you will need to make a var called Kills = 0
shouldn't you do mob/Bump(mob/M)
that way, src applies to the mob Bumping, and M applies to who is bumped...
i don't know if you're allowed to define an argument as src.
You're right, you shouldn't be using usr in a proc such as Bump(). There also a few other flaws which I'll identify in the following code:

mob/Bump(atom/mobable/A) //you won't always bump a mob
if(isturf(A)) return //no need to do istype()
if(istype(A,/mob) && ismob(A)) //if the thing we bumped is a mob
var/mob/M = A //refer to the bumped thing as M.
var/to_hit = roll("1d[src.ac]")

//src.name += M.killlist
//I don't know what you're trying to do with the above. I think you want M.killist += src.name or src.killist += M.name

if(to_hit < M.ac)
src << "Your attack missed [M]"
else
var/damage_dice = roll("1d[src.str]")
var/damage = round(damage_dice - M.dex)
if(damage <= 0) //Notice I made it <= rather than <
src << "Your attack has no effect on [M]"
else
M.hp -= damage
if(usr.hp < 0) //May want to make it that they die on 0 hp too by doing <=
src.score += M.exp
src.exp += M.exp
src << "You killed [M]"
del(M) //You had del(src) but I think you want to kill the guy that lost hp, which would be M.

In response to DeathAwaitsU
You don't need if(istype(A,/mob) and ismob(A), just ismob(A) would work. :p