MV How to change database item icon mid-game

I've been curious about this. Is there a way to change an item/skill's icon via script call or common event during the game? I was thinking of replicating how Bottles work from The Legend of Zelda, where drinking a potion would empty the bottle, etc.
Hi there!

Yes you can, but the change will not persist when close and open the game.
$dataItems[ID].iconIndex = X
Same approach with $dataWeapons, $dataArmors, $dataSkills.

I don't think it is doable, because of the amount of work. But in theory, If you have a plugin that can launch a common event everytime you load a save file, you may have a way to use that to change the icon of what you want.

You just need to store the currently item/skill icon index on a variable. Maybe after the use of the item for example, you can change that variable to use an "empty bottle icon" with a common event on the effects of the item.

But then, you will also need a way to restore that icon index if somehow the empty bottle fills again.

If you don't have a lot of things you need to change, maybe just creating a new item that is the empty bottle, and when you use a full bottle, you can gain a empty bottle with the effect common event.

Well just ideas on the air haha
Yes you can, but the change will not persist when close and open the game.
$dataItems[ID].iconIndex = X
Same approach with $dataWeapons, $dataArmors, $dataSkills.
While this will work in theory, it's generally a bad idea to modify any of the $data variables in a script call. I'm not sure when exactly the data is loaded from disk or if it can happen more than once in a normal session, but there is at least a chance that using this script call would cause the icon change to persist even if you load a different save that shouldn't have made the change. And it won't persist when you close and reopen the game and load a save file.

I was thinking of replicating how Bottles work from The Legend of Zelda, where drinking a potion would empty the bottle, etc.
I don't think changing the item's icon (at least in the above way) would even solve this. You're talking about changing the "archetype" here. I don't know if you've changed how items work in your game already, but changing the icon of an item means changing it for every item of that type. If you have 30 potions and drink 1, you'll end up with 30 empty bottles? Obviously that's not right. I think the simplest and easiest way would be to just create a separate empty bottle item and give you one every time you use a potion.

If you have some plugin that makes potions not stack (so you can have 30 separate potions in the list, instead of 1 potion with a count of 30), then changing the icon of the item does make sense, though that wouldn't be done by editing $dataItems.
While this will work in theory, it's generally a bad idea to modify any of the $data variables in a script call. I'm not sure when exactly the data is loaded from disk or if it can happen more than once in a normal session, but there is at least a chance that using this script call would cause the icon change to persist even if you load a different save that shouldn't have made the change. And it won't persist when you close and reopen the game and load a save file.


I don't think changing the item's icon (at least in the above way) would even solve this. You're talking about changing the "archetype" here. I don't know if you've changed how items work in your game already, but changing the icon of an item means changing it for every item of that type. If you have 30 potions and drink 1, you'll end up with 30 empty bottles? Obviously that's not right. I think the simplest and easiest way would be to just create a separate empty bottle item and give you one every time you use a potion.

If you have some plugin that makes potions not stack (so you can have 30 separate potions in the list, instead of 1 potion with a count of 30), then changing the icon of the item does make sense, though that wouldn't be done by editing $dataItems.

Maybe I just overthought it and went to the wrong conclusion of changing the icon instead of just... generating a new item with common events. Because this makes more sense lmao.
While this will work in theory, it's generally a bad idea to modify any of the $data variables in a script call. I'm not sure when exactly the data is loaded from disk or if it can happen more than once in a normal session, but there is at least a chance that using this script call would cause the icon change to persist even if you load a different save that shouldn't have made the change. And it won't persist when you close and reopen the game and load a save file.
- Database os only loaded on Scene_Boot, so yes, it may cause issues if the game is still open and he changes save/slot files. But I did not say that alone. With the load common event idea, the icons would be restored to their proper iconIndex, so that problem would be solved.
I don't think it is doable, because of the amount of work. But in theory, If you have a plugin that can launch a common event everytime you load a save file, you may have a way to use that to change the icon of what you want.

You just need to store the currently item/skill icon index on a variable. Maybe after the use of the item for example, you can change that variable to use an "empty bottle icon" with a common event on the effects of the item.

But then, you will also need a way to restore that icon index if somehow the empty bottle fills again.
- Of course, I was just "brainstorming". Even if that theory would work, the amount of work make it not worth it. This approach has indeed a lot of problems.

I think, without plugins, the best way would be go with receiving a new item(empty bottle) after used one.
Yeah, thinking about it a bit more, my idea of changing icons mid-combat was a bit silly. It would have been for some really niche cases that wouldn't justify the problems that come with editing $data functions. Much less so when it came to something like replicating potions from Zelda.

So I think it's safe to say this is solved. Thanks for chipping in, y'all.
I do have a SaveManager for database for weapons, armor and items as
I use that too.

if you target enemies, troops, and other stuff, it can be bad, but it works
for me as I have to change icons to alter the picture.

if you need to alter the items icon => why not save variable of amount you have
in a variable, than - items and + item from variable so the icon change?

if its upon using the item, I have a option in my base that does that, but its
also an alternate way without plugins + it always saves it.

if you want bottles to change => check my base plugin, which has that way ^^

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-database-item-icon-mid-game.181997/