Ok, so you need to make an item that turns on a switch; it's one of the item options (Number of uses is up to you, depending on how you want it to work) So we'll just call the switch (Change to Warrior) for the sake of this example.
The next thing you'll need to do is setup a Common Event. Have it set to Parallel Process and make it's trigger switch require the Switch from the item (Change to Warrior).
After that; just follow this script and you should be in the right direction.. This code is just for one class, so you'll need to repeat the process for the other classes (Creating the item with switch, the common event, etc)
The reason we have it setup like this is to make sure that Hero 4 has or hasn't joined your party, that way you won't be setting a class for a hero you don't have yet.