ID:172119
![]() Jun 26 2004, 10:05 am
|
|
I know this is pretty newbish, but I can't figure out how to do it. How would I delete a certain object in a player's inventory? I've tried del(/obj/thing in usr), del(/obj/thing) in usr, and a couple others, but they either don't work right or give me errors. I know this is an incredibly obvious question, but for that reason I couldn't find the answer to it anywhere. Thanks x_x
|
![]() Jun 26 2004, 10:08 am
|
|
subtract it from contents...i think that should work
|
del(obj)
obj = the thing you want to delete if you don't have it defined, locate could to the trick You can look it up in DM by pressing F1 and typeing in locate |
ok, if I use that, it works when there's 1 item in the usr's inventory. But if there's more than 1 item, it deletes another object, not the one specified. This is what I'm using:
var/obj/thing=locate() in usr del(thing) ...Am I doing something wrong? |
Rippy wrote:
ok, if I use that, it works when there's 1 item in the usr's inventory. But if there's more than 1 item, it deletes another object, not the one specified. This is what I'm using: How do you want to select the object to delete? By some other means than locate? /Gazoot |
If you just have a specific type of object in the player's inventory that you want to delete, locate() is probably the way to go.
The way you have it set up there, though, it will just take any /obj from the player's inventory and delete that. If you only want to delete an /obj/thing, you need to do something like this: var/obj/thing/MyThing = locate() in usr del(MyThing) The "MyThing" is a variable name. The bit before it ("/obj/thing") is the type of the object that "MyThing" will get set to. |
He said a certain object. That loop will delete ALL objects of that type. Which is fine if that's what he wants, but it's usually good to clarify these things.
|