Advertisement
logancberrypie

eLF Battle royale

Feb 12th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.08 KB | None | 0 0
  1. from random import randint
  2.  
  3. ###########
  4.  
  5. QRR eLF's program! No stealing without credit!!!!!!!!
  6.  
  7. ###########
  8.  
  9. # [name] [weight]
  10. #weight 0-10. Lower is more rare.
  11. weapons = """
  12. Lanternbox 6 obj
  13. Spyglassbox 6 obj
  14. Knife_Variation1 5 wep
  15. Dagger_Variation1 5 wep
  16. BearingFlagBritish 4 wep
  17. CannonRamRod 4 wep
  18. Cutlass_1804PatternNaval 4 wep
  19. Carpenter_Adze 4 wep
  20. Axe2H_Variation1 4 wep
  21. Carbine_Elliot 2 wep
  22. Pistol_XIII 2 wep
  23. Musket_CharlevilleIXXII 1.5 wep
  24. Rifle_CharlevilleDragoonPattern_NoBayonet 1 wep
  25. Blunderbuss_Variation1 1 wep
  26. Carbine_Elliot 1 ammo
  27. Pistol_XIII 1 ammo
  28. Musket_CharlevilleIXXII 1 ammo
  29. Rifle_CharlevilleDragoonPattern_NoBayonet 0.5 ammo
  30. Blunderbuss_Variation1 0.5 ammo
  31. Rocket 0.5 obj
  32. Swivlegun_Stand 0.3 obj
  33. CannonFieldGun9PDRMoveable 0.1 obj"""
  34.  
  35. lowPriorityPoints = """
  36. -2774.32 208.55 -1538.24 0.00 139.03 0.00
  37. -2778.75 208.27 -1552.50 0.00 208.07 0.00
  38. -2785.31 208.44 -1560.65 0.00 220.54 0.00
  39. -2782.58 211.36 -1574.08 0.00 130.22 0.00
  40. -2777.34 216.27 -1578.87 0.00 125.92 0.00
  41. -2768.25 219.63 -1574.36 0.00 95.64 0.00
  42. -2759.64 219.28 -1570.66 0.00 40.81 0.00
  43. -2750.41 219.00 -1556.01 0.00 30.78 0.00
  44. -2736.90 218.97 -1547.40 0.00 78.67 0.00
  45. -2739.24 216.63 -1535.74 0.00 330.36 0.00
  46. -2745.31 213.16 -1525.50 0.00 315.89 0.00
  47. -2748.34 213.16 -1533.69 0.00 192.35 0.00
  48. -2744.89 213.95 -1545.05 0.00 120.55 0.00
  49. -2751.24 213.95 -1558.43 0.00 203.98 0.00
  50. -2756.27 213.95 -1563.76 0.00 246.15 0.00
  51. -2760.46 213.96 -1578.22 0.00 199.54 0.00
  52. -2742.05 213.95 -1585.91 0.00 117.59 0.00
  53. -2748.92 208.79 -1599.31 0.00 197.49 0.00
  54. -2745.95 208.97 -1604.51 0.00 131.99 0.00
  55. -2740.79 208.73 -1593.58 0.00 25.73 0.00
  56. -2735.98 208.52 -1583.59 0.00 24.83 0.00
  57. -2745.10 208.52 -1579.31 0.00 296.64 0.00
  58. -2748.92 208.52 -1568.39 0.00 350.25 0.00
  59. -2758.18 208.52 -1562.07 0.00 307.31 0.00
  60. -2766.48 208.52 -1557.80 0.00 300.88 0.00
  61. -2740.89 208.52 -1555.18 0.00 30.74 0.00
  62. -2724.03 209.73 -1559.87 0.00 111.61 0.00
  63. -2718.78 209.97 -1573.86 0.00 193.24 0.00
  64. -2727.33 208.69 -1585.99 0.00 223.97 0.00
  65. -2715.03 209.37 -1559.25 0.00 23.25 0.00
  66. -2726.41 213.95 -1553.30 0.00 299.17 0.00
  67. -2713.18 213.95 -1559.19 0.00 120.31 0.00
  68. -2697.03 213.87 -1566.65 0.00 120.31 0.00
  69. -2699.98 213.88 -1559.96 0.00 2.49 0.00
  70. -2703.10 213.88 -1556.67 0.00 231.61 0.00
  71. -2686.37 210.86 -1563.04 0.00 4.06 0.00
  72. -2696.97 209.69 -1561.18 0.00 267.77 0.00
  73. -2700.95 209.43 -1575.60 0.00 202.98 0.00
  74. -2683.25 209.17 -1569.81 0.00 73.78 0.00
  75. -2712.94 209.69 -1574.47 0.00 223.42 0.00
  76. -2720.44 209.69 -1590.41 0.00 202.98 0.00
  77. -2709.64 207.66 -1594.64 0.00 102.83 0.00
  78. -2710.68 207.66 -1599.50 0.00 218.02 0.00
  79. -2722.20 209.69 -1595.77 0.00 188.06 0.00
  80. -2700.36 202.15 -1587.37 0.00 17.59 0.00
  81. -2694.10 202.14 -1579.90 0.00 19.91 0.00
  82. -2690.84 198.90 -1603.59 0.00 130.46 0.00
  83. -2694.49 198.90 -1605.38 0.00 247.45 0.00
  84. -2695.83 202.14 -1585.25 0.00 359.81 0.00
  85. -2694.46 202.14 -1574.00 0.00 359.81 0.00
  86. -2686.83 210.86 -1564.22 0.00 129.27 0.00
  87. -2690.57 213.87 -1570.17 0.00 288.94 0.00
  88. -2692.87 218.56 -1561.51 0.00 272.77 0.00
  89. -2681.89 224.94 -1569.80 0.00 118.37 0.00
  90. -2695.43 224.94 -1559.25 0.00 283.99 0.00
  91. -2708.64 226.33 -1569.56 0.00 223.70 0.00
  92. -2703.61 221.99 -1587.32 0.00 180.37 0.00
  93. -2721.66 225.30 -1597.28 0.00 292.99 0.00 ]
  94. -2741.63 208.52 -1572.98 0.00 330.04 0.00
  95. -2735.04 208.52 -1562.19 0.00 81.50 0.00
  96. -2724.30 208.52 -1571.56 0.00 201.19 0.00
  97. -2732.96 208.52 -1577.57 0.00 274.08 0.00
  98. -2733.81 208.52 -1570.05 0.00 212.21 0.00
  99. -2737.71 208.52 -1571.11 0.00 132.76 0.00
  100. -2730.85 210.50 -1574.21 0.00 114.89 0.00
  101. -2732.34 211.97 -1568.86 0.00 294.52 0.00
  102. -2729.26 211.90 -1562.53 0.00 28.37 0.00
  103. -2739.89 211.90 -1563.45 0.00 231.27 0.00
  104. -2736.76 211.90 -1576.37 0.00 120.32 0.00
  105. -2724.61 211.90 -1571.80 0.00 27.63 0.00
  106. -2733.90 213.40 -1572.90 0.00 96.06 0.00
  107. -2732.86 215.34 -1568.37 0.00 288.03 0.00
  108. -2730.53 215.36 -1564.14 0.00 21.88 0.00
  109. -2741.95 215.36 -1567.42 0.00 201.25 0.00
  110. -2735.04 215.36 -1577.01 0.00 114.35 0.00
  111. -2724.39 215.36 -1567.26 0.00 324.06 0.00
  112. -2733.40 216.61 -1572.97 0.00 100.11 0.00
  113. -2732.52 219.90 -1567.73 0.00 356.40 0.00
  114. -2730.56 219.82 -1563.08 0.00 356.91 0.00
  115. -2740.66 219.82 -1567.72 0.00 213.70 0.00
  116. -2733.14 219.82 -1576.81 0.00 109.57 0.00
  117. -2720.47 219.02 -1578.91 0.00 113.55 0.00
  118. -2715.09 218.61 -1580.64 0.00 104.38 0.00
  119. -2711.56 218.60 -1574.40 0.00 34.06 0.00
  120. -2706.51 218.60 -1564.04 0.00 50.13 0.00
  121. -2699.11 218.56 -1562.28 0.00 120.83 0.00
  122. -2694.06 218.56 -1565.77 0.00 121.73 0.00
  123. -2686.39 217.91 -1563.45 0.00 112.73 0.00
  124. -2684.01 213.87 -1572.14 0.00 229.33 0.00
  125. -2701.64 213.87 -1564.22 0.00 293.36 0.00
  126. -2703.49 213.87 -1571.55 0.00 195.65 0.00
  127. -2710.53 213.87 -1583.75 0.00 204.13 0.00
  128. -2710.58 213.87 -1588.05 0.00 241.16 0.00
  129. -2714.27 213.95 -1575.08 0.00 301.71 0.00
  130. -2723.21 213.95 -1593.69 0.00 209.27 0.00
  131. -2737.67 213.95 -1588.19 0.00 298.36 0.00
  132. -2731.93 211.82 -1594.98 0.00 107.97 0.00
  133. -2735.34 211.90 -1600.38 0.00 208.50 0.00
  134. -2706.94 213.87 -1577.49 0.00 72.83 0.00
  135. -2698.85 213.88 -1559.63 0.00 20.95 0.00
  136. -2686.76 210.86 -1563.11 0.00 5.43 0.00
  137. -2723.45 219.11 -1554.13 0.00 147.27 0.00
  138. -2710.02 213.95 -1568.78 0.00 201.69 0.00
  139. -2763.93 208.86 -1596.52 0.00 311.64 0.00
  140. -2775.08 209.34 -1584.69 0.00 353.16 0.00
  141. -2768.46 210.69 -1577.68 0.00 45.49 0.00
  142. -2767.69 210.69 -1584.21 0.00 38.67 0.00
  143. -2761.12 210.69 -1585.84 0.00 131.75 0.00
  144. -2754.34 210.69 -1588.06 0.00 128.66 0.00
  145. -2751.35 210.69 -1590.02 0.00 33.14 0.00
  146. -2755.80 209.32 -1595.06 0.00 222.86 0.00
  147. -2782.59 206.88 -1593.34 0.00 82.50 0.00
  148. -2763.91 219.40 -1588.67 0.00 346.07 0.00
  149. -2753.81 219.35 -1587.35 0.00 83.78 0.00
  150. -2744.09 219.04 -1591.34 0.00 98.18 0.00
  151. -2731.81 218.73 -1591.25 0.00 89.05 0.00
  152. -2721.71 225.73 -1595.70 0.00 66.55 0.00
  153. -2711.60 226.18 -1582.05 0.00 33.00 0.00
  154. -2697.84 222.83 -1573.92 0.00 56.52 0.00
  155. -2705.16 225.64 -1556.95 0.00 318.05 0.00
  156. -2765.35 208.13 -1528.97 0.00 10.40 0.00
  157. -2760.05 202.94 -1550.98 0.00 145.64 0.00
  158. -2775.06 203.10 -1570.76 0.00 226.51 0.00
  159. -2787.43 202.88 -1584.30 0.00 220.85 0.00
  160. -2755.05 208.52 -1564.67 0.00 113.34 0.00
  161. -2741.55 208.52 -1547.31 0.00 272.78 0.00
  162. -2738.65 209.18 -1540.94 0.00 90.71 0.00
  163. -2745.61 209.18 -1530.16 0.00 326.78 0.00
  164. -2742.41 209.18 -1538.58 0.00 206.67 0.00
  165. -2717.31 218.60 -1587.01 0.00 113.04 0.00
  166. -2722.70 217.64 -1595.99 0.00 150.96 0.00
  167. -2730.66 215.36 -1580.46 0.00 275.72 0.00
  168. -2731.41 211.90 -1579.14 0.00 256.09 0.00
  169. """
  170. ###########
  171.  
  172. QRR eLF's program! No stealing without credit!!!!!!!!
  173.  
  174. ###########
  175.  
  176.  
  177. # chance that the object spawns in. 0.4 => 40%
  178. lowPrioritySpawnChance = 1
  179. #additional chance that an object spawns. 0.01 => 1%
  180. lowPriorityLootWeight = 0.01
  181. #Distance loot boost. 0.01 => 1%
  182. distanceLootWeight = 0.01
  183.  
  184. #weapons on racks
  185. weaponsOnRacks = 2
  186. shotsPerAmmoBox = 2
  187. shotsPerAmmoBoxInteration = 1
  188. maximumAmmoBoxInteractions = 2
  189.  
  190. class WeaponBank():
  191. currentMin = 0
  192. def __init__(self, weaponID, weight, weightSum, weaponType):
  193. self.id = weaponID
  194. self.min = WeaponBank.currentMin
  195. self.max = WeaponBank.currentMin + weight / weightSum
  196. WeaponBank.currentMin = self.max
  197. self.type = weaponType
  198.  
  199. def __str__(self):
  200. string = "type = "+self.id+"\n min ="+str(self.min)+"\n max = "+str(self.max)+"\n type = "+self.type
  201. return string
  202.  
  203. def generateString(self,point):
  204. if (self.type == "obj"):
  205. string = "objects_override "+self.id + " " + point.toString()
  206. elif (self.type == "wep"):
  207. string = "objects_override WeaponRack " + point.toString() + " " + self.id +" " + str(weaponsOnRacks)
  208. elif (self.type == "ammo"):
  209. string = "objects_override firearmammobox " + point.toString()+ " " + self.id + " " + str(shotsPerAmmoBoxInteration) + " " + str(shotsPerAmmoBox) + " " + str(maximumAmmoBoxInteractions)
  210. return string
  211.  
  212.  
  213. class Point():
  214. def __init__(self, x , y ,z ,rx , ry , rz):
  215. self.x = x
  216. self.y = y
  217. self.z = z
  218. self.rx = rx
  219. self.ry = ry
  220. self.rz = rz
  221.  
  222. def __str__(self):
  223. string = self.x + " " + self.y + " " + self.z + " " + self.rx + " " + self.ry + " " + self.rz
  224. return string
  225.  
  226. def toString(self):
  227. string = self.x + " " + self.y + " " + self.z + " " + self.rx + " " + self.ry + " " + self.rz
  228. return string
  229.  
  230.  
  231. WeaponArray = []
  232. PointArray = []
  233. def generateWeapons(weapons):
  234. weightMax = getWeightMax(weapons)
  235. for line in weapons.strip("\n").split("\n"):
  236. lineArray = line.split(" ")
  237. itemId = lineArray[0]
  238. itemWeight = float(lineArray[1])
  239. itemType = lineArray[2]
  240. WeaponArray.append(WeaponBank(itemId , itemWeight, weightMax, itemType))
  241.  
  242. def generatePoints(points):
  243. for line in points.strip("\n").split("\n"):
  244. lineArray = line.split(" ")
  245. PointArray.append(Point(lineArray[0],lineArray[1],lineArray[2],lineArray[3],lineArray[4],lineArray[5]))
  246.  
  247. def getWeightMax(weapons):
  248. counter = 0
  249. for line in weapons.strip("\n").split("\n"):
  250. lineArray = line.split(" ")
  251. counter += float(lineArray[1])
  252. return counter
  253.  
  254.  
  255. #Checked
  256. def getObject(weight, WeaponArray):
  257. for obj in WeaponArray:
  258. if (obj.min <= weight and obj.max > weight):
  259. return obj
  260. return obj
  261.  
  262. def main(PointArray, WeaponArray):
  263. string = ""
  264. for point in PointArray:
  265. #print(point)
  266. if (randomPointGenerate(point)):
  267. weaponForUse = randomWeaponGenerate(point, WeaponArray)
  268. #print("weapon",weaponForUse)
  269. objectString = weaponForUse.generateString(point)
  270. #print(objectString)
  271. string = string + objectString + "\n"
  272. print("Done")
  273. print(string)
  274.  
  275. def randomPointGenerate(point):
  276. random = randint(1,99) / 100
  277. #print(random)
  278. if random <= lowPrioritySpawnChance:
  279. return True
  280. return False
  281.  
  282. def randomWeaponGenerate(point, WeaponArray):
  283. random = randint(1,99) / 100
  284. return getObject(random , WeaponArray)
  285.  
  286. generatePoints(lowPriorityPoints)
  287. generateWeapons(weapons)
  288. main(PointArray, WeaponArray)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement