We'll start with the item flags: OIF_NO_TRANSFER OIF_USES_WAND_ANIM OIF_NO_LOOT OIF_EXPIRES_AFTER_USE OIF_DRAW_WHEN_PARENTED OIF_VALID_AI_ACTION OIF_NO_RANGED_USE OIF_NO_NPC_PICKUP OIF_UBER OIF_NO_DECAY OIF_USE_IS_THROW OIF_STOLEN OIF_MT_TRIGGERED OIF_PERSISTENT OIF_LIGHT_XLARGE OIF_LIGHT_LARGE OIF_LIGHT_MEDIUM OIF_LIGHT_SMALL OIF_NEEDS_TARGET OIF_CAN_USE_BOX OIF_NEEDS_SPELL OIF_NO_DROP OIF_NO_DISPLAY OIF_NO_PICKPOCKET OIF_IS_MAGICAL OIF_WONT_SELL OIF_IDENTIFIED Out of these, the following look promising (for this operation, or operations similar): OIF_NO_TRANSFER OIF_NO_LOOT OIF_NO_NPC_PICKUP OIF_WONT_SELL I kinda like the first, and especially the last. Now, we need to get a handle to an item object, and use obj.item_flag_set() to figure out which one it is. My guesses are: NO_TRANSFER means the holder keeps it as "his", won't give it away (may sell it) NO_LOOT means you can't take it off a dead body, NO_NPC_PICKUP means an NPC will never touch it during looting WONT_SELL means an NPC will keep it as his rather than sell it (but might give it to PCs) I'd test it, but have LOTS to do today on a work project I'm presuming Liv has a way to get a handle to an obj during this work? Edit: NO_DROP looks intriguing too. That probably gets set for everything an NPC owns in the released game, hmm? -- dulcaoin
D - I do know how to get a handle on an item, but ONLY if I know it may or may not be there. There is no way I know of to get a handle on an item without asking for that actual item. In my exerience to make a script that would tag all items on an NPC would require a script that would have every single item in game listed. The script would then see if that item was there and then tag it one way or another and then move on the next item. I already thought of doing this, but the labor required really isn't worth the effect... Of course there might be an easier way, but I am not sure it is worth the trouble. For the most part the only items that are annoying are the crappy starting items that the NPCs come with. Once these are removed then it is simple enough for the player to control the NPC's inventory from that point on. - Livonya
Couldn't we just loop through the item numbers from protos, and do an item_find_by_proto and compare to OBJ_HANDLE_NULL? When the item is not OBJ_HANDLE_NULL set / unset the flag? So far I have found: OIF_NO_TRANSFER for a PC item this didn't do anything, I need to recruit an NPC. OIF_WONT_SELL would let me sell to Brother Smyth, but then I couldn't buy it back from him. It says, "I wont sell that..." Code could be something like: for x in range(3000, 13000) if game.party[x].item_find_by_proto != OBJ_HANDLE_NULL game.party[x].item_flag_set(OIF_NO_TRANSFER) Its not elegant, and I can't get the flags to set / get correctly, but you get the idea. If anyone should get this working, please post. I am curious what I am doing wrong, but have things to do so I can't figure it out now. -Firestrand
Yikes! game.party[3000] ? That's a big party <wink> I'm guessing you typed that up by hand, rather than copy/paste? I'll do the same, I'm thinking it'd be something like (using your method -- I've actually spent an hour or two this morning that I really shouldn't have looking for the inventory array "off" a PyObjHandle -- I'm certain it's there, I just have to find it)... Code: for x in range(3000, 13000) : item = game.party[5].item_find_by_proto(x) if item != OBJ_HANDLE_NULL : item.item_flag_set(OIF_NO_TRANSFER) there's some hard-coding there, it's not the most elegant, but it'd be something like that, I think
Ok, you caught me.... Silly mistake.... I spent some time looking for the items array as well. One interesting thing to note though is that when you do get a handle on the item object, it has the same methods as a party member. At least when I did a dir(item) that is what it looked like. Maybe I was just halucinating with my party of 3000 -Firestrand
You're not hallucinating, an object is an object. That means you can ask a container for its critter flags. You should get 0 for everything if you DO that of course, but it's there. The name of the "class" is PyObjHandle. It's a mutha. -- dulcaoin
Yes, that would be accurate. protos.tab is the TAB delimited TABle holding PROTOtypeS for all objects in the game; I guess. -- d
BTW, I'm a little concerned about our approach. What happens when an NPC has two of the same type of item, built from the same proto? I can see the call returning a handle to the first such item in inventory, but what about 2..n? -- dulcaoin