Random types of weapons

Good evening, another small question ..... I'll explain better:
the player arrives in an armory, and they find different weapons, but no I want to let him find a fixed number of weapons, but I want to find a random number and random types of weapons of all those created in the database, what can I do?
Thanks in advance
control variable to get a random number, followed by conditional branch to check which number and give different items depending on the number
I want to let him find a fixed number of weapons, but I want to find a random number and random types of weapons of all those created in the database, what can I do?

Something like this?
1650586107730.png

JavaScript:
var gainedWeapon = $dataWeapons[(Math.floor(Math.random()*($dataWeapons.length-1)))+1];
$gameVariables.setValue(17, gainedWeapon.iconIndex)
$gameVariables.setValue(18, gainedWeapon.name)
$gameParty.gainItem(gainedWeapon, 1);
This code will get a random weapon from the entire weapon database & give 1 of them to the player and will store the weapons name into variable #18 & the weapons item index into variable #17 so we can display it via message

That event looks like this in game:
Spoiler: Random Weapon Event Game Play


Does that help?

Original thread: https://forums.rpgmakerweb.com/threads/random-types-of-weapons.146977/