mob
Move()
for(var/mob/spawnbaby2/M in oview(5)) if(!M.woken) spawn() AI(M,src)//checks for mobs of the monster variety and if they aren't already using the AI code it calls it
..()
Login()
icon='player.dmi'
client.view=9
..()
spawnbaby2
New()
for(var/client/M in oview(5)) AI(src,M)//Checks for any players and if found calls the AI code with the NPC and said player
..()
spawnbaby2
icon='zombie.dmi'
var
woken
attacking
proc
Attack(mob/spawnbaby2/T)
for(var/mob/M in get_step(T,T.dir))//Checks for mobs infront of T
var/damage=rand(1,3)//Generates a random damage value(You can setup your damage calculation here like Strength-defense
view(6)<<"[T] attacks [M] for [damage] damage!"//Shows everyone how much T attacked M for
//here would be where you enter your health subtraction/deathcheck code
AI(mob/spawnbaby2/T,mob/M)
if(!T||T.client||!M.client) return//stop if T doesn't exist anymore or if T is a client or if M is not a client
T.woken=10
while(T&&T.woken)//while T exists and T is woken
sleep(10)//sleep 10 so theres less lag you can probably make this lower if you want NPCs to move faster
if(T.woken>0&&get_dist(T,M)>5&&T&&M)//if T's woken is higher than 0 and the distance between T and M is 5 or more and T exits and M exists
step_rand(T)//Take a Random step
T.woken-=1//Subract 1 from T's woken
else if(get_dist(T,M)<6&&T&&M)//else if the distance between T is lower than 6(meaning 5 or less) and T exists and M exists
step_towards(T,M)//take a step towards M
if(get_dist(T,M)<=1)//if the distance is 1 or less
T.dir=get_dir(T,M)//Makes it so T faces M
Attack(T)//Calls the attack proc
What I wanted this to do was to make it so that zombies only attack players and not all mobs. But right now they are attacking each other as well and I want to adjust it to where they only attack players. How do I do this? P.S: These zombies will attack me but they don't kill me. How do I make it so that they kill me and leave a corpse and respawn me to the defualt location? mob
player
var/life = 100
proc/HurtMe(D)
life = life - D
if(life < 0)
view() << "[src] dies!"
del src
I added this thinking maybe this is apart of it. Am I right?
Where you checks for mobs you have to make that it checks only for players.