Code:
mob/Enemies
Wolf
icon='wolf.dmi'
icon_state=""
Name = "Wolf"
Level=10
Exp=30
MaxHP=50
Str=5
Def=7
Gold=5
Side = "Evil"
Alien
icon='alien.dmi'
icon_state=""
Name = "Alien"
Level=20
Exp=60
MaxHP=100
Str=20
Def=10
Gold=50
Side = "Evil"
New()
new /obj/AlienSuit(src)
..()
mob/Enemies/New()
src.HP=src.MaxHP
spawn(-1) src.CombatAI()
return ..()
mob/Enemies/proc/CombatAI()
while(src)
if(isDead == TRUE)
return
for(var/mob/player/M in oview())
if(src.isDead == TRUE)
return
if(get_dist(src,M)<=1)
src.dir=get_dir(src,M)
src.attack()
else
step_to(src,M)
break
sleep(rand(4,8))
Problem description: The object drops but when the enemy respawn they don't go up to me and attack
DeathCheck
Enemies
DeathCheck(mob/attacker)
if(src.HP <= 0)
attacker<<"<b><font color=red>You killed [src.Name] for [src.Exp] exp and for [src.Gold] Gold" // Enemy dies
attacker.Exp += src.Exp
attacker.LevelCheck()
if(src.Name == "Alien")
if(prob(50))
for(var/obj/o in src)
o.Move(loc)
isDead = TRUE
attacker.Gold += src.Gold // You should change it, the person'll always receive 2 gold from any kind of NPC.
src.Respawn()
Respawn
mob/var/Respawn_Loc
mob/proc/Respawn()
var/Old_Icon = icon
icon = null
density = 0
spawn(rand(600,1200)) // waits 60~120 seconds.
density = 1
icon = Old_Icon
loc = Respawn_Loc
Dead = 0
src.isDead = FALSE
mob/New()
..()
if(!client) Respawn_Loc = loc