Re: Improving REG stylist
You could make a second array and only add the hairstyles to it from the old array that the player does not have.
Or make a loop which keeps giving you random hairs until the condition (newhair != oldhair) is fullfilled.
The second option would look something like this:
var newhair = 0;
do {
newhair = hairnew[Math.floor(Math.random() * hairnew.length)];
} while (newhair == cm.getPlayer().getHair());
cm.setHair(newhair);
Re: Improving REG stylist
Quote:
Originally Posted by
SYJourney
You could make a second array and only add the hairstyles to it from the old array that the player does not have.
Or make a loop which keeps giving you random hairs until the condition (newhair != oldhair) is fullfilled.
The second option would look something like this:
var newhair = 0;
do {
newhair = hairnew[Math.floor(Math.random() * hairnew.length)];
} while (newhair == cm.getPlayer().getHair());
cm.setHair(newhair);
Thank you so much! :)
Ended up going with the second one, works like a charm!
Regards