ID:177130
 
mob
fisherman
icon='boy.dmi'
density=1
verb/Sell_fish()
if(usr.fish > 1)
set src in oview(1)
alert ("Thanks, here ill give you [usr.fish] for that one, but less for the next fish")
usr.contents-=new/obj/Fish
usr.money+=usr.fish
usr.fish-=1
else
usr<<"you got no fish!"



i want to get it to delete the obj fish out of the inventory when you sell the fish,



its for a fishing guy if you havent guest, you sell him the fish and then you loose a fish from your inventory. as the code should do
The basic concept here is that we need to find a fish that someone has. locate() can be used for that.
mob
fisherman
icon='boy.dmi'
density=1
verb/Sell_fish()
set src in oview(1)
if(usr.fish >= 1)
alert ("Thanks, here I'll give you [usr.fish] for that one, but less for the next fish.")
usr.money+=usr.fish
usr.fish-=1
//Here we find a fish in the contents and delete it
var/obj/fish/F = locate() in usr
del F
else
usr<<"You don'thave any fish to sell!"
In response to tenkuu
im getting unknown type F and unknown variable type, i have no clue
In response to SkylineR34
That is because you copied and pasted the code. BYOND is case sensitive. If you can't figure it out, too bad.
In response to Garthor
ok, i didnt copy paste. i just wrote it down the way he said to. i know byond is very sensative so i followed down every bit of it correctly. if he said thats the way then why would i change anything about it!
In response to SkylineR34
Because people can be wrong. I spot 2 typos in it.
SkylineR34 wrote:
mob
fisherman
icon='boy.dmi'
density=1
verb/Sell_fish()
if(usr.fish > 1)
set src in oview(1)
alert ("Thanks, here ill give you [usr.fish] for that one, but less for the next fish")
usr.contents-=new/obj/Fish
usr.money+=usr.fish
usr.fish-=1
else
usr<<"you got no fish!"



i want to get it to delete the obj fish out of the inventory when you sell the fish,


try something like this..

mob
fisherman
verb/Sell_fish()
set src in oview(1)
var/obj/Fish/F=locate() in usr
if(F)
//add stuff you want to do here...
else
usr<<"you got no fish!"
In response to Koshigia
for(var/obj/o in usr)

if(istype(o,/obj/fish))
usr.contents.Cut(o)
break
else continue
In response to SkylineR34
Hes just asking a question, get off his case garthor.