Code:obj
sword
get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up \a [src]"
drop()
new/obj/sword(usr.loc)
view() << "[usr] drops \a [src]"
del(src)
equip()
if(usr.weapon_equipped == 0)
usr.str += 2
usr.weapon_equipped = 1
view() << "[usr] equips a sword."
else
usr << "You are already wielding something."
unequip()
if(usr.weapon_equipped == 1)
usr.str -= 2
view() << "[usr] unequips a sword."
else
usr << "You aren't wielding this."
armor
get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up [src]"
drop()
new/obj/armor(usr.loc)
view() << "[usr] drops [src]"
del(src)
equip()
if(usr.armor_equipped == 0)
usr.def += 2
usr.armor_equipped = 1
view() << "[usr] wears some armor."
else
usr << "You are already wearing something."
unequip()
if(usr.armor_equipped == 1)
usr.def -= 2
view() << "[usr] takes off some armor."
else
usr << "You aren't wearing this."
Problem description: I compile this and it brings up "undefined proc" errors. I know I have to insert a proc for these things but I have no idea what these procs should be.
ID:145912
Nov 6 2005, 4:36 am
|
|
I think it has to do with the:
new/obj/sword(usr.loc)
i think it has to be:
new/obj/sword(locate(usr.loc))
|
Verb, the get and equip and such are verbs...
obj |
Oh for the love of...
1 - Use the <dm> tags. PUT THE CODE IN THERE! I'm sure as hell not reading that mess. 2 - Read the DM guide. It is here: http://www.byond.com/docs/guide/. There is NO EXCUSE for not knowing how to define a procedure and verb. 3 - Why in all hell does your drop verb create a new weapon in the players location and delete the old one? Why not just do this? obj/verb/Drop() 4 - Don't use boolean variables to tell you if something is equipped. Use a reference. So: obj/weapon/verb/Equip() 5 - If you use a decent equipment system, like the prototype above, you will be able to check whether something you are dropping is equipped. That is a good thing. Not to mention that then you won't be able to: A - Equip Sword A. B - Unequip Sword B C - Reequip Sword A Where A has better statistics then B 6 - Don't use magic numbers - Don't say usr.str+=2. Say usr.str+=WeapBonus, and then define a WepBonus variable for weapons. 7 - Why do you have get() and drop() written up for both swords and armour? Use inheritance, man! |
In response to Crzylme
|
|
No. You are wrong.
|
In response to Plagu3r
|
|
The problem is obvious. We don't need to be told where the errors are coming from to realise that he hasn't read the DM guide and just copied code from somewhere else that, for some unaccountable reason, left out all the 'verb' bits between objs and their verbs.
|
In response to Jp
|
|
I agree with everything you just posted...
|
Got bored, here is the code:
It would make it alot easier if you code give us the line and such.