TGAM123

BetterLoot Rust Tutorial

Apr 21st, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.51 KB | None | 0 0
  1. LegBend:
  2. I find it disappointing that you won't explain to people how to do this, "cannot be extended with ease". Actually it can be extended with ease, the only uneasy thing about this process is that it's lengthy and repetitive.
  3.  
  4. First thing you need to know, what crates match the crates in-game (most of which are self explanatory):
  5.  
  6. "bradley_crate" - Loot from Bradley APC
  7. "crate_basic" - Loot from Primitive Boxes (The small wooden boxes found by gas/pumping stations)
  8. "crate_elite" - Loot from Elite Crates
  9. "crate_mine"- Loot from Mining Carts
  10. "crate_normal"- Loot from Military Crates
  11. "crate_normal_2"- Loot from the Standard Crates you will normally find on the road and inside many monuments
  12. "crate_normal_2_food"- Loot from the bigger Food Crates (Identified by the picture of a knife and fork on the side)
  13. "crate_normal_2_medical"- Loot from the Medical Crates (Identified by medical cross on the side)
  14. "crate_tools"- Loot from Toolboxes
  15. "foodbox"- Loot from the much smaller Food Crates
  16. "heli_crate"- Loot from Helicopter Crates
  17. ----------------
  18. "loot_barrel_1" (Haven't as of yet played around with the barrels to give them an identity)
  19. "loot_barrel_2"
  20. ----------------
  21.  
  22. For me this was half of the battle.
  23. Now there are two major things that you need to do;-
  24. - Number one you must add lines of code according to the crate you're trying to create a seperate loot table for within the BetterLoot.cs config.
  25. Here are some examples of that (I will be showing you the Elite Crate as an example side by side with the Standard Crate);-
  26. -----------------------------------------------------------------------------------------------------------------------------
  27. Regex eliteEx; //elite crate add
  28. Regex crateEx;
  29. -----------------------------------------------------------------------------------------------------------------------------
  30. int totalItemsC;
  31. int totalItemsE; //elite crate add
  32. -----------------------------------------------------------------------------------------------------------------------------
  33. List<ItemDefinition> originalItemsC;
  34. List<ItemDefinition> originalItemsE; //elite crate add
  35. -----------------------------------------------------------------------------------------------------------------------------
  36. string barrelTypes;
  37. string crateTypes;
  38. string eliteTypes; //Elite crate add
  39. -----------------------------------------------------------------------------------------------------------------------------
  40. bool enableCrates;
  41. bool randomAmountCrates;
  42. int minItemsPerCrate;
  43. int maxItemsPerCrate;
  44. bool enableElite; //elite crate add
  45. bool randomAmountElite; //elite crate add
  46. int minItemsPerElite; //elite crate add
  47. int maxItemsPerElite; //elite crate add
  48. -----------------------------------------------------------------------------------------------------------------------------
  49. bool refreshCrates;
  50. bool refreshElite; //elite crate add
  51. -----------------------------------------------------------------------------------------------------------------------------
  52. minItemsPerCrate = Convert.ToInt32(GetConfig("Crate", "minItemsPerCrate", 3));
  53. maxItemsPerCrate = Convert.ToInt32(GetConfig("Crate", "maxItemsPerCrate", 6));
  54. refreshCrates = Convert.ToBoolean(GetConfig("Crate", "refreshCrates", true));
  55. crateTypes = Convert.ToString(GetConfig("Crate", "crateTypes", "crate_normal|crate_tools"));
  56. enableCrates = Convert.ToBoolean(GetConfig("Crate", "enableCrates", true));
  57. randomAmountCrates = Convert.ToBoolean(GetConfig("Crate", "randomAmountCrates", true));
  58.  
  59. //Start Elite json add
  60. minItemsPerElite = Convert.ToInt32(GetConfig("Elite", "minItemsPerElite", 3));
  61. maxItemsPerElite = Convert.ToInt32(GetConfig("Elite", "maxItemsPerElite", 6));
  62. refreshElite = Convert.ToBoolean(GetConfig("Elite", "refreshElite", true));
  63. eliteTypes = Convert.ToString(GetConfig("Elite", "eliteTypes", "crate_elite"));
  64. enableElite = Convert.ToBoolean(GetConfig("Elite", "enableElite", true));
  65. randomAmountElite = Convert.ToBoolean(GetConfig("Elite", "randomAmountElite", true));
  66. //End Elite json add
  67. -----------------------------------------------------------------------------------------------------------------------------
  68. originalItemsC = new List<ItemDefinition>();
  69. originalItemsE = new List<ItemDefinition>(); //Elite Crate Add
  70. -----------------------------------------------------------------------------------------------------------------------------
  71. else if (crateEx.IsMatch(container.gameObject.name.ToLower()) && enableCrates)
  72. {
  73. SuppressRefresh(container);
  74. ClearContainer(container);
  75. min = minItemsPerCrate;
  76. max = maxItemsPerCrate;
  77. if (seperateLootTables)
  78. type = "crate";
  79. else
  80. type = "default";
  81. refresh = refreshCrates;
  82. }
  83.  
  84. else if (eliteEx.IsMatch(container.gameObject.name.ToLower()) && enableElite) //Elite Crate Add
  85. {
  86. SuppressRefresh(container);
  87. ClearContainer(container);
  88. min = minItemsPerElite;
  89. max = maxItemsPerElite;
  90. if (seperateLootTables)
  91. type = "elite";
  92. else
  93. type = "default";
  94. refresh = refreshCrates;
  95. } //Elite Crate Add Stop
  96. -----------------------------------------------------------------------------------------------------------------------------
  97. Hopefully these examples give you the right idea, there are more lines of code that you need to add but this should help you get your bearings, it's much simpler than it seems as the code is right there infront of you, all you need to do is copy it (I would advise rewriting and not copying and pasting) and change names accordingly, also triple check your codes once you have written them.
  98.  
  99. eliteTypes = Convert.ToString(GetConfig("Elite", "eliteTypes", "crate_elite"));
  100.  
  101. "crate_elite" this is what will link to the crates you see ingame. "Elite" and "elite" are versatile as you're the one creating them. If you so wished you could call them "Chicken" and "chicken" but don't do that, keep it relevant for the crate you're adding "Tools" "tools" "Meds" "meds" ect ect...
  102.  
  103. The lines appear by the letter 'originalItemsE' are also versatile to your preference but again keep them relative and make sure you don't have 2 of the same letter.
  104.  
  105. int totalItemsB;
  106. int totalItemsC;
  107. int totalItemsE; //elite crate add
  108. int totalItemsM; //Military Crate add
  109. int totalItemsR; //Bradley crate add
  110. int totalItemsT; //Tool crate add
  111. int totalItemsP; //Primative crate add
  112.  
  113. Here you can see for Bradley I use the letter R, as B is already used by Barrels.
  114.  
  115. Now all that's left for you to do is add the itemlists into the LootTable.JSON (Supply Drops and Heli Crates have a seperate .JSON as you more than likely already know. You don't need to do any of this for Supply Drops or Heli)
  116.  
  117. Here is a ridiculously bad loot table just to show you what it should end up looking like with a few crates added:-
  118.  
  119. {
  120. "ItemListBarrels": {
  121. "antiradpills": 5,
  122. "apple": 4,
  123. "blueberries": 1,
  124. },
  125. "ItemListCrates": {
  126. "ammo.rocket.basic": 1,
  127. "ammo.rocket.hv": 1,
  128. "ammo.rocket.fire": 1,
  129. },
  130. "ItemListElite": {
  131. "autoturret": 1,
  132. "explosives": 1,
  133. "explosive.timed": 1,
  134. "rocket.launcher": 1,
  135. "hazmatsuit_scientist": 1,
  136. },
  137. "ItemListMil": {
  138. "rifle.ak": 1,
  139. "smg.thompson": 1,
  140. "barricade.stone": 1,
  141. "pistol.semiauto": 1,
  142. "pistol.python": 1,
  143. },
  144. "ItemListBrad": {
  145. "explosive.timed": 2,
  146. "rifle.ak": 3,
  147. "rocket.launcher": 2,
  148. "smg.mp5": 3,
  149. "shotgun.spas12": 4,
  150. "lmg.m249": 10,
  151. "pistol.m92": 4,
  152. "rifle.lr300": 2,
  153. },
  154. "ItemListTool": {
  155. "chainsaw": 10,
  156. },
  157. "ItemListPrim": {
  158. "arrow.bone": 10,
  159. }
  160. }
  161.  
  162. I apologize if I haven't explained this very well, just trying to summarize for everyone without droning on.
  163. If anyone needs help with this contact me through steam, I'll be willing to further explain.
Advertisement
Add Comment
Please, Sign In to add comment