Jump to content

Home

Delete item from inventory


shosey

Recommended Posts

How can I delete an item from my inventory with a script?

 

Lets say I hate the miners uniform. So, I want a script that deletes the item with tag "mineruniform" from my inventory when its executed.

 

I found how to create an item in the inventory but not delete.

 

I did find this.

 

void ActionTakeItem(object oItem, object oTakeFrom);

 

 

but it doesn't seem to take an item out of your inventory, I believe it instead takes an item from another creatures inventory and places it in your own. But, I have not tested that.

 

 

Any help would be most appreciated. :D

Link to comment
Share on other sites

I cant code my way out of a paper bag but I know that KOTOR1 had a script for that when you visited that old guy on Taris who wants your Sith Outfit. Maybe go have a look at that and see if you can make a copy of it work for KOTOR2

Link to comment
Share on other sites

I would normally be the last person to give script advice and you probably know more than I do, but cant you just use the function

 

 

object GetItemPossessedBy(object oCreature, string sItemTag);

to find the object and then use Destroy object

Link to comment
Share on other sites

Originally posted by T7nowhere

I would normally be the last person to give script advice and you probably know more than I do, but cant you just use the function

 

 

object GetItemPossessedBy(object oCreature, string sItemTag);

to find the object and then use Destroy object

 

Yep, that worked - now can it be done without having the "Item(s) Lost" notifier shown?

Link to comment
Share on other sites

Originally posted by shosey

Yep, that worked - now can it be done without having the "Item(s) Lost" notifier shown?

Not that I know of, at least I don't know how to stop it... but, you might be able to bypass it if you used the global Fade-Out and Fade-In commands in your script so it would display the message but the player wouldn't see it because the screen is faded to black... it is a shot anyway. ;)

 

I hope this helps! :D

Link to comment
Share on other sites

Originally posted by shosey

Yep, that worked - now can it be done without having the "Item(s) Lost" notifier shown?

 

When using DestroyObject, make it look like this

 

DestroyObject (itemobject, 0.0,TRUE,0.0,TRUE);

 

the last "TRUE" supposedly terminates feedback message. I don't know if it works though (never tried it).

Link to comment
Share on other sites

Originally posted by Xcom

When using DestroyObject, make it look like this

 

DestroyObject (itemobject, 0.0,TRUE,0.0,TRUE);

 

the last "TRUE" supposedly terminates feedback message. I don't know if it works though (never tried it).

 

DUH - I should have realized that! Thanks Xcom - it worked great!

Link to comment
Share on other sites

Originally posted by Prime

Just wondering, but can't you just break it down or sell it?

 

Yep, I was wonderin' the same thing. In my case I'll build up 10 versions of a gun I'm working on with different stats and when I wanted to get rid of em' I just found an empty storage bin and put em' in it and walked off :)

Link to comment
Share on other sites

Originally posted by Prime

Just wondering, but can't you just break it down or sell it?

 

you could, but the reason I wanted to do this is because you shouldn't have the item in the first place.

 

Here's what I'm doing:

 

if you refer to here

 

you will see the "Holonet Interface" I"m making.

 

I want to have an online merchant system. In order for the delivery mechanism of this to work the items will have to be placed in your inventory from the purchase screen, then deleted immediatly after the screen closes. I will then keep track of ho many items were deleted and thats how many will spawn when you enter the hawk (ie. when they are delivered).

 

Make sense?

Link to comment
Share on other sites

hehe, trust me - this will make the online store "with delivery" work like you would expect.

 

now, I'm having some problems. My though was if I have 4 med packs in my inventory before I open the online store and buy 4 from the store, once the store closes I'd have 8 in my inventory. But, I only want 4 - because the other 4 that I just bought would be "delivered" to the ebon hawk - by UPS or FedEx or whatever delivery system they have in this galaxy far far away :)

 

Heres the problem. If I delete the medpacks after the store is closed, then try to create 4 new medpacks on my person to restore the inventory to the original state - it doesn't always work. It seems to re-create the medpacks every other time. It deletes them every time, but after they've been deleted they only show up every other time.

 

I did, however find this method -

SetItemStackSize(GetItemPossessedBy(GetFirstPC(), "mineruniform"), 4);

 

this modifies the medpack stack number in your inventorh from 8 (after you're done with purchasing from the store) to 4. This works every time. The problem with this is - there is a message saying "Items Lost" every time - and the user has to click "OK".

 

Does anybody know if there is a way to supress this message? I don't see any other forms of SetItemStackSize - so I don't think there is.

 

or, if anybody know's how to fix my delete then add back in method - that would work just as good!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...