ID:163813
 
hi i made an npc that sells u stuff so i set the money and stuff now when i buy the item it doesnt go in my inventory cuz my game doesnt have one. Also i need help with equipting stuff in my inventory. like for example if i had a sword in my invotory i can equpt it i already i have a little code peace that looks like an inventory but doesnt work....so if someone would help me make an invotory and a be able to equpt a weapon plz do


heres the code i got for inventory


mob
player
Stat()
statpanel("Inventory",contents)

verb
look()
usr << "You see:"
for(var/O as obj|mob in oview())
usr << "\a [O]"







HERE IS THE NPC CODE


mob/npc
Food_Vender
name = "Chef"
icon = 'Banker.dmi'
Hp = 9999999999999999999999999999999999999999999999
verb
Buy()
set src in oview(3)
switch(input("What would you like to buy today??")in list("Crazy sword","Nothing"))
if("Crazy sword")
if(usr.wealth >= 350) //wealth means money
usr.wealth -= 350
var/obj/food/R = new/obj/food // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in.
R.loc = usr
else
usr<<"Not enough money!"
if("Nothing")
return
Please post the code for the npc that sells the stuff so I can help you.
In response to Spire8989
Spire8989 wrote:
Please post the code for the npc that sells the stuff so I can help you.


mob/npc
Food_Vender
name = "Chef"
icon = 'Banker.dmi'
Hp = 9999999999999999999999999999999999999999999999
verb
Buy()
set src in oview(3)
switch(input("What would you like to buy today??")in list("Crazy sword","Nothing"))
if("Crazy sword")
if(usr.wealth >= 350) //wealth means money
usr.wealth -= 350
var/obj/food/R = new/obj/food // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in.
R.loc = usr
else
usr<<"Not enough money!"
if("Nothing")
return
In response to Agrey123
mob/npc
Food_Vender
name = "Chef"
icon = 'Banker.dmi'
Hp = 9999999999999999999999999999999999999999999999
verb
Buy()
set src in oview(3)
switch(input("What would you like to buy today??")in list("Crazy sword","Nothing"))
if("Crazy sword")
if(usr.wealth >= 350) //wealth means money
usr.wealth -= 350
var/obj/food/R = new/obj/food // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in.
R.loc = usr.contents//add contents and see if it works
else
usr<<"Not enough money!"
if("Nothing")
return

If not try this:
var/obj/food/R = new/obj/food(usr) // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in. 
R.loc = usr
In response to DadGun
DadGun wrote:
> mob/npc
> Food_Vender
> name = "Chef"
> icon = 'Banker.dmi'
> Hp = 9999999999999999999999999999999999999999999999
> verb
> Buy()
> set src in oview(3)
> switch(input("What would you like to buy today??")in list("Crazy sword","Nothing"))
> if("Crazy sword")
> if(usr.wealth >= 350) //wealth means money
> usr.wealth -= 350
> var/obj/food/R = new/obj/food // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in.
> R.loc = usr.contents//add contents and see if it works
> else
> usr<<"Not enough money!"
> if("Nothing")
> return
>

If not try this:
> var/obj/food/R = new/obj/food(usr) // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in. 
> R.loc = usr
>



nop none of this work its cuz i dont even have an inventory as in i dont have one at all i dont got a category called inventory if it had somewhere to go then it would be there
In response to Agrey123
Then make one:
mob/Stat()
statpanel("Inventory")
stat(usr.contents)

In response to DadGun
DadGun wrote:
Then make one:
> mob/Stat()
> statpanel("Inventory")
> stat(usr.contents)
>





yo but my stats are using the proc Stat() so i wana keep the tab i already have it says all the detail how do i creat my own one
In response to Agrey123
mob/npc
Food_Vender
name = "Chef"
icon = 'Banker.dmi'
Hp = 9999999999999999999999999999999999999999999999
verb
Buy()
set src in oview(3)
switch(input("What would you like to buy today??")in list("Crazy sword","Nothing"))
if("Crazy sword")
if(usr.wealth >= 350) //wealth means money
usr.wealth -= 350
new /obj/food(usr) // this is my problem i want it to go in my inventory but i dont got one and it doesnt go in.
// R.loc = usr.contents//add contents and see if it works
else
usr<<"Not enough money!"
if("Nothing")
return


That should do it.

- Miran94