How would I get them to attack 1 enemy in contact with them, with the highest Health, when they came into contact with enemies?
I have a basic Attack proc here, but it is probably messed up :
mob/proc/Attack()
var/list/L = new
var/mob/K=locate() in oview(1,src)
if(K)
for(K in oview(1,src))
L+=K
var/mob/M = pick(L)
if(M.colour != src.colour)
var/damage = src.Attack - M.Defence
if(damage<=1)
M.Health -= 1
damage = 1
else
M.Health -= damage
view(6,src)<<"[src] attack [M] for [damage] damage!"
var/damage2 = M.Attack - src.Defence
if(damage2<=1)
M.Health -= 1
damage2 = 1
else
M.Health -= damage2
view(6,src)<<"[M] attack [src] for [damage2] damage!"
Death()
Death()
mob/proc/Death()
if(src.Health <= 0)
if(!src.client)
view(6,src)<<"[src] has been killed!"
(src.player)<<"You have lost [src]!"
del(src)
else
src<<"You have been defeated!"
src<<"All your building are now destroyed!"
src<<"And all your men lay dead!"
for(var/mob/M in world)
if(M.player == src.name)
spawn()
del(M)
for(var/obj/O in world)
if(O.name != "Town Center")
if(O.player == src.name)
spawn()
del(O)
world<<"[src] has been defeated!"
alert("Please Wait!")
sleep(170)
src.Health = 1000
src.MaxHealth = 1000
src.Attack = 25
src.Defence = 25
src.Mesatta = 1500
src.Wood = 1200
src.Player = 1
world<<"[src] has started again!"
src<<"<B>You are back</B>!"
To explain the colour bit, each person has a colour, which is their team, so enemies will always have a different colour.
If you need any more code just say!
Thank you!
~Ease~
~Ease~
<font size = -3>Everything is at ease with Ease</font>