ID:179667
Nov 23 2001, 11:28 am
|
|
How would I start off a character with an object?
|
In response to GateGuardian
|
|
mob
character New() ..() var/obj/item/weapon/greatsword/g = new(src.contents) I put it in like you said and I get the following errors characters.dm:15:error:src.contents:bad var characters.dm:15:new :warning: This appears like the old syntax for new(). The type is now passed like this: new Type(args). You can leave out the type if assigning a variable of the same type. characters.dm:15:error:= :expected a constant expression |
In response to Evilkevkev
|
|
You're indentation is wrong.
Oh, and unless you intend to fiddle with the items once they're created (such as equiping them), you'll want to use: new/obj/item(src.contents) |
In response to GateGuardian
|
|
I actually want them to be equiped when the character is created but for now i'll stick with this. Later on in the game items might be unequiped and switched for other weapons so i'll keep it this way.
New() ..() var/obj/item/weapon/greatsword/g = new(src.contents) I get a warning now saying that G is defined but not used. |
In response to Evilkevkev
|
|
Well, read what the error says! You defined the variable "G", but you're not using it. That's why I said if you're not going to use it, then you need to use the other line to create it, or else you'll get the error.
|
In response to GateGuardian
|
|
Oh, i misunderstood you the first time. Thanks for clearing that up. :)
|
In response to Evilkevkev
|
|
GRR! I MUST be dumb, but either I can't get the contents of usr to be displayed, or the greatsword didn't get put into src.contents. Here's the code in case I did something wrong:
New() ..() new/obj/item/weapon/greatsword(src.contents) verb show_contents() for (var/obj/O in src.contents) world << O.name //displays the name of O world << "Done" |
In response to Evilkevkev
|
|
I can't tell if it's something that's missing or just your indentation getting all messed up.
|
In response to GateGuardian
|
|
I've checked the indentation several times, redoing it each time and it seems fine... *beats code with a bat* anything?
|
New()
..()
var/obj/item/I = new(src.contents)
When your mob is created, it runs the new proc which creates the item in src.contents.