Make an Actor start with random equipment

I want to make it so actors start with random equipment. I'm using Yanfly's Ace Equip Engine. It has a starting gear notetag but that only works on armor and it doesn't allow for variable IDs.


I tried using a script call to add the armor to the inventory:


$game_party.gain_item($data_armors[$game_variables[14]], 1)


Then a call to equip the new actor with it:


$game_party.members[3].change_equip_by_id(1, $game_variables[14])


This works fine on certain actors, but not all of the actors are going to have the same equip slots. And if the equipment can't be equipped to the exact slot number in the call, it will simply vanish. So unless there's a call function to make the equipment automatically go to a usable slot, using a script call to change their equipment won't work either.
Code:
#Add this before you choose the equipment
equipmentId = rand($data_armors.size)
// now add the item using this ID.
$game_party.gain_item(equipmentId)
#then equip the item with the sameId.
$game_part.members[3].change_equip_by_id(1, equipmentId)

🙂  
I should have specified. $game_variables[14] is used to generate what Weapon/Armor ID will be given to the player. That way I can make it so the Actor will only come pre-equipped with a weapon/armor from a certain list.


Variables 14 thru 19 will all be dedicated to Armor and Weapons.


Basically I want  $game_party.members[3].change_equip_by_id(slot, equip)  to equip $game_variables[14] to the appropriate open slot.
Ahh I see, in that case, as variables aren't being ready you can do this? since you said $gane_variables aren't working this might work.
 

Code:
#this would ensure the number is between 14 and 19 ^^
randomarmor = 13 + rand(5)
#then just use this number to asign equips.

and if you need this number in a variable just assign this  number to overwrite variable
 

Code:
#change the variable to equal your random armor.
$game_variables[variable_id] = randomarmor
I figured that part out. But now I need to make it so the armor automatically equips to the actor's first available equipment slot. Since the item could be an armor, an accessory, or whatever, if it doesn't automatically equip to the appropriate slot, it'll just disappear.


Should I re-title this thread to something more appropriate to my issue or should I just make a whole new one?
Ahh sorry bout that, I dont know off the top of my head what the script call is to get the type of a armor >_< ill see whenever I get back to my computer if nobody gets back to you with an answer before then.
Thanks for helping me so far, but I finally figured it out. It was an oversight on my part. I simply forgot to specify the equip type of my armors.

Original thread: https://forums.rpgmakerweb.com/threads/make-an-actor-start-with-random-equipment.59381/