ID:149053
 
ok, i have an EQ problem... it keeps taking away the character stats instead of adding them, heres my code:

obj
var
equiped

obj
equipment
knife
icon = 'equipment.dmi'
icon_state = "knife un equiped"
density = 0
verb
Equip()
if(equiped==0)
usr<<"You equip knife!"
icon = 'equipment.dmi'
icon_state = "knife equiped"
usr.str += 5
usr.damage += 2
equiped = 1
else
usr<<"You can't do that!"
Un_equip()
if(equiped==1)
usr<<"You un equip knife!"
icon = 'equipment.dmi'
icon_state = "knife un equiped"
usr.str -= 5
usr.damage -= 2
usr.str -= 2
equiped = 0
else
usr<<"You can't do that!"
Drop()
if(equiped==0)
new/obj/equipment/knife(usr.loc)
view() << "[usr] drops \a [src]"
del(src)
else
usr<<"You can't do that!"
Get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up \a [src]"
equiped = 0


plz help if you can, thank you!
It should be usr.equiped, the way you had it, it was pointing to the object not the user of the verb.

Also, please put <DM> and </DM> tags around your code snippets in the future.
In response to Nadrew
the usr.equip doesn't wok, gave me these errors:

loading UFF.dme
Equipment.dm:13:error:usr.equiped:undefined var
Equipment.dm:19:error:usr.equiped:undefined var
Equipment.dm:23:error:usr.equiped:undefined var
Equipment.dm:30:error:usr.equiped:undefined var
Equipment.dm:34:error:usr.equiped:undefined var
Equipment.dm:44:error:usr.equiped:undefined var

UFF.dmb - 6 errors, 0 warnings (double-click on an error to jump to it)


and whats
 and
tags?
In response to Redslash
Ugh, I didn't see that you had the var set to the object, your first one was correct, the code looks like a mess. You could look over my weapon system for some help.


<DM> and </DM> are tags that make code look better on the forum, it's like the PRE tag but better.
In response to Nadrew
so, where should i put these tags?
In response to Redslash
Around your code snippets, <DM> before and </DM> after.
In response to Nadrew
i got rid of them, snip time...
PLZ kill me.... i found the prob, i had usr.str twice, instead of usr.damage... (kills himself because hes stupid)