ID:145912
 
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.

How about editing your post and actually putting the code in the DM tags. Then get the line and any other compilation errors given.

Got bored, here is the 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."


It would make it alot easier if you code give us the line and such.
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
sword
verb
get()
//ect. ect. ect.
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()
set src in usr
loc=usr.loc


4 - Don't use boolean variables to tell you if something is equipped. Use a reference. So:

obj/weapon/verb/Equip()
set src in usr
usr.WeaponEquipped=src


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...