ID:169061
 
i cant whittle ive tryed lots of stuff my problem is i cant make it so when i use a verb for a dagger to have it so it requires me to also have wood in my invetory. this is my code.

obj/items/Equippable/dagger/verb/Whittle(/obj/items/Wood in usr && /obj/items/Equippable/dagger in usr)
set src in usr
usr << "you whittle the piece of wood"
del /obj/items/Wood
new /obj/items/Equippable/oar(usr)
mob/var
haswood

obj/items/Equippable/dagger/verb/Whittle()
if(usr.haswood >= 1)//that sounds wrong
usr << "[usr] whittles
else
usr << "You need wood to whittle!"//Still sounds wrong

needs a little work, but that's the basic premice
In response to Popisfizzy
thanx
In response to Flame500
Popis's code doesn't look like what you want. Why have a set var? You can easily fix the original code you had:
obj/items/Equippable/dagger/verb/Whittle()
set src in usr
var/Wood = locate(/obj/items/Wood) in usr.contents
if(Wood)
usr << "you whittle the piece of wood"
del Wood
new /obj/items/Equippable/oar(usr)

It should work, but it's untested.
In response to Artekia
It wont because you have Del Wood before the thing ends. Del Wood needs to be at the end of the procedure to finish.
In response to Polaruis
It should still work, wood isn't the src and it running shouldn't depend on it.
In response to Artekia
Run it and try it. I bet you 100% it will fail.
In response to Polaruis
I just tried it, with some added code to actually get it to work(like get() and what not) and the oar showed up in my inventory.
In response to Polaruis
Polaruis wrote:
Run it and try it. I bet you 100% it will fail.

No, it won't fail. The procedure only stops if it is owned by the object which is deleted, for obvious reasons. It does not matter whether any other object is deleted.

~~> Dragon Lord
In response to Polaruis
Polaruis wrote:
Run it and try it. I bet you 100% it will fail.

As has already been said, it works as long as Wood is not needed anymore.
In response to Artekia
thanx for the help
In response to Unknown Person
Really? In the past I could have sworn I tried to delete an obj from a verb and after the obj was deleted the procedure stopped.