ID:141324
 
obj/Pokeball
icon='pokeball.dmi'
verb
PickUp()
set src in oview(1)
if(usr.pokeballs>=1)
usr.pokeballs += 1
src.loc = usr
else
usr.pokeballs += 1
usr.contents3 += src
src.loc = usr
name="Pokeball x[usr.pokeballs]"
Drop()
if(usr.pokeballs==0)
usr<<"You have no pokeballs to drop"
else
if(usr.pokeballs>1)
usr.pokeballs -= 1
src.loc=usr.loc
else
usr.pokeballs -= 1
src.loc=usr.loc
usr.contents3 -= src
name="Pokeball x[usr.pokeballs]"


Thats my obj



This is my NPC
mob/Ball_Seller
icon = 'npc.dmi'
icon_state = "Pokeball Seller"
HP = "9999999999999999999999999999"
verb
Buy()
set src in oview(3)
switch(input("What do you want to buy???")in list("Pokeball - 200","Nothing"))
if("Pokeball - 200")
var/give = input("How many Pokeballs do you wish to buy?")as num
if(usr.Money >= give*200&&give>0)
usr<<"Item bought"
usr.Money -= give*200
if(usr.pokeballs>=1)
usr.pokeballs += give
else
usr.pokeballs += give
usr.contents3 += new/obj/Pokeball
else
usr<<"Not enough Money"

After usr.contents3 += new/obj/Pokeball, I need it to set the Pokeball obj name to Pokeball x[usr.pokeballs], how do I do this?
In the event that the user has no pokeballs to begin with: Create a reference to the new object as a variable within your buy verb so that you can manipulate it.

var/obj/Pokeball/P = new(usr)
usr.contents3.Add(P)
P.name = "Pokeballs x[usr.pokeballs]"


In the event they already have a /obj/Pokeball in their contents3, you'll probably want to locate it.

var/obj/Pokeball/P = locate(/obj/Pokeball) in usr.contents3
P.name = "Pokeballs x[usr.pokeballs]"


Press F1 in DreamMaker and look at the entries for "new proc" and "locate proc".
In response to Zagreus
Zagreus wrote:
var/obj/Pokeball/P = new(usr.contents3)

You don't add atom objects to a list like that - the first arg of new() for them is the location to create them in. And only atoms or null are valid locations.
In response to Kaioken
Yeah, I just woke up. :-P Edited.
Thank you guys ^.^