ID:263218
 
Code:
obj
var
Strength
Swords
icon = 'Weapons.dmi'
Short_Sword
icon_state = "Short Sword"
name = "Short Sword"
Strength = 3

Broad_Sword
icon_state = "Broad Sword"
name = "Broad Sword"
Strength = 5

Venom_Blade
icon_state = "Venomous Blade"
name = "Venom Blade"
Strength = 8

Claymore
icon_state = "Claymore"
name = "Claymore"
Strength = 15

GM_Blade
icon_state = "GM Blade"
name = "GM Blade"
Strength = 100

verb/Get()
set src in oview(0)
src.Move(usr)
view() << "[usr] picks up \a [src]"

verb/Drop()
set src in usr
if (suffix == "(Equipped)")
usr << "You can not Drop this while its being used."
return
if(name=="Short Sword")
view()<<"You Drop [src]"
new/obj/Swords/Short_Sword(usr.loc)
del src
if(name=="Broad Sword")
view()<<"You Drop [src]"
new/obj/Swords/Broad_Sword(usr.loc)
del src
if(name=="Venom Blade")
view()<<"You Drop [src]"
new/obj/Swords/Venom_Blade(usr.loc)
del src
if(name=="Claymore")
view()<<"You Drop [src]"
new/obj/Swords/Claymore(usr.loc)
del src

DblClick()
if (!src.suffix)
for (var/obj/Swords/W in usr)
if (W.suffix == "(Equipped)")
usr << "You remove your [W]."
W.suffix = null
usr.WEquip = null
usr.Str -= W.Strength
usr << "You equip your [src]."
usr.Str += Strength
src.suffix = "(Equipped)"

else
usr << "You remove your [src]."
src.suffix = null


Problem description:Ok for some Reason when i unequip one of the following swords it doesnt subtracts its Defense bonus from my Def how can I fix this?

It seems like the bonuses ONLY works if you double click it...so if you use the verb, it won't work

Also, instead of creating a new item everytime you drop, just do this: src.Move(usr.loc) ... >.>

- GhostAnime

Edit: What I meant by the first paragraph/line is that you should add the bonuses in the verb rather in the DblClick()
In response to GhostAnime
Ok i still dont get what you mean by adding it in the verb.
In response to National Guardsmen
Oops, nevermind, misread a line >_<

Anyways, I only see strength bonus in the code you showed... unless Def. Bonus is also Weapon.Strength

Not to mention if you do unequip an item equipped (by clicking the equipped item, NOT an unequipped one), you forgot to add the bonus subtracter

if(!src.suffix) 
...blah blah blah
else
usr << "You remove your [src]."
src.suffix = null
//:O!!!!! No bonus remover


- GhostAnime
In response to GhostAnime
ah ok i kept misreading what you wrote earlyer i guess but it works now thanks