ID:165297
 
now that you answered my inventory questions so that now i can wield, eat, examine... now i am wondering how to unwield. i read a few ByondBwicki pages but they weren't really what i was after, can you tell me?
You have to be more specific..How is the item equipped in the first place? Basically uneqipping should be the exact opposite of equipping in general..
In response to Mecha Destroyer JD
obj
weapons
verb
Pick_up()
set src in oview(0)
if(Move(usr))
usr<<"You pick up <b>[src]</b>."
usr.contents+=src
src.name="wield"
src.suffix="[name]"
Click()
if(src in usr.contents)
usr.overlays+=image(icon,"small")
usr<<"You wield [src]."
usr.armorresistance+=src.armor
del(src)

When you Click() a weapon in your inventory, you wield it. Basically, how can i make it so that when you click an equipped item it unequipped?
In response to Adam753
Easy:
        Click()
if(src in usr.contents)
if(!usr.weaponequip)//if the weapon is not equipped, equip it
usr.overlays+=image(icon,"small")
usr<<"You wield [src]."
usr.armorresistance+=src.armor
else//if the weapon is equipped, unequip it
usr.overlays-=image(icon,"small")
usr<<"You unwield [src]."
usr.armorresistance-=src.armor


Why did you delete the weapon as soon as you wielded it anyways(you wouldn't be able to unequip it or do anythign else to it)? 0_0 BUt yeah, you'd basicalluy want to make a variable that tells whether or not thei tem is equipped. You can either put the var on the weapon or the player(I'd do player so you can't equip more than a certain amount of weapons); your choice. Then, under the unequip part you'd want to run the processes that would take off the image(not completely sure that -= removes images). Lastly, you'd want to take back the armor resistance you added so that they wouldn't ave the defense of the armor without actually wearing it.
In response to Mecha Destroyer JD
duh! why the heck didn't i think of that? thanks.
In response to Adam753
Heh no prob. We all ahve our moments. :D
In response to Mecha Destroyer JD
The if(src.weaponequip) part is very wrong. No such var should belong to an obj; instead it should be mob.weapon, pointing to the weapon itself or null if one is not in use.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The if(src.weaponequip) part is very wrong. No such var should belong to an obj; instead it should be mob.weapon, pointing to the weapon itself or null if one is not in use.

Lummox JR

Thats why I said, I'd do the var for a player. I don't know why someone would put the var on the weapon btu it can be done that way for osme odd reason..OH, I see I forgot to change src back to usr..Was gonna put the way you stated as src.equip but did weaponequip for the player instead..
In response to Mecha Destroyer JD
Mecha Destroyer JD wrote:
Thats why I said, I'd do the var for a player. I don't know why someone would put the var on the weapon btu it can be done that way for osme odd reason..OH, I see I forgot to change src back to usr..Was gonna put the way you stated as src.equip but did weaponequip for the player instead..

But you treated it as a true/false value, not a reference to an actual object. To tell if that particular object is equipped, you need to check if that var matches src.

Lummox JR