Advertisement
johnny2x2

Ark Survival 10 item Random Loot Drop Generator

Jan 28th, 2016
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 6.04 KB | None | 0 0
  1. %% 10 item Random Loot Drop Generator  Difficulty 1 - ( 6 Common items, 3 uncommon items, 1 rare, 0 Ultra rare )
  2. %% Difficulty 2 -  ( 4 Common items, 3 uncommon items, 2 rare, 0 Ultra rare )
  3. %% Difficulty 3 - (2 common 3 uncommon 3 rare 2 Ultra rare)
  4. %% RNG controls amount of times it goes through the selection process before displaying one.
  5.  
  6. cell_count = 534;
  7.  
  8. Type = input('What is the difficulty #(1-3)?');
  9. Times = input('RNG #(1-5)?');
  10. Data = ArkIDBook;
  11.  
  12. common = {};
  13. uncommon ={};
  14. rare = {};
  15. U_rare = {};
  16. counter_1=1;
  17. counter_2=1;
  18. counter_3=1;
  19. counter_4=1;
  20. for i = 1:534
  21.    
  22.     Rarity = cell2mat(Data(i,5));
  23.    
  24.     if Rarity == 1
  25.         common(counter_1,:) = Data(i,:);
  26.         counter_1 = counter_1 + 1;
  27.     end
  28.     if Rarity == 2
  29.         uncommon(counter_2,:) = Data(i,:);
  30.         counter_2 = counter_2 + 1;
  31.     end
  32.     if Rarity == 3
  33.         rare(counter_3,:) = Data(i,:);
  34.         counter_3 = counter_3 + 1;
  35.     end
  36.     if Rarity == 4
  37.         U_rare(counter_4,:) = Data(i,:);
  38.         counter_4 = counter_4 + 1;
  39.     end  
  40. end
  41.  
  42.  
  43.  
  44. for i = 1:Times
  45.   if Type == 1
  46.     h_common = 6;
  47.     h_uncommon = 3;
  48.     h_rare = 1;
  49.     h_U_rare = 0;
  50. end
  51. if Type == 2
  52.     h_common = 4;
  53.     h_uncommon = 3;
  54.     h_rare = 2;
  55.     h_U_rare = 1;
  56. end
  57. if Type == 3
  58.     h_common = 2;
  59.     h_uncommon = 3;
  60.     h_rare = 3;
  61.     h_U_rare = 2;
  62. end
  63.  
  64.  
  65. com_len = length(common);
  66. uncom_len = length(uncommon);
  67. rare_len = length(rare);
  68. U_rare_len = length(U_rare);
  69.  
  70. %Compile Common Stuff
  71. Common_stuff = {};
  72. cl1 = 1;
  73. Id_c1 = zeros(1,length(h_common));
  74.  
  75.  
  76. for k = 1:(h_common)
  77.    
  78.    
  79.    
  80.      next1 = randi(com_len,1);
  81.      item = common(next1,:);
  82.      tester = 0;
  83.      
  84.      while tester < 1    
  85.      test_me = 0;
  86.      id = cell2mat(item(1));
  87.      
  88.      for j = 1:cl1
  89.          xtex = id == Id_c1(j);
  90.         if xtex == 1
  91.              test_me = 1;
  92.         end
  93.      end
  94.      
  95.    
  96.      
  97.      if test_me == 0
  98.          Id_c1(cl1+1) = id;
  99.          Common_stuff(cl1,:) = common(next1,:);
  100.          cl1 = cl1+1;
  101.          tester = 2;
  102.      
  103.      else
  104.          next1 = randi(com_len,1);
  105.          item = common(next1,:);
  106.          
  107.      end
  108.   end
  109.      
  110.          
  111.          
  112. end
  113.  
  114. %Compile unCommon Stuff
  115. unCommon_stuff = {};
  116. cl1 = 1;
  117. Id_c1 = zeros(1,length(h_uncommon));
  118.  
  119.  
  120. for k = 1:(h_uncommon)
  121.    
  122.    
  123.    
  124.      next1 = randi(uncom_len,1);
  125.      item = uncommon(next1,:);
  126.      tester = 0;
  127.      
  128.      while tester < 1
  129.      
  130.          
  131.      test_me = 0;
  132.      id = cell2mat(item(1));
  133.      
  134.      for j = 1:cl1
  135.          xtex = id == Id_c1(j);
  136.         if xtex == 1
  137.              test_me = 1;
  138.         end
  139.      end
  140.      
  141.  
  142.      
  143.      if test_me == 0
  144.          Id_c1(cl1+1) = id;
  145.          unCommon_stuff(cl1,:) = uncommon(next1,:);
  146.          cl1 = cl1+1;
  147.          tester = 2;
  148.        
  149.      else
  150.          next1 = randi(uncom_len,1);
  151.          item = uncommon(next1,:);
  152.          
  153.      end
  154.      
  155.   end
  156.      
  157.          
  158.          
  159. end
  160.  
  161.  
  162. %Compile rare Stuff
  163. rare_stuff = {};
  164. cl1 = 1;
  165. Id_c1 = zeros(1,length(h_rare));
  166.  
  167.  
  168. for k = 1:(h_rare)
  169.    
  170.    
  171.    
  172.      next1 = randi(rare_len,1);
  173.      item = rare(next1,:);
  174.      tester = 0;
  175.      
  176.      while tester < 1
  177.      
  178.          
  179.      test_me = 0;
  180.      id = cell2mat(item(1));
  181.      
  182.      for j = 1:cl1
  183.          xtex = id == Id_c1(j);
  184.         if xtex == 1
  185.              test_me = 1;
  186.         end
  187.      end
  188.      
  189.  
  190.      
  191.      if test_me == 0
  192.          Id_c1(cl1+1) = id;
  193.          rare_stuff(cl1,:) = rare(next1,:);
  194.          cl1 = cl1+1;
  195.          tester = 2;
  196.        
  197.      else
  198.          next1 = randi(rare_len,1);
  199.          item = rare(next1,:);
  200.      end    
  201.   end      
  202. end
  203.  
  204. %Compile Ultra_rare Stuff
  205. U_rare_stuff = {};
  206. cl1 = 1;
  207. Id_c1 = zeros(1,length(h_rare));
  208.  
  209.  
  210. for k = 1:(h_U_rare)
  211.    
  212.    
  213.    
  214.      next1 = randi(U_rare_len,1);
  215.      item = U_rare(next1,:);
  216.      tester = 0;
  217.      
  218.      while tester < 1
  219.      
  220.          
  221.      test_me = 0;
  222.      id = cell2mat(item(1));
  223.      
  224.      for j = 1:cl1
  225.          xtex = id == Id_c1(j);
  226.         if xtex == 1
  227.              test_me = 1;
  228.         end
  229.      end
  230.      
  231.  
  232.      
  233.      if test_me == 0
  234.          Id_c1(cl1+1) = id;
  235.          U_rare_stuff(cl1,:) = U_rare(next1,:);
  236.          cl1 = cl1+1;
  237.          tester = 2;
  238.        
  239.      else
  240.          next1 = randi(U_rare_len,1);
  241.          item = U_rare(next1,:);
  242.          
  243.      end
  244.      
  245.   end
  246.      
  247.          
  248.          
  249. end
  250.  
  251. Create_gear = {};
  252. gear_c = 1;
  253.  
  254. for b=1:h_common
  255.     Create_gear(gear_c,:) = Common_stuff(b,:);
  256.     gear_c = gear_c +1;
  257. end
  258.  
  259. for c=1:h_uncommon
  260.     Create_gear(gear_c,:) = unCommon_stuff(c,:);
  261.     gear_c = gear_c +1;
  262. end
  263.  
  264. for d=1:h_rare
  265.     Create_gear(gear_c,:) = rare_stuff(d,:);
  266.     gear_c = gear_c +1;
  267. end
  268.  
  269. if Type == 2||3
  270.     for e=1:h_U_rare
  271.         Create_gear(gear_c,:) = U_rare_stuff(e,:);
  272.         gear_c = gear_c +1;
  273.     end
  274. end
  275.  
  276. end
  277.   gear = Create_gear;
  278.   Final_set = {};
  279.   s2 = 'Armor';
  280.   s3 = 'Saddle';
  281.   s4 = 'Weapons';
  282.  
  283.   for i = 1:10
  284.       Final_set(i,1:2) = gear(i,1:2);
  285.       Test = strcmp(char(gear(i,3)),s2)||strcmp(char(gear(i,3)),s3)||strcmp(char(gear(i,3)),s4);
  286.       if Test
  287.           Quality = randi(7,1);
  288.       else
  289.           Quality = 1;
  290.       end
  291.       if strcmp(char(gear(i,3)),s2) == 1
  292.           Quantity = num2cell(randi(3,1));
  293.       else
  294.           Quantity = num2cell(randi(cell2mat(gear(i,4)),1));
  295.       end
  296.       Final_set(i,3) = Quantity;    
  297.       Final_set(i,4) = num2cell(Quality);
  298.      
  299.   end
  300.  %Compile Final Set for Print
  301.  
  302.  Final_gear = {};
  303.  
  304.  for i = 1:10
  305.      id_is = cell2mat(Final_set(i,1));
  306.      quan = cell2mat(Final_set(i,3));
  307.      qual = cell2mat(Final_set(i,4));
  308.      if  cell2mat(Final_set(i,1)) <= 437
  309.          Final_gear{i} = sprintf('cheat GiveItemNum %d %d %d 0',id_is,quan,qual);
  310.      else
  311.          set_id = char(Data(id_is,6));
  312.          Final_gear{i} = sprintf('cheat GiveItem %s %d %d 0',set_id,quan,qual);
  313.      end
  314.    
  315.  end
  316.      
  317.          
  318. for i = 1:10
  319.     disp(Final_gear{i})
  320. end
  321.  
  322.  
  323. %%Make Crate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement