Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- ###########
- QRR eLF's program! No stealing without credit!!!!!!!!
- ###########
- # [name] [weight]
- #weight 0-10. Lower is more rare.
- weapons = """
- Lanternbox 6 obj
- Spyglassbox 6 obj
- Knife_Variation1 5 wep
- Dagger_Variation1 5 wep
- BearingFlagBritish 4 wep
- CannonRamRod 4 wep
- Cutlass_1804PatternNaval 4 wep
- Carpenter_Adze 4 wep
- Axe2H_Variation1 4 wep
- Carbine_Elliot 2 wep
- Pistol_XIII 2 wep
- Musket_CharlevilleIXXII 1.5 wep
- Rifle_CharlevilleDragoonPattern_NoBayonet 1 wep
- Blunderbuss_Variation1 1 wep
- Carbine_Elliot 1 ammo
- Pistol_XIII 1 ammo
- Musket_CharlevilleIXXII 1 ammo
- Rifle_CharlevilleDragoonPattern_NoBayonet 0.5 ammo
- Blunderbuss_Variation1 0.5 ammo
- Rocket 0.5 obj
- Swivlegun_Stand 0.3 obj
- CannonFieldGun9PDRMoveable 0.1 obj"""
- lowPriorityPoints = """
- -2774.32 208.55 -1538.24 0.00 139.03 0.00
- -2778.75 208.27 -1552.50 0.00 208.07 0.00
- -2785.31 208.44 -1560.65 0.00 220.54 0.00
- -2782.58 211.36 -1574.08 0.00 130.22 0.00
- -2777.34 216.27 -1578.87 0.00 125.92 0.00
- -2768.25 219.63 -1574.36 0.00 95.64 0.00
- -2759.64 219.28 -1570.66 0.00 40.81 0.00
- -2750.41 219.00 -1556.01 0.00 30.78 0.00
- -2736.90 218.97 -1547.40 0.00 78.67 0.00
- -2739.24 216.63 -1535.74 0.00 330.36 0.00
- -2745.31 213.16 -1525.50 0.00 315.89 0.00
- -2748.34 213.16 -1533.69 0.00 192.35 0.00
- -2744.89 213.95 -1545.05 0.00 120.55 0.00
- -2751.24 213.95 -1558.43 0.00 203.98 0.00
- -2756.27 213.95 -1563.76 0.00 246.15 0.00
- -2760.46 213.96 -1578.22 0.00 199.54 0.00
- -2742.05 213.95 -1585.91 0.00 117.59 0.00
- -2748.92 208.79 -1599.31 0.00 197.49 0.00
- -2745.95 208.97 -1604.51 0.00 131.99 0.00
- -2740.79 208.73 -1593.58 0.00 25.73 0.00
- -2735.98 208.52 -1583.59 0.00 24.83 0.00
- -2745.10 208.52 -1579.31 0.00 296.64 0.00
- -2748.92 208.52 -1568.39 0.00 350.25 0.00
- -2758.18 208.52 -1562.07 0.00 307.31 0.00
- -2766.48 208.52 -1557.80 0.00 300.88 0.00
- -2740.89 208.52 -1555.18 0.00 30.74 0.00
- -2724.03 209.73 -1559.87 0.00 111.61 0.00
- -2718.78 209.97 -1573.86 0.00 193.24 0.00
- -2727.33 208.69 -1585.99 0.00 223.97 0.00
- -2715.03 209.37 -1559.25 0.00 23.25 0.00
- -2726.41 213.95 -1553.30 0.00 299.17 0.00
- -2713.18 213.95 -1559.19 0.00 120.31 0.00
- -2697.03 213.87 -1566.65 0.00 120.31 0.00
- -2699.98 213.88 -1559.96 0.00 2.49 0.00
- -2703.10 213.88 -1556.67 0.00 231.61 0.00
- -2686.37 210.86 -1563.04 0.00 4.06 0.00
- -2696.97 209.69 -1561.18 0.00 267.77 0.00
- -2700.95 209.43 -1575.60 0.00 202.98 0.00
- -2683.25 209.17 -1569.81 0.00 73.78 0.00
- -2712.94 209.69 -1574.47 0.00 223.42 0.00
- -2720.44 209.69 -1590.41 0.00 202.98 0.00
- -2709.64 207.66 -1594.64 0.00 102.83 0.00
- -2710.68 207.66 -1599.50 0.00 218.02 0.00
- -2722.20 209.69 -1595.77 0.00 188.06 0.00
- -2700.36 202.15 -1587.37 0.00 17.59 0.00
- -2694.10 202.14 -1579.90 0.00 19.91 0.00
- -2690.84 198.90 -1603.59 0.00 130.46 0.00
- -2694.49 198.90 -1605.38 0.00 247.45 0.00
- -2695.83 202.14 -1585.25 0.00 359.81 0.00
- -2694.46 202.14 -1574.00 0.00 359.81 0.00
- -2686.83 210.86 -1564.22 0.00 129.27 0.00
- -2690.57 213.87 -1570.17 0.00 288.94 0.00
- -2692.87 218.56 -1561.51 0.00 272.77 0.00
- -2681.89 224.94 -1569.80 0.00 118.37 0.00
- -2695.43 224.94 -1559.25 0.00 283.99 0.00
- -2708.64 226.33 -1569.56 0.00 223.70 0.00
- -2703.61 221.99 -1587.32 0.00 180.37 0.00
- -2721.66 225.30 -1597.28 0.00 292.99 0.00 ]
- -2741.63 208.52 -1572.98 0.00 330.04 0.00
- -2735.04 208.52 -1562.19 0.00 81.50 0.00
- -2724.30 208.52 -1571.56 0.00 201.19 0.00
- -2732.96 208.52 -1577.57 0.00 274.08 0.00
- -2733.81 208.52 -1570.05 0.00 212.21 0.00
- -2737.71 208.52 -1571.11 0.00 132.76 0.00
- -2730.85 210.50 -1574.21 0.00 114.89 0.00
- -2732.34 211.97 -1568.86 0.00 294.52 0.00
- -2729.26 211.90 -1562.53 0.00 28.37 0.00
- -2739.89 211.90 -1563.45 0.00 231.27 0.00
- -2736.76 211.90 -1576.37 0.00 120.32 0.00
- -2724.61 211.90 -1571.80 0.00 27.63 0.00
- -2733.90 213.40 -1572.90 0.00 96.06 0.00
- -2732.86 215.34 -1568.37 0.00 288.03 0.00
- -2730.53 215.36 -1564.14 0.00 21.88 0.00
- -2741.95 215.36 -1567.42 0.00 201.25 0.00
- -2735.04 215.36 -1577.01 0.00 114.35 0.00
- -2724.39 215.36 -1567.26 0.00 324.06 0.00
- -2733.40 216.61 -1572.97 0.00 100.11 0.00
- -2732.52 219.90 -1567.73 0.00 356.40 0.00
- -2730.56 219.82 -1563.08 0.00 356.91 0.00
- -2740.66 219.82 -1567.72 0.00 213.70 0.00
- -2733.14 219.82 -1576.81 0.00 109.57 0.00
- -2720.47 219.02 -1578.91 0.00 113.55 0.00
- -2715.09 218.61 -1580.64 0.00 104.38 0.00
- -2711.56 218.60 -1574.40 0.00 34.06 0.00
- -2706.51 218.60 -1564.04 0.00 50.13 0.00
- -2699.11 218.56 -1562.28 0.00 120.83 0.00
- -2694.06 218.56 -1565.77 0.00 121.73 0.00
- -2686.39 217.91 -1563.45 0.00 112.73 0.00
- -2684.01 213.87 -1572.14 0.00 229.33 0.00
- -2701.64 213.87 -1564.22 0.00 293.36 0.00
- -2703.49 213.87 -1571.55 0.00 195.65 0.00
- -2710.53 213.87 -1583.75 0.00 204.13 0.00
- -2710.58 213.87 -1588.05 0.00 241.16 0.00
- -2714.27 213.95 -1575.08 0.00 301.71 0.00
- -2723.21 213.95 -1593.69 0.00 209.27 0.00
- -2737.67 213.95 -1588.19 0.00 298.36 0.00
- -2731.93 211.82 -1594.98 0.00 107.97 0.00
- -2735.34 211.90 -1600.38 0.00 208.50 0.00
- -2706.94 213.87 -1577.49 0.00 72.83 0.00
- -2698.85 213.88 -1559.63 0.00 20.95 0.00
- -2686.76 210.86 -1563.11 0.00 5.43 0.00
- -2723.45 219.11 -1554.13 0.00 147.27 0.00
- -2710.02 213.95 -1568.78 0.00 201.69 0.00
- -2763.93 208.86 -1596.52 0.00 311.64 0.00
- -2775.08 209.34 -1584.69 0.00 353.16 0.00
- -2768.46 210.69 -1577.68 0.00 45.49 0.00
- -2767.69 210.69 -1584.21 0.00 38.67 0.00
- -2761.12 210.69 -1585.84 0.00 131.75 0.00
- -2754.34 210.69 -1588.06 0.00 128.66 0.00
- -2751.35 210.69 -1590.02 0.00 33.14 0.00
- -2755.80 209.32 -1595.06 0.00 222.86 0.00
- -2782.59 206.88 -1593.34 0.00 82.50 0.00
- -2763.91 219.40 -1588.67 0.00 346.07 0.00
- -2753.81 219.35 -1587.35 0.00 83.78 0.00
- -2744.09 219.04 -1591.34 0.00 98.18 0.00
- -2731.81 218.73 -1591.25 0.00 89.05 0.00
- -2721.71 225.73 -1595.70 0.00 66.55 0.00
- -2711.60 226.18 -1582.05 0.00 33.00 0.00
- -2697.84 222.83 -1573.92 0.00 56.52 0.00
- -2705.16 225.64 -1556.95 0.00 318.05 0.00
- -2765.35 208.13 -1528.97 0.00 10.40 0.00
- -2760.05 202.94 -1550.98 0.00 145.64 0.00
- -2775.06 203.10 -1570.76 0.00 226.51 0.00
- -2787.43 202.88 -1584.30 0.00 220.85 0.00
- -2755.05 208.52 -1564.67 0.00 113.34 0.00
- -2741.55 208.52 -1547.31 0.00 272.78 0.00
- -2738.65 209.18 -1540.94 0.00 90.71 0.00
- -2745.61 209.18 -1530.16 0.00 326.78 0.00
- -2742.41 209.18 -1538.58 0.00 206.67 0.00
- -2717.31 218.60 -1587.01 0.00 113.04 0.00
- -2722.70 217.64 -1595.99 0.00 150.96 0.00
- -2730.66 215.36 -1580.46 0.00 275.72 0.00
- -2731.41 211.90 -1579.14 0.00 256.09 0.00
- """
- ###########
- QRR eLF's program! No stealing without credit!!!!!!!!
- ###########
- # chance that the object spawns in. 0.4 => 40%
- lowPrioritySpawnChance = 1
- #additional chance that an object spawns. 0.01 => 1%
- lowPriorityLootWeight = 0.01
- #Distance loot boost. 0.01 => 1%
- distanceLootWeight = 0.01
- #weapons on racks
- weaponsOnRacks = 2
- shotsPerAmmoBox = 2
- shotsPerAmmoBoxInteration = 1
- maximumAmmoBoxInteractions = 2
- class WeaponBank():
- currentMin = 0
- def __init__(self, weaponID, weight, weightSum, weaponType):
- self.id = weaponID
- self.min = WeaponBank.currentMin
- self.max = WeaponBank.currentMin + weight / weightSum
- WeaponBank.currentMin = self.max
- self.type = weaponType
- def __str__(self):
- string = "type = "+self.id+"\n min ="+str(self.min)+"\n max = "+str(self.max)+"\n type = "+self.type
- return string
- def generateString(self,point):
- if (self.type == "obj"):
- string = "objects_override "+self.id + " " + point.toString()
- elif (self.type == "wep"):
- string = "objects_override WeaponRack " + point.toString() + " " + self.id +" " + str(weaponsOnRacks)
- elif (self.type == "ammo"):
- string = "objects_override firearmammobox " + point.toString()+ " " + self.id + " " + str(shotsPerAmmoBoxInteration) + " " + str(shotsPerAmmoBox) + " " + str(maximumAmmoBoxInteractions)
- return string
- class Point():
- def __init__(self, x , y ,z ,rx , ry , rz):
- self.x = x
- self.y = y
- self.z = z
- self.rx = rx
- self.ry = ry
- self.rz = rz
- def __str__(self):
- string = self.x + " " + self.y + " " + self.z + " " + self.rx + " " + self.ry + " " + self.rz
- return string
- def toString(self):
- string = self.x + " " + self.y + " " + self.z + " " + self.rx + " " + self.ry + " " + self.rz
- return string
- WeaponArray = []
- PointArray = []
- def generateWeapons(weapons):
- weightMax = getWeightMax(weapons)
- for line in weapons.strip("\n").split("\n"):
- lineArray = line.split(" ")
- itemId = lineArray[0]
- itemWeight = float(lineArray[1])
- itemType = lineArray[2]
- WeaponArray.append(WeaponBank(itemId , itemWeight, weightMax, itemType))
- def generatePoints(points):
- for line in points.strip("\n").split("\n"):
- lineArray = line.split(" ")
- PointArray.append(Point(lineArray[0],lineArray[1],lineArray[2],lineArray[3],lineArray[4],lineArray[5]))
- def getWeightMax(weapons):
- counter = 0
- for line in weapons.strip("\n").split("\n"):
- lineArray = line.split(" ")
- counter += float(lineArray[1])
- return counter
- #Checked
- def getObject(weight, WeaponArray):
- for obj in WeaponArray:
- if (obj.min <= weight and obj.max > weight):
- return obj
- return obj
- def main(PointArray, WeaponArray):
- string = ""
- for point in PointArray:
- #print(point)
- if (randomPointGenerate(point)):
- weaponForUse = randomWeaponGenerate(point, WeaponArray)
- #print("weapon",weaponForUse)
- objectString = weaponForUse.generateString(point)
- #print(objectString)
- string = string + objectString + "\n"
- print("Done")
- print(string)
- def randomPointGenerate(point):
- random = randint(1,99) / 100
- #print(random)
- if random <= lowPrioritySpawnChance:
- return True
- return False
- def randomWeaponGenerate(point, WeaponArray):
- random = randint(1,99) / 100
- return getObject(random , WeaponArray)
- generatePoints(lowPriorityPoints)
- generateWeapons(weapons)
- main(PointArray, WeaponArray)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement