ID:1739067
 
Code:
mob/Alien/verb/Attack(mob/client/M)
set src in oview(1)
for(var/obj/doors/D in view(1))
if(usr.Alien==1)
M.Health-=100
Health -= 100
if(M.Health<=0)
DeathCheck(M)
if(Health>=0)
DoorDeath()


Problem description: I know the code is wrong, been trying to sort this out for the last few hours now.

If a player is selected as the Alien, I want them to be able to attack certain doors, and players, but I can't get it to work.

obj/var
AlienDoor = 0 //Give the door a var to target doors you want this to work on.

mob/Alien/verb/Attack(mob/client/M)
set src in oview(1)
for(var/obj/doors/D in view(1))
if(D.AlienDoor == 1) //checks here to see if it is an Alien door meaning the var is 1 which you have to set the door to.)
if(usr.Alien==1)
M.Health-=100
Health -= 100
if(M.Health<=0)
DeathCheck(M)
if(Health>=0)
DoorDeath()


This is kind of how to do it using the code your trying to use. Haven't tested it just make sure you add the line AlienDoor = 1 for doors you want to make it work on. This might not be the best way to do it but it should work.
In response to Archfiend Master
Getting an undefined var with your D.AlienDoor line.
Well you can try removing the D. from D.AlineDoor and that might help looking at your code. But what is the problem you are getting when you use this code. Because unless I am looking at this wrong does the verb even come up when the player walks up to the door?
Put the code after the for()
In response to Agent.Penguin.Bond
I got it all situated about an hour ago now. Should of posted that, oops.

Thanks anyways!