If you want to load your project up for someone to take a look at, you could create a new map with one event that adds items to storage to set things up, and another that uses your script call to remove the item. Just to make it super easy for someone to reproduce the problem without having to spend a long time stumbling about trying to figure out what to do. Then put it on dropbox and post the link (or PM someone - if you do it in the next half hour I could take a look)
Okay, got it ...
With your demo project, it worked fine if I bought multiples of an item - when I trashed one, it would just trash one. But when I only had one of each item, and I trashed one, it wiped out everything, just as you said.
For some reason Galv has this:
Code:
def multi_storage_set(item, amount)
type = mstore_type(item)
@storage[$game_variables[Storage::BOX_VAR]][type][item.id] ||= 0
@storage[$game_variables[Storage::BOX_VAR]][type][item.id] = amount
if @storage[$game_variables[Storage::BOX_VAR]][type][item.id] <= 0
@storage[$game_variables[Storage::BOX_VAR]][type].delete_if { |key,value|
key >= 0 # <<<<<<<<<<<<<<<<<<<<<
}
end
end
which means as soon as you call multi_storage_set (which you do with store_rem), if it removes all of one item, it will delete every item where the key is 0 or greater.
I suspect it should be this instead:
Code:
def multi_storage_set(item, amount)
type = mstore_type(item)
@storage[$game_variables[Storage::BOX_VAR]][type][item.id] ||= 0
@storage[$game_variables[Storage::BOX_VAR]][type][item.id] = amount
if @storage[$game_variables[Storage::BOX_VAR]][type][item.id] <= 0
@storage[$game_variables[Storage::BOX_VAR]][type].delete_if { |key,value|
value <= 0 # <<<<<<<<<<<<<<<<<<<<<<<<<<<
}
end
end
So change line 875 and it should work fine.