So what object is it? in Developer Help
|
|
Code:
mob/NPC/MerchantNPCs icon='HakumeiGetsu.dmi' icon_state="NPC" verb/Command() set src in oview(1) set name="Command" set hidden=1 var/Count=0 for(var/obj/BuyableThings/A in src.InventorySet) Count++ A.ObjectNumber=Count var/obj/C=new C=A var/StartingX=2 var/StartingY=15 StartingX+=Count if(Count>13) StartingX=3 StartingY-=1 if(Count>26) StartingX=3 StartingY-=1 if(Count>39) StartingX=3 StartingY-=1 if(Count>52) StartingX=3 StartingY-=1 C.screen_loc="[StartingX],[StartingY]" usr.client.screen+=C usr<<"Found something." var list/InventorySet=list("") obj/BuyableThings icon='wskillcards.dmi' layer=MOB_LAYER+5 var Price=100 ObjectNumber=1 Cancel icon_state="Cancel" Click() usr<<sound('click1.wav',0) for(var/obj/BuyableThings/Clothing/A in usr.client.screen) del(A) for(var/obj/BuyableThings/Weapons/A in usr.client.screen) del(A) for(var/obj/BuyableThings/Scrolls/A in usr.client.screen) del(A) del(src) Clothing
Black_Shirt icon_state="BlackShirt" Price=200 Click() usr<<sound('click1.wav',0) switch(input(usr,"The [src.name] costs [y2k_Uncondense_Num(src.Price)] Ryo. Do you want to buy it?", text) in list ("Yes","No.")) if("Yes") if(usr.Yen>=src.Price) usr<<sound('click1.wav',0);usr<<sound('Cash.wav');usr<<"You bought a [src.name]!";usr.Yen-=src.Price var/blue=0;var/red=0;var/green=0 var/obj/Clothes/Shirt/B=new();B.shirtblue=blue;B.shirtgreen=green;B.shirtred=red;B.loc=usr usr<<sound('Cash.wav') return else usr<<"Not enough money!";usr<<sound('click2.wav',0) if("No") usr<<sound('click2.wav',0) return
|
Problem description:
I really don't know how to ask it. The point basically is, I'm making a Merchant based systems thus the items you'd buy would pop up on whoever is purchasing's client.screen as objects. That way you can click them and it'd make it easier to make Merchants without all these large amounts of code.
Now I did get it to work. The problem was that I wasn't too sure about the C=A. Because everytime I canceled, which simply deleted all the objects belonging to /obj/BuyableThings/ whenever I tried to buy again it wouldn't work unless there was another NPC. I think the new created C actually are the objects in A and thus deleting them.
Um, I really don't even know if I'm asking this correctly. Could someone help?
|
Additionally, your C=A line is silly. Just get rid of that.