[Help] Blessing (-1, -3, -5, -7)

12/12/2008 20:10 Beta Limit#1
So i found the line in my LOTF source that controls the blessing on drops.

Code:
Bless = (byte)General.Rand.Next(1, 7);
I know this generates 1 random number between 1 and 7.
How would i make it so it cannot choose 2, 4 and 6?
12/12/2008 20:37 alexbigfoot#2
simple,

while(Bless == 2 || Bless == 4 || Bless == 6)
Bless = (byte)General.Rand.Next(1, 7);

problem fixed

it will try till it gets 1,3,5,7
12/12/2008 20:42 Beta Limit#3
thanks alot i did it a different way

Code:
    
Blessing = (byte)General.Rand.Next(3, 5);
                        if (Blessing == 3)
                            Bless = 3;
                        if (Blessing == 4)
                            Bless = 0;
                        if (Blessing == 5)
                            Bless = 5;
In the one i just made it only allows -3 and -5 to drop like in the real game

EDIT Tested mine and it only allowed -3's to drop xD so ill use yours
12/12/2008 21:33 InfamousNoone#4
Quote:
Originally Posted by Beta Limit View Post
So i found the line in my LOTF source that controls the blessing on drops.

Code:
Bless = (byte)General.Rand.Next(1, 7);
I know this generates 1 random number between 1 and 7.
How would i make it so it cannot choose 2, 4 and 6?

Code:
  byte rand = (byte)General.Rand.Next(0, 7);
  if (rand % 2 == 1) { rand--; }