ID:177896
 
I need to make a mob that can attack enemies that get within five spaces of itself base. The mob should NOT be moving. I need it to fire projectiles. Like a defensive gun turret. That way, unless the turrets are knocked out, the team is free to roam while the turrets take out attackers. By knocked out, I mean destroyed. It should search for enemies and fire at it. However, they should be fooled by spies. I am using the vars Team and FakeTeam. They should have no need of ammunition, though.
mob/Turret
proc/Kill()
for(var/mob/M in oview(5))
if(M.FakeTeam != src.Team) //Faketeam is the person's team unless changed
M.health = -1
M.deathcheck()
spawn(10) Kill()
New()
spawn() Kill()
In response to Garthor
Thanks, Garthor. Now, my game will be more complicated for people that don't know that the best thing to do is to attack the turrets from oview(6), just outside of the turret's range.