ID:140809
 
Code:
    equips
clothing
cape
icon = 'Objects.dmi'
icon_state= "cape"
verb/get()
set src in oview(1)
src.loc = usr
verb/drop()
if (usr.equippedb == 1)
usr << "You must take it off before you can drop it"
else
src.loc = usr.loc
verb/equip()
if (usr.equippedb == 1)
usr << "You already have something equipped there!"
else
suffix = "~Equipped~"
usr.equippedb = 1
verb/unequipped()
if (usr.equippedb ==1)
usr << "You take off the object!"
suffix = ""
usr.equippedb = 0


Problem description:

Okay I have now figured out how to make my items equipped even have other usr.equipped now I'm running into issues

First thing I need help with.

How would I give abilities to items I equip like say I wanted to make that cape turn me invisible, how would I go about doing so

Second thing

I'm having trouble cloaking verbs like Unequip to only be while its equipped and vise versa for verbs i only want to show up?

Thanks ^^


You should list the equip, unequip, get, drop, etc verbs under /equips/clothing so that all other subtypes of /equips/clothing will have these verbs, whether it be capes, shirts, pants, etc. Then, after that, you could define equips/clothing/cape like so:
obj/equips
clothing
verb/pickup()
// add to contents etc
verb/drop()
// make it fall down
verb/equip()
// do equip stuff
verb/uequip()
// blah blah blah

inivisbilitycape

equip() // When equip() for invisibilitycape is called:
usr.invisibility = 1
..() // This calls obj/equips/clothing/equip(), does all of the equipping stuff.

supercape
equip()
usr.powerlevel += 9000000000
..()

In response to Metamorphman
Metamorphman wrote:
You should list the equip, unequip, get, drop, etc verbs under /equips/clothing so that all other subtypes of /equips/clothing will have these verbs, whether it be capes, shirts, pants, etc. Then, after that, you could define equips/clothing/cape like so:
obj/equips
> clothing
> verb/pickup()
> // add to contents etc
> verb/drop()
> // make it fall down
> verb/equip()
> // do equip stuff
> verb/uequip()
> // blah blah blah
>
> inivisbilitycape
>
> equip() // When equip() for invisibilitycape is called:
> usr.invisibility = 1
> ..() // This calls obj/equips/clothing/equip(), does all of the equipping stuff.
>
> supercape
> equip()
> usr.powerlevel += 9000000000
> ..()


I see that does look more organized o.o now how would I cloak the verbs so they only show up when I need them to also I'm guessing I would just call it as a verb if i wanted to call it instead of the effect just happening when I equip it?
In response to Metamorphman
In this case, you would need to be designing the verbs properly to override them like that. Otherwise, there will be an effect regardless of whether or not the equipping was successful. So, equip() will need to return a value indicating whether the item has been equipped or not, like so:

mob
var/obj/item/equipment/back

obj/item
verb
get()
set src in oview(1)
return Move(usr)
drop()
return Move(usr.loc)
equipment
var/slot = ""
verb
equip()
if(usr.vars.Find(slot))
if(usr.vars[slot] != src)
usr.vars[slot] = src
return 1
return 0
unequip()
if(usr.vars.Find(slot))
if(usr.vars[slot] == src)
usr.vars[slot] = null
return 1
return 0

//don't let us drop equipped items
Exit()
if(ismob(loc))
if(loc.vars.Find(slot))
if(loc.vars[slot] == src)
return 0
return ..()

invisibility_cape
slot = "back"
equip()
//try to equip, and store the result in .
. = ..()
if(.)
//make usr invisible if we succeeded
usr.invisibility += 1
unequip()
. = ..()
if(.)
usr.invisibility -= 1
In response to DeathBane
As for the abilities just happening when you click a verb, you could add a new verb called 'ability()' to the items you want and apply the ability changes in that verb.

As for verbs appearing when you need them: http://www.byond.com/docs/guide/chap04.html go down to the part called "Verb Accessibility" and read up.
In response to Garthor

I see now I could define this as the other guy above so I wouldn't have to do this to every equip too well by looking at yours, it does that too so I guess I understand now Thanks ^^


and yea I figured I could do that to it I got the abilities to work because of that thanks for the help everyone ^^