Picked up item plays sound

I'm about to add manually add sound on text each time the player 'Picks up' an item so all item pick up event would probably look like the picture below:

I was wondering if there is a more efficient way to this on all item pick up events? Or is there a plugin I don't know.
image is not working, but if you want it more consistent and same sound.
I would do it through a common event.

so you always play the same sound effect, but control the item ID
gained by a variable that you set, so the item gain is correct with the
consistent sound you placed.

using 2 variables, you can set the type first, so the common event plays
the sound on the variable ID first.

(armor, equip, potion, etc), whatever works best.
image is not working, but if you want it more consistent and same sound.
I would do it through a common event.

so you always play the same sound effect, but control the item ID
gained by a variable that you set, so the item gain is correct with the
consistent sound you placed.

using 2 variables, you can set the type first, so the common event plays
the sound on the variable ID first.

(armor, equip, potion, etc), whatever works best.

I need a bit of a refresher, so a common event would probably look like this?
Went back and think about what you said, thanks for the fast reply btw.

So it should look like probably this on the Common Event and the pick up item event.
Each time you would pick something it would add to a variable +1 to item sound and the common event would set it to 0 again to prevent ear-bleeding repeat sound.

Or did I misunderstood what you said?
not exactly.

the common event has the variable part, and their conditions.
in there, you call like: $dataItems[$gameVariables(ID)] to gain that item.

so on item gain, you set the type variable (0, 1, 2, 3) that you can just
use, variable 1 (type) = 1
variable item ID = 4
common event id

and that's basicly it.

so everything gained is by a simple variable ID setting and a scriptcall.
I have a sample for it, but never shared, I show you later how exactly.
not exactly.

the common event has the variable part, and their conditions.
in there, you call like: $dataItems[$gameVariables(ID)] to gain that item.

so on item gain, you set the type variable (0, 1, 2, 3) that you can just
use, variable 1 (type) = 1
variable item ID = 4
common event id

and that's basicly it.

so everything gained is by a simple variable ID setting and a scriptcall.
I have a sample for it, but never shared, I show you later how exactly.
Please do share it, I'm a bit lost.
this is a basic setup you can use, so see it as a mini tutorial (I ruled things out as it is not my my current use).
as it was used with messageCore but cant use it anymore, for changing row 1 first, reset 4 after.

so a little tutorial for anyone that want to use it (as this is 4 common event, but you can do with 2,
depends how you use it of course, but this is maybe the cleanest way I use too.

for chest Sound consistency as it plays once.
Chest Sound (CE).png


for Gold consistency common event
we always reset variable quantity to 1, so if you just call it without a amount, its gain 1.
Get Gold (CE).png


for the Gold Event that is gained.
so we play the chest sound once here, switch, amount to get and the gold common event.
(SelfSwitch A can also be after "Get - Gold".
Gold Event.png


for Item, Weapon, Armor, it is slightly difference, but pay attention on the scriptcall.
Get Item (CE).png

Get Weapon (CE).png

Get Armor (CE).png


Armor and weapon has a setting false (forgot what it did, but was target for equiping if memory reserved)
also here, default Quantity = 1 on reset.

the item event look like this.
Item Event.png


common event target weapon ID 15, so it uses 1 variable for the id to get what you want (always use this.)

make sure you initialize variable 3 to be 1, or it might not work the first time as variable start with 0.
so initialize it to 1.

I hope this makes it more clear and how to use common event for more consistency on sound and gain items 🙂

Edit:
ii, iw, ia = messagecore code for the item Name.
JavaScript:
$gameParty.gainItem($dataItems[$gameVariables.value(2)],$gameVariables.value(3));
$gameParty.gainItem($dataWeapons[$gameVariables.value(2)],$gameVariables.value(3),false);
$gameParty.gainItem($dataArmors[$gameVariables.value(2)],$gameVariables.value(3),false);
I followed your tutorial and it works great! Only downside is that I would constantly refer to the item ID instead of the item name for the Item Event, thank you so much!
Item Id is just a reference for the ID for item, armor or weapon to gain.
which is why 1 variable is just for dataItems, dataArmors, dataWeapons.

so it is efficient way to use variables.

your free how to use it, but the sound in each is consistent 🙂

with 1 more variable, you can control the type, and use 1 common event.
see what works best, but it works smooth and if you make a mistake,
the common event change does that for all event in 1 sweep without tracking
down each of them to change =)

Original thread: https://forums.rpgmakerweb.com/threads/picked-up-item-plays-sound.175478/