ID:262829
 
Code:
mob
proc
BDMG()
var/M = for(var/mob/M in view())
usr.powerlevel -= M.powerlevel
M.Death()


Problem description:Trying to define M so i can use it in my beam code...
Please help these are the errors:
Damage.dm:16:error:var/mob/M:undefined var
Damage.dm:16:error:for:undefined proc
Damage.dm:17:error:M.powerlevel:undefined var
Damage.dm:18:error:M.Death:undefined proc
Damage.dm:16:M :warning: variable defined but not used



I don't think you can define a variable as a for loop.

What exactly is the beam supposed to do? Hurt everyone in view? Let you select the person to shoot? A little more info helps. But this line..

var/M=for(var/mob/M in view())


Appears to be your problem. Also, you shouldn't put usr in a proc, you should use src.
usr.powerlevel-=M.powerlevel//usr should be src

On another note.. Did you mean for the person who uses the blast to have his powerlevel subtracted by the powerlevel of the person getting hit by the blast, and then to kill the person getting hit by the blast? =/ Kind of a funny system.
That will never work. That sucks. You have to place the math equations within loop. You won't set a variable to a loop because it is completely useless. Also, I'm betting that you want to damage to mobs within the users view, so use M.powerlevel-=usr.powerlevel It's only logical seeing as you are checking the mob's death.
mob/proc/BDMG()
for(var/mob/M in view())
M.powerlevel-=usr.powerlevel
M.Death()

Of coarsde you might want to send arguments to Death() such as the killer and you make way to use max() and round() to be sure that the user doesn't end up with negative numbers or numbers with decimals.
In response to CaptFalcon33035
Capt, you forgot to mention the USR in the proc. Come on, man. Keep up. ;)
[Edit] And you duplicated it without fixing it.. o.o [/Edit]
In response to Detnom
ive got it figured, thanks for the info.
In response to Detnom
I had no clue. =D

I wasn't really looking out for it. It's a habit of mine, I use src whenever possible, and now I have just been overlooking usr misplacements.
In response to CaptFalcon33035
Haha, it's all good, I was just pokin' fun anyway. =)