Items
Dagger
name = "Dagger" //Give it a name of Sword.
icon = 'weapons.dmi' //The icon of the object(what it will look like)
icon_state = "Dagger" //The icon state of the object
text = "<font bgcolor=maroom>P"
suffix="Weapon"
cost=20
power=5
Description="A small dagger with an attack value of 5."
Click()
if(src in view(1))
var/Items/Dagger = locate(/Items/Dagger) in usr.contents
if(Dagger)
if(src.equipped==0)
if(usr.canshop==0)
if(usr.WeaponSlotUsed==0)
src.suffix="Weapon (Equipped)"
usr<<"You equip the [src.name]!"
usr.strength+=src.power
src.equipped=1
usr.WeaponSlotUsed=1
else
usr<<"You already have a weapon/tool equipped!"
else
usr << "[src.Description]"
switch(alert("Do you want to sell your weapon?",,"Yes","No"))
if("Yes")
usr.crowns+=src.cost
del(src)
usr << "You sell [src.name]."
return
if("No")
return
else
src.suffix="Weapon"
usr<<"You unequip the [src.name]!"
usr.strength-=src.power
src.equipped=0
usr.WeaponSlotUsed=0
This is my current Dagger code. The statpanel forshopping code, is here:
mob
Stat()
for(var/mob/I in oview(3))
if(I in oview(1))
if(I.isplayer==0)
statpanel("Shop")
// stat("[I.Description]")
stat(I.contents)
canshop=1
else
canshop=0
When you come within one space of the Weapons Guy, it'll bring up a shop statpanel and it will display the weapon. The only problem is, is purchasing that weapon. Currently, if you click on your weapon in your inventory when next to the Weapons Guy, it'll display the description for that item. How would I make it check to see if it is in the shopkeepers inventory, and if so, then display a different message like "Click twice to buy!" or something along those lines.
Would it be easier to simply make another object to put in the Weapons Guy's inventory that is specifically coded for shops, or just to modify my current weapons?
Please help,
Michael