Advertisement
LostAdvanced

Untitled

Oct 4th, 2022
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local LowestNumberMax, HighestNumberMax = 1, 100
  2. local WantedNumber = math.random(LowestNumberMax, HighestNumberMax)
  3. local Generation,CurrentNumber,CurrentType,GlobalSpieces = 1,0,false,'Idex'
  4.  
  5. function Get_RandomNumber(Low, Max)
  6.    local Number = math.random
  7.    return Number(Low, Max)
  8. end
  9.  
  10. function RandomChance()
  11.    local Weight = math.random(1,HighestNumberMax)
  12.    local WantedNumber = math.random(1,HighestNumberMax)
  13.    if Weight > WantedNumber then
  14.       return false else return true
  15.     end
  16. end
  17.  
  18. function SpiecesType(Spieces_Id)
  19.    local Spieces = {
  20.        {1, 'Human'};
  21.        {50, 'Demi Human'};
  22.        {70, 'Furrys'};
  23.        {80, 'Fish'};
  24.        {100, 'Cyborg'};
  25.    }; CurrentSpieces = Spieces[1][2]
  26.    
  27.    if Spieces_Id >= Spieces[1][1] and Spieces_Id < Spieces[2][1] then
  28.        CurrentSpieces = Spieces[1][2]
  29.        
  30.    elseif Spieces_Id >= Spieces[2][1] and Spieces_Id < Spieces[3][1] then
  31.        CurrentSpieces = Spieces[2][2]
  32.        
  33.    elseif Spieces_Id >= Spieces[3][1] and Spieces_Id < Spieces[4][1] then
  34.        CurrentSpieces = Spieces[3][2]
  35.        
  36.    elseif Spieces_Id >= Spieces[4][1] and Spieces_Id < Spieces[5][1] then
  37.        CurrentSpieces = Spieces[4][2]
  38.        
  39.    elseif Spieces_Id < Spieces[4][1] then
  40.        CurrentSpieces = Spieces[5][2]
  41.     else
  42.     CurrentSpieces = Spieces[1][2]
  43.    end
  44. return CurrentSpieces
  45. end
  46.  
  47. repeat
  48.    
  49. local RequestedNumber = Get_RandomNumber(LowestNumberMax, HighestNumberMax)
  50. local TypeChanace = RandomChance()
  51. local Spieces = SpiecesType(RequestedNumber)
  52. if TypeChanace == false and RequestedNumber == WantedNumber then
  53.     RequestedNumber = RequestedNumber + 1
  54. end
  55. CurrentNumber = RequestedNumber; CurrentType = TypeChanace; GlobalSpieces = Spieces
  56. Generation = Generation + 1 print(Spieces, 'Gen #',Generation,' GenType',CurrentType)
  57. print('Gen #',Generation,'Race',Spieces,'Type',TypeChanace)
  58. until
  59. RequestedNumber == WantedNumber
  60. --\\End Finis
  61. print('Generation [',Generation,'] Race [',GlobalSpieces,']','Gen_Type [',CurrentType,']')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement