obj/items
Double_Blade
name = "Double Blader"
icon = 'Equips.dmi'
icon_state = "db1"
verb
Get()
set src in oview(1,usr)
set category=null
if(src.Move(usr)){usr<<"<b>You picked up the [src.name].</b>"; src.suffix = " Un-Equipped"}
Drop()
set src in usr.contents
set category=null
if(src.Move(usr.loc)){usr<<"<b>You dropped the [src.name].</b>"}
Equip()
set src in usr.contents
set category=null
if(usr.weqalready==1){usr<<"You already have a weapon equipped."}
else if(usr.class!="Samurai"){usr<<"Only a samurai can equip a [src.name]."}
else if(src.suffix==" Equipped"){usr << "<font color = teal>The [src.name] is already equipped."}
else
src.suffix = " Equipped"
usr.weapon+=5
usr.weqalready=1
Unequip()
set category = null
set src in usr
if(src.suffix!=" Equipped"){usr << "<font color = teal>The [src.name] is not equipped."}
else
src.suffix = " Un-Equipped"
usr.weapon -=5
usr.weqalready=0
And this is my weapon dealer code.
mob/NPC
Weapon_Crafter_1
icon = 'Mobs.dmi'
icon_state = "merchant"
char_name = "Metal Crafter"
name = "Metal Crafter"
pvp = "Non-Active"
safe=1
Age = 23
Str = 50
Def = 3
Agl = 7
Spd = 1
HP = 10
PP = 4196
class = "Metal Crafter"
Click(src in oview(3))
switch(input("Metal Crafter: Would you like buy or sell?","Metal Crafter", text) in list ("Buy","Sell"))
if ("Buy")
switch(input("Weapon Crafter: What would you like to buy?","Metal Crafter", text) in list ("Samurai's Double Blader.....150y","Toshai's Spear.....200y","Ninja's Nunchuk.....140y"))
if ("Samurai's Double Blader.....150y")
if(usr.yen<=149){alert("Metal Crafter: You do not have enough yen")}
else if(usr.class!="Samurai"){usr<<"Metal Crafter: You must be a samurai to puchase this weapon"}
else
usr.contents +=(new/obj/items/Double_Blade)
for (var/obj/items/Double_Blade/O in usr.contents)
O.suffix = " Un-Equipped"
usr.yen-=1
usr<<"<font color=aqua>Metal Crafter: Thank you, Come again."
if("Ninja's Nunchuk.....140y")
if(usr.yen<=139){alert("Metal Crafter: You do not have enough yen")}
else if(usr.class!="Ninja"){usr<<"Metal Crafter: You must be a ninja to puchase these weapons"}
else
usr.contents.Add(new/obj/items/Nunchuk)
for (var/obj/items/Nunchuk/O in usr.contents)
O.suffix = " Un-Equipped"
usr.yen-=140
usr<<"<font color=aqua>Metal Crafter: Thank you, Come again."
if("Toshai's Spear.....200y")
if(usr.yen<=139){alert("Metal Crafter: You do not have enough yen")}
else if(usr.class!="Toshai"){usr<<"Metal Crafter: You must be a toshai to puchase this weapon"}
else
usr.contents.Add(new/obj/items/Spear)
for (var/obj/items/Spear/O in usr.contents)
O.suffix = " Un-Equipped"
usr.yen-=200
usr<<"<font color=aqua>Metal Crafter: Thank you, Come again."
The only problem is that the drop verb does not work when you buy the weapon. It works perfectly when you pick up the weapon.
Furthermore, your equipment system is a mess, from what I can see from the verb.
1 - Do not use a==1 and a==0 for boolean variables (Variables that are either on or off, that indicate something. Say, isflying). Use if(a) and if(!a). That way, if a is something unexpected, it should be handled appropriately. (if(!a) == if(a==null || a=="" || a==0))
2 - Don't use boolean variables for equipment. Give the player a variable, say, equippedwep, and then set that to the object being equipped. For example:
3 - Put a space between new and the type path. Otherwise, it's just unreadable. Most of that code is, though.
4 - By 'not work' what exactly do you mean? Does the verb not appear? Do you click it and nothing happens? Do you get any error messages? Throw a few debug messages into that code, and see what happens.