mob/Enemy
Slime
icon='slime.dmi'
level=1
health=10
maxhealth=10
str=5
pow=5
def=5
exp=21
money=10
New()
src.health=src.maxhealth
src.mana=src.maxmana
spawn()
src.Wander()
return ..()
proc/Wander()
while(src)
if(src.Frozen == 1)
break
else
if(src.Target)
if(get_dist(src,src.Target)>1 && !step_to(src,src.Target,1))
src.Target=null;continue
src.dir=get_dir(src,src.Target)
src.Fight()
if(!ListCheck(src.Target,oview(5)))
src.Target=null
sleep(rand(1,2))
else
sleep(rand(10,15))
if(!src.Target)
for(var/mob/M in oview(4))
if(M.key)
if(step_to(src,M,1))
src.Target=M
sleep(5)
break
proc/Fight()
for(var/mob/M in get_step(src,src.dir))
if(M.key == M.client.key)
var/damage=src.str-M.def
damage=max(1,damage+rand(-1,1))
M.health -= damage
sleep(7)
M <<"<font size=1><b><font color=red>[src] was hit by [M] for [damage] damage!"
M.DamageShow(damage,200,0,0)
M.DeathCheck(src)
ID:1396839
Oct 12 2013, 7:45 am (Edited by moderator on Oct 12 2013, 7:50 am)
(See the best response by LordAndrew.)
|
|
I am having some trouble making a enemy corpse(when it dies the icon stays the same).Heres the enemy slime code:
|
Oct 12 2013, 8:08 am
|
|
It doesn't appear you're setting a dead state anywhere in your code here. I suspect you're handling it in DeathCheck(), which we'll need to see.
|
here's my deathcheck
DeathCheck(mob/Killer) |
In response to Tiago7727
|
|
I see. What do you have in make_corpse()?
Also, please make sure to wrap your code in <dm> tags so that the forum renders it correctly: <dm> your_code_here() </dm> |
proc |
A few things:
You're setting O.icon twice, and it appears you're generating an /icon object for it (rather than just directly setting the icon and icon_state, which may be the reason behind why it isn't working). You could also easily just do var obj/o = new (m.loc) rather than verbosely setting its exact coordinates. Another thing is, do you actually have a state in your icon for [m.icon_state]_dead? If not then it would either turn blank or default to the null state in your icon. // Try giving this version a whirl. Or, if you're feeling adventurous, you could do... obj/corpse |