ID:262316
 
            Head
icon_state = "Head"
New()
if(src)
spawn(1) src.Make_Beam()
return
proc
Make_Beam()
if(src)
spawn(5) goto PART_1
return
PART_1
spawn(3) var/BODY = new/obj/Beams/Kamehameha/Body(src.loc)
BODY:dir = src.dir
spawn(1) goto PART_1
return

BODY:dir = src.dir < On that line it is telling me
ERROR: BODY/:/dir undifined var

I dont know why! dir is a build in var...
Use '.' instead of ':'.
In response to Mega fart cannon
Mega fart cannon wrote:
Use '.' instead of ':'.

That would give him compile errors because BODY is a var and not an atom.

To ITG Master:

I take it this loops until the object is deleted? If not, you will have an infinite loop. Based on what you have shown, this is how it can be properly done.

Head
icon_state="Head"
New()
..()
spawn(1)src.Make_Beam()
proc
Make_Beam()
spawn(8)
var/obj/BODY=new /obj/Beams/Kamehameha/Body
BODY.dir=src.dir
BODY.loc=src.loc
src.Make_Beam()


If src is not moving anywhere, it will just create more and more BODY objects in the same location. Just so you know.


In response to Aaiko
Aaiko wrote:
Mega fart cannon wrote:
Use '.' instead of ':'.

That would give him compile errors because BODY is a var and not an atom.

That does not make it okay to use it when simply properly type casting the variable will solve it and allow use of the safer (and proper) period. Unless your very careful all using a colon does is leave you with runtime errors instead of compile errors.
In response to Aaiko
Aaiko wrote:
Mega fart cannon wrote:
Use '.' instead of ':'.

That would give him compile errors because BODY is a var and not an atom.

Precisely. Those compiler errors can tell him what needs to be fixed, rather than waiting for a potential runtime error. "Undefined var" usually means you've failed to tell DM that a var should be a particular type.

And you made a pretty serious mistake in your replacement code.

Wrong:
var/obj/BODY=new /obj/Beams/Kamehameha/Body

BODY.dir=src.dir
BODY.loc=src.loc</dm>

This is wrong because you've given the BODY object too general a type when clearly you want it to be a more specific type. Also, you haven't properly initialized the object by including its location in new(), let alone sent it more data so it can initialize itself.

Right:
var/obj/Beams/Kamehameha/Body/body = new(src.loc, src)


Setting body's dir should be done in New() instead, so src is included in a second argument. The location will be set to src.loc just by making that the first argument to new(), which is automatic for all atoms. This way you can also set its owner, another must for any weapon/projectile/beam system.

Lummox JR