Make item unmovable from inventory?

Users who are viewing this thread

MartinF

Squire
Is there any way to make an item unmovable in the inventory? I'm talking about by the player or by the 'auto lose item when you're captured' script. The second one I can change manually, just make it disregard those items that I don't want the player to be able to lose but it would be really great if he also couldn't sell them by accident.

Couldn't find anything in the header_items or searching the forum so thought it would be worth a post here.

Trying to make starships with various upgrade options, which will be a lot easier (ie less slots and a LOT less code) if the ship is just an item that sits in the inventory. Obviously it would suck if you accidentally sell your ship to the merchant after spending 20k upgrading it...
 
I've yet to find a way to do this which updates properly while you're still in the inventory screen.

However, you can, for instance, add a zero-time trigger in module_simple_triggers which uses store_item_kind_count to store the number of items a player has in her inventory of a certain type and reduce/add items to make it come to exactly 1. This is superior to the solution of sticking a similar test in module_tableau_materials under game_inventory_window as that doesn't appear to update the number of items of the given type until the window is closed, so consequently you can junk an item then reopen the inventory and see it absent while getting the message that the item has been added again. You then must close and reopen the inventory to see it back. If there's some solution I'm unaware of that allows you to refresh the inventory screen's item count which works when called from game_inventory_window, that might be a better solution still, though if that's possible it might pose some issues when trading goods, as you could drop the good in another's stash multiple times and retrieve it.

I imagine you'll also want to put guards round calls to change_screen_trade etc so that if the player does sell the (hopefully zero-priced) item to a trader, it gets taken out of the trader's stock instantly. Possibly best done by wrapping change_screen_trade in a script.

Sorry I can't be of any more help.
 
Replace the ship with a 0-priced placeholder before the trade screen; replace it with the actual ship after the trade screen.

Player can still sell the placeholder, but that has no gameplay impact since the ship will just reappear in their inventory afterwards; except if they are deliberately trying to mess things up by selling their placeholders, filling their inventory with stuff, and forcing the script to replace an item with the ship. In that case, they just lose an item through deliberate stupidity, not your problem.

Another way to do this, is to put the ship in the (invisible) food slot... not sure how that would work out for you.
 
thanks for the ideas.

Food slot might be an option, but I might want to lean towards having it show up in the inventory, so the player can see the shiptype. Guess I can test with some different methods and see which I like best
 
fisheye said:
Replace the ship with a 0-priced placeholder before the trade screen; replace it with the actual ship after the trade screen.
If you're going to try and make the item unlosable instead of just untradeable, it'll also need done before accessing the inventory when swapping items with other characters as well and when accessing the inventory for putting items in stashes, junking items, etc.

Ideal would be to have an item that the player couldn't actually move, but there doesn't seem to be an imodbit which achieves this and there's no call in the mod code (as far as I can see) triggered by an item on the inventory screen being dragged.
 
Back
Top Bottom