In need of some help with Name selection and random material script
Hey Guys, Im trying to write a script for work but I'm quite new to scripting. Wonder if anyone could help.
I'll try to keep this simple...
What we have is sets of 4 people, i.e. Sandy, Ben, Sue and Jerry. The next set would be Sandy01, Ben01, Sue01, Jerry01 and so forth. THEN For each person we have 4 material variations, so lets say Sandy could have ONE material from the materials named Sandy, Sandy01, Sandy02, Sandy04 and the same for the other people. We need a script to add a random material from the ones that are associated with the characters name. I hope that makes sense, I tried to keep it simple and clear.
I'm having trouble selecting all the objects using characters name (although i think im close) I then am stuck a little on how to select a random material from the ones in the material editor with the characters name.
I've attached the code so far (with comments on my thought process), if anyone is able to help it will be much appreciated.