ID:143417
 
Code:
mob
NPC
Goblin
icon = 'enemies.dmi'
icon_state = "goblin"
density = 1
Bump(mob/M)
..()
if(!M)
M.hp -= 10/M.def
sleep(100)

else return

New()
..()
walk_rand(src,5)


Problem description:
The code doesn't come up with any errors in DM, but it doesn't work when I run the game.

I'm sure it's something REALLY obvious, but could someone help me?

if(!M)

thats basicaly the same as if(M==null)

you probably want something like
if(ismob(M))
In response to Falacy
Falacy wrote:
if(!M)

thats basicaly the same as if(M==null)

you probably want something like
if(ismob(M))

That MIGHT be one problem, but the Goblin doesnt even Bump me

i think i need to make it so that the goblin walks towards me, and THEN Bumps me
In response to JaxxMarron
thats all the code you have for it? no attack code or anything?
yea, walk_rand wont bump into things
walk_towards for bumping
In response to Falacy
Falacy wrote:
thats all the code you have for it? no attack code or anything?
yea, walk_rand wont bump into things
walk_towards for bumping

i thought the usr.hp -= 10/usr.def was good enough for an attack code -.-
In response to JaxxMarron
1. thats a bad damage calc formula in my opinion
2. it doesnt check if the player died
3. the sleep(100) does nothin
4. you have to make the npcs actualy hunt the players
they cant just walk around randomly when someone is beating them to death
5. with the way you have this setup right now youd have to recode the bump for every single enemy you made, bad idea
In response to Falacy
Falacy wrote:
1. thats a bad damage calc formula in my opinion
2. it doesnt check if the player died
3. the sleep(100) does nothin
4. you have to make the npcs actualy hunt the players
they cant just walk around randomly when someone is beating them to death
5. with the way you have this setup right now youd have to recode the bump for every single enemy you made, bad idea

oh, ok. thanks