ID:170689
 
usr.contents -= /obj/stuff/bottle


right?

but it doesnt seem to be working?
Try searching for the obj in the contents and then deleting it.
In response to N1ghtW1ng
How?
In response to Fraon2
mob
DeleteTwig()
var/obj/twig/T
if(src.contents.Find(T))
del(T)
else
src << "No Twig was found"


This should work, it wasn't tested though. That should help you figure out what to do...you might want to use a for loop instead but i'm not exactly sure if that would be best.
In response to N1ghtW1ng
I just need a remove code, like after you use the bottle is dissapears
In response to Fraon2
like this?
obj
potion
icon = 'potion.dmi'
name = "Potion"
density = 1
drink = 0
verb
Get()
set category = "Inventory"
set src in oview(1)
Move(usr)
Drop()
usr << "You drop the potion."
src.loc=locate(usr.x,usr.y+1,usr.z)
Drink()
if(src.drink == 0)
if(usr.health < usr.maxhealth)
src.drink = 1
usr << "<b>You drink the potion!</b>"
usr.health += 200
del(src)
else
usr << "<b>You do not need to drink it!</b>"
else
usr << "<b>You have already drank it.</b>"
In response to Fraon2
obj
bottle
Drink()
usr << "You restore yourself with the Bottle"
usr.hp = 100
usr << "Your bottle is gone!"
del(src)

That should work good.
In response to Zero's Baby
bah! When using truth/false statements don't use 1 or 0 :

if(blah == 1)

or

if(blah == 0)


do:


if(blah)

or

if(!blah)

In response to N1ghtW1ng
i never got used to doin that, i'll do it in the future, thanks
In response to Zero's Baby
Try not to use usr in the proc. And you don't have to put the () in the del (src). And since after drinking the potion, you are deleting the object so there is no point to make the drink var.

obj
potion
icon = 'potion.dmi'
name = "Potion"
density = 1
verb
var/mob/m = usr
Get()
set category = "Inventory"
set src in oview(1)
Move(m)
Drop()
m << "You drop the potion."
loc=locate(m.x,m.y+1,m.z)
Drink()
if(m.health < m.maxhealth)
m << "<b>You drink the potion!</b>"
m.health += 200
del src
else
m << "<b>You do not need to drink it!</b>"
In response to VUnit321
A) it's a verb, usr is perfectly normal there, there is no proc
B) i made the var just in case, you never know, i'll do some test, i think the code was fine >_>
In response to N1ghtW1ng
N1ghtW1ng wrote:
mob
DeleteTwig()
var/obj/twig/T
if(src.contents.Find(T))
del(T)
else
src << "No Twig was found"
This should work, it wasn't tested though.

It won't work, because T is null until you set it to an object. What you need is to use locate():
var/obj/twig/T = locate() in src
if(T) del(T)
else src << "No twig was found."

Lummox JR
In response to Lummox JR
Ah, alright thanks. I understand that now a bit better.