ID:147396
 
I decided to rewrite Infantry Wars's shooting code so that it's much simpler (without any special procs.) However, I'm stuck on the turrets.

I get the following errors:

TURRET.DM:9:error:src.loc:undefined var
TURRET.DM:10:error:src.dir:undefined var
TURRET.DM:11:error:walk :undefined proc

when I use this section of code:

mob/Turret
icon = 'turret.dmi'
density = 1
Team = "Collective"
proc/Kill()
for(var/mob/M in oview(5))
if(M.FakeTeam != src.Team) //Faketeam is the person's team unless changed
M << "You are trespassing!"
var/obj/projectile/cannon/O = new /obj/projectile/cannon(src.loc)
O.dir = src.dir
walk(O,src.dir)
spawn(10) Kill()
New()
spawn() Kill()


I am unsure what the reason may be.

[edit] I fixed it, it was that some indents were spaces and some tabs.
Well, you have it indented wrong. After M<< you shouldn't need more indents.


mob/Turret
icon = 'turret.dmi'
density = 1
Team = "Collective"
proc/Kill()
for(var/mob/M in oview(5))
if(M.FakeTeam != src.Team) //Faketeam is the person's team unless changed
M << "You are trespassing!"

var/obj/projectile/cannon/O = new /obj/projectile/cannon(locate(src.x,src.y,src.z))

O.dir = src.dir

walk(O,src.dir)
spawn(10) Kill()
New()
spawn() Kill()