ID:178438
 
I need to create a new object based on another object.

I.e.

obj Thinger icon = 'thing.dmi' mob var/obj/weapon mob Login() weapon = new /obj/Thinger mob Throw_Thing(var/mob/M as mob in oview(1)) var/obj/A A = new src.weapon

I think you can see what I'm getting at. I get an error in-game when I use the Throw_Thing() verb stating that it can't create the object.

A = src.weapon

If I do this, then the weapon is lost at the del() at the end of the verb (not included).

Here's the exact error, if it helps:

runtime error: Cannot create objects of type /obj/Thinger. proc name: Throw_Thing (/mob/proc/Throw_Thing) usr: Malver (/mob) src: Malver (/mob) call stack:

Halp. :)

Malver wrote:
I need to create a new object based on another object.

I.e.

<code> > obj > Thinger > icon = 'thing.dmi' > > mob > var/obj/weapon > mob > Login() > weapon = new /obj/Thinger(usr) // (usr) puts it in the persons inventory, i think thats what your doing > > Halp. :) Engrish? > >
In response to Sariat
Sariat wrote:
Engrish?

You need to stop harping on that. I brought it up at first as a comment on how your BYONDcodeclient page was syntactically incomprehensible. Just saying "Engrish" in response to every single post you see, however, is pointless.

Lummox JR
Malver wrote:
I need to create a new object based on another object.

I.e.

mob
var/obj/weapon
mob
Login()
weapon = new /obj/Thinger

mob
Throw_Thing(var/mob/M as mob in oview(1))
var/obj/A
A = new src.weapon

I think you can see what I'm getting at. I get an error in-game when I use the Throw_Thing() verb stating that it can't create the object.

Well the multiple mob statements are redundant; you can get rid of those and just leave everything indented.
One place I'm confused at the outset here is why you don't specify a location for the player's weapon when they log in--I think you should set weapon = new /obj/Thinger(src), there, so the weapon is created in the player's inventory--unless you have some reason not to do that.

For Throw_Thing() I'm having trouble following just what you're trying to do. The line A = new src.weapon won't work, because src.weapon is not a type path but an actual object; you'd need new src.weapon.type, and you'd need to actually put the obj somewhere (give it a location).

If I do this, then the weapon is lost at the del() at the end of the verb (not included).

Are you referring to the implied deletion at the end of the proc when an object is no longer in use, or did you just leave out part of the verb? I think you'll need to show us the whole verb if we're to understand it. The src.weapon reference should still point to a valid obj unless you use an explicit del() instruction, so if you're leaving that part out, don't.

Here's the exact error, if it helps:

runtime error: Cannot create objects of type /obj/Thinger.
proc name: Throw_Thing (/mob/proc/Throw_Thing)
usr: Malver (/mob)
src: Malver (/mob)
call stack:

That's probably caused by the A = new src.weapon line I mentioned above. Since src.weapon is not equal to /obj/Thinger, but is an obj of that type, you should have put src.weapon.type. Actually I'm guessing the line you really want is this:
A = new usr.weapon.type(usr.loc)

I put in usr, since it's within a verb.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Malver wrote:
I need to create a new object based on another object.

I.e.

mob
var/obj/weapon
mob
Login()
weapon = new /obj/Thinger

mob
Throw_Thing(var/mob/M as mob in oview(1))
var/obj/A
A = new src.weapon

I think you can see what I'm getting at. I get an error in-game when I use the Throw_Thing() verb stating that it can't create the object.

Well the multiple mob statements are redundant; you can get rid of those and just leave everything indented.
One place I'm confused at the outset here is why you don't specify a location for the player's weapon when they log in--I think you should set weapon = new /obj/Thinger(src), there, so the weapon is created in the player's inventory--unless you have some reason not to do that.

For Throw_Thing() I'm having trouble following just what you're trying to do. The line A = new src.weapon won't work, because src.weapon is not a type path but an actual object; you'd need new src.weapon.type, and you'd need to actually put the obj somewhere (give it a location).

If I do this, then the weapon is lost at the del() at the end of the verb (not included).

Are you referring to the implied deletion at the end of the proc when an object is no longer in use, or did you just leave out part of the verb? I think you'll need to show us the whole verb if we're to understand it. The src.weapon reference should still point to a valid obj unless you use an explicit del() instruction, so if you're leaving that part out, don't.

Here's the exact error, if it helps:

runtime error: Cannot create objects of type /obj/Thinger.
proc name: Throw_Thing (/mob/proc/Throw_Thing)
usr: Malver (/mob)
src: Malver (/mob)
call stack:

That's probably caused by the A = new src.weapon line I mentioned above. Since src.weapon is not equal to /obj/Thinger, but is an obj of that type, you should have put src.weapon.type. Actually I'm guessing the line you really want is this:
A = new usr.weapon.type(usr.loc)

I put in usr, since it's within a verb.

Lummox JR

Ah, that's how it is done.

Thankyou. :)
In response to Lummox JR
Lummox JR wrote:
Sariat wrote:
Engrish?

You need to stop harping on that. I brought it up at first as a comment on how your BYONDcodeclient page was syntactically incomprehensible. Just saying "Engrish" in response to every single post you see, however, is pointless.

Lummox JR

I need to?