im trying to give a worrior a shield and a sword but evry time i do this it says error duplicate defenition and previos defenicion how do i fix it pls and ty
var/obj/sword/B = new/obj/sword
var/obj/shield/B = new/obj/shield
B.loc = usr
ID:163602
Aug 14 2007, 9:31 am
|
|
Aug 14 2007, 10:19 am
|
|
you have defined the var B twice, make like one B and the other C
|
In response to Dragon-wars
|
|
tx
|
You know, programming for a while (and reading the guide) lets you learn tricks.
You demonstrated ONE way of making an item and setting it's location to something else. Believe it or not, you took the longer way: var/__path__/__var nick__ = new/__path__ __nick__.loc = __loc__ That's what you did. if __path__ is absent from new/ (and other procs like locate()), it takes the __path__ from the variable: var/__path__/__var nick__ = new is the same as var/__path__/__var nick__ = new/__path__ Now, if you look up atom.new(), it states that it's (only, unless you redefine atom.New()) argument is location.. that means we do not need to type .loc anymore! var/__path__/__var nick__ = new(__loc__) That means that the variable is now useless (and will get a warning stating it). What to do? Remove the variable: new/__path__(__loc__) So compare what you had at var/obj/shield/B = new/obj/shield B.loc = usr to new/obj/shield(usr) Which method would you want to use for future use when you are creating just objects to a certain location? ;) |