Barnicoat
Sorceror
Hi all,
I'm just looking for some clarification on how RandomList would work in the context below. The information and examples I've found on the forums and internet don't fully explain it (at least the way I read it.)
The following code determines the chance of a particular hue Cu Sidhe spawning.
Take this part for example:
else if ( chance < 50 )
Hue = Utility.RandomList( 0x657, 0x515, 0x4B1, 0x481, 0x482, 0x455 );
If chance is less than 50 (but greater than 1), then ONE of the following hues will be assigned to that mobile. Or does EACH of the hues listed have a 1 in 50 chance.
With the total weight being 23301, the chance of getting a normal coloured cu is either ~86% or ~98%, depending on the sentence above... which is a big difference
Hopefully I've explained my question clearly enough.
Any help would be great.
EDIT: I found a couple threads relating to randomlist, even one about cu colours.
A statement by Vorspire in 2008,
"Each time you make a call to the RandomList function, it will return a different value."
That seems to imply that is chance is greater than 1 and less than 50, that ONE of the hues listed will be assigned to the mob. Meaning that the colours are a lot rarer than if they all had a 1 in 50 chance.
I'm just looking for some clarification on how RandomList would work in the context below. The information and examples I've found on the forums and internet don't fully explain it (at least the way I read it.)
The following code determines the chance of a particular hue Cu Sidhe spawning.
Code:
double chance = Utility.RandomDouble() * 23301;
if ( chance <= 1 )
Hue = 0x489;
else if ( chance < 50 )
Hue = Utility.RandomList( 0x657, 0x515, 0x4B1, 0x481, 0x482, 0x455 );
else if ( chance < 500 )
Hue = Utility.RandomList( 0x97A, 0x978, 0x901, 0x8AC, 0x5A7, 0x527 );
Take this part for example:
else if ( chance < 50 )
Hue = Utility.RandomList( 0x657, 0x515, 0x4B1, 0x481, 0x482, 0x455 );
If chance is less than 50 (but greater than 1), then ONE of the following hues will be assigned to that mobile. Or does EACH of the hues listed have a 1 in 50 chance.
With the total weight being 23301, the chance of getting a normal coloured cu is either ~86% or ~98%, depending on the sentence above... which is a big difference
Hopefully I've explained my question clearly enough.
Any help would be great.
EDIT: I found a couple threads relating to randomlist, even one about cu colours.
A statement by Vorspire in 2008,
"Each time you make a call to the RandomList function, it will return a different value."
That seems to imply that is chance is greater than 1 and less than 50, that ONE of the hues listed will be assigned to the mob. Meaning that the colours are a lot rarer than if they all had a 1 in 50 chance.