ID:262765
 
Code:
    proc
Beam(mob/M)
var/obj/Head = new/obj/Beams/Head()
if(usr.dir == NORTH)
Head.loc = locate(usr.x,usr.y+1,usr.z)
if(usr.dir == SOUTH)
Head.loc = locate(usr.x,usr.y-1,usr.z)
if(usr.dir == WEST)
Head.loc = locate(usr.x-1,usr.y,usr.z)
if(usr.dir == EAST)
Head.loc = locate(usr.x+1,usr.y,usr.z)
Head.total = 15
Head.dir = usr.dir
Head.owner = usr
M.powerlevel -= usr.powerlevel
M.Death()


Problem description:
When i run my game and test the beam system it works but red text errors appear.(shown below)
runtime error: Cannot read null.powerlevel
proc name: Beam (/mob/proc/Beam)
source file: Beam.dm,116
usr: Fire Dynasty (/mob/Saiyan)
src: Fire Dynasty (/mob/Saiyan)
call stack:
Fire Dynasty (/mob/Saiyan): Beam(null)
Fire Dynasty (/mob/Saiyan): Fire()

Its a non homing beam system and i want it to damage people that get in the beams way.
Thanks


You need to set an owner to the beam. Because right now it has no clue who M is.
In response to Mysame
i their is more code that says who is owner etc.but the error when i play the game appears in the "M.powerlevel -= usr.powerlevel"
That is not a very good system, at least efficient-wise.
You should be using get_step() to place it and you can't put usr in a proc like that.
    proc
Beam(mob/M)
var/obj/Head = new(locate(get_step(src,src.dir)))
Head.total=15
Head.dir=src.dir
Head.owner=src
M.powerlevel-=src.powerlevel
M.Death()
In response to Fire Dynasty
well the beam is fine it goes in a straight line etc,but when i use it red error text appears....and the error lien is where "M.powerlevel -= usr.powerlevel"
the beam is not ment dor a designated target just kills objects/people in its way
In response to Fire Dynasty
Call the proc like this
M.beam(usr)


If that doesn't work, use
usr.beam(M)


Though, I think the first one will work.
In response to Mysame
No put usr in proc. Ungh.
In response to CaptFalcon33035
huh
In response to Mysame
Please. If you are going to give advice, make it good. Right now, you are only going to be causing problems for the author of this thread, and future readers who have a similar problem.
You need to stop using that awful beam demo by SSJ Radditz. It's been the cause of more frustration than you'll ever know. He did not, and to my knowledge still doesn't, know enough about programming to go writing a demo in the first place. As you see, or will later once you're more accustomed to seeing good code, this demo is filled with usr abuse and sundry problems like those goofy locate() statements instead of get_step().

Lummox JR
In response to Lummox JR
yeah i figured, i made a new one my self and seems to be going fine :)
thanks for the help everyone
page me if you byond member becuz i cant.. anyway when your game will be on? i want to test. i can help with codding problems too