Change Item Price In Game

I would like to know if it would be possible to change the price of an item at any given moment, because I want my game to have a lock option, which means it cannot be sold, and I believe the only way to do that is to set the price to zero (unless anyone else has a better way), but the problem is, I only want that when the player selects the "Lock" command in the inventory screen. Otherwise, use the original price. I'd prefer to just use a script call if possible because I am using a script to get the Lock command and I need some way to call that into the script. 


Thanks in advance.  
Unless you have an instanced items script, setting the price to zero would affect all instances of that item, including the buying price in shops.
OK. I just got Hime's Item Instance script. 
First ensure that Enable_Items is set to true in the script's configuration.


You can use this script call to change the price of an item within your party's inventory:


return unless $game_party.has_item?($data_items[id])
$game_party.find_instance_item($data_items[id]).price = 0




-Edit-


You can also change the price of an item by index:


$game_party.items[index].price = 0


Probably required if you have multiple instances of the same item within your inventory...

Though, I'm not sure if using this script solely for this purpose is optimal. You kinda have to design around instance items or you're bound to run into issues. It's less of an problem for equipment, but when items (something you generally have a lot of) are instanced, they take up individual slots in your inventory. If your project has a lot of items in the database, this will probably cause test battles to stop working entirely.

Original thread: https://forums.rpgmakerweb.com/threads/change-item-price-in-game.66680/