Jump to content

Creating an item in a specific inventory slot


Recommended Posts

I would like to create an unmovable (undroppable) item in an item slot as the result of a script. Going into much detail here would be way too spoilerish, but there is a situation where I would like to destroy an undroppable item in Gavin's inventory and replace it with another undropable item in exactly the same inventory slot.


I've got this far to destroy the existing item:




But then I hit a wall. How do I create an unmovable object in a particular inventory slot?

Link to comment

all I found was


258 FillSlot(I:Slot*SLOTS)

This action will attempt to fill a slot in a character's inventory with the appropriate item type. Using FillSlot(SLOT_WEAPON) will look for any items (let's use, SW1H01, for example) in the inventory, and move the first it comes across into the weapon slot. This is a dangerous function because it will not check whether or not an item already exists in the slot. This means that an item already in the slot would be destroyed.

, but I think a good place to start would be thwe BG2 Tweaks that allow one-handed and two-handed usage; they have to create and destroy items and put them in the same slot in order to work. Do a search on PPG, too - I really remember that there were problems with this with one of the NPCs, and I think the solution was to equip the NPC with an undroppable, unmovable amulet and then do a direct replacement of that item with the new version (wish i could remember the code...)


related llink http://forums.pocketplane.net/index.php/topic,22379.0.html near the bottom

Link to comment

Oh, you so rock :D


TakeItemReplace accomplishes both actions in one elegant line. I want to destroy the item anyway. I had seen that originally, but I got confused when it said the item wouldn't be equipped. And I'm not crazy about FillSlot, because that will fill the slot with the first available item of the correct type. Not a problem in an empty inventory, or in a full one, but a big problem in a partially filled one, if there is another random item of the same type in an earlier inventory spot.


Because I already know the item that *should* be in the slot, and it's unmovable, it'll be there unless someone SK's it out. If they *do* SK it out, then Gavin's going to have something... interesting... in his inventory. I can't wait for the bug reports to start rolling in for *that* one. Just in case, I think I'll make sure the item does not need to be equipped to work. I think that's one of the available flags, and there are items that work in the inventory, so I'll look at one of them as a model. Like I said, it's too spoilerish to go into details. It's not even all that likely to come up in game, but you never know.


Oh, I'm so happy. I'm going to be able to do somthing kind of cool with this...

Link to comment


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

  • Create New...