Guest User

Realistic offroad physics | 1.0.0 config

a guest
Sep 21st, 2023
2,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.48 KB | None | 0 0
  1. Config = {}
  2.  
  3. -- This enabled additional debug commands and logs
  4. -- Debug commands:
  5. -- /surfaceDebug - Displays the surface that the wheel is standing on along with all its configured values
  6. Config.debug = false
  7.  
  8.  
  9. -------------------------------------------------
  10. --- GENERAL SETTINGS
  11. -------------------------------------------------
  12.  
  13. -- By default this script is configured to replicate realistic(ish) values while keeping the gameplay fun and entertaining.
  14. -- If you want to make this script less realistic and more arcady. If your players are getting annoyed and you don't want
  15. -- a realistic handling. Here are the recommended values:
  16. -- generalDepthDifficulty = 25
  17. -- generalSinkageSpeed = 50
  18. -- generalTractionLoss = 50
  19.  
  20. -- General difficulty of the depth handling.
  21. -- 100 = default
  22. -- Lower this value to make driving in deep surfaces (such as mud or deep sand) easier for ALL vehicles
  23. -- Raise this value to make driving in deep surfaces more difficult
  24. Config.generalDepthDifficulty = 100
  25.  
  26. -- General speed of the vehicle sinking into the surface
  27. -- 100 = Default
  28. -- Lower this value to make all vehicles sink slower
  29. -- Raise this value to make all vehicles sink faster
  30. Config.generalSinkageSpeed = 100
  31.  
  32. -- General loss of traction based on vehicle surface
  33. -- Vehicles will be more likely to skid on low traction surfaces
  34. -- Lower this value to decrease the general traction loss (make vehicles drift less on slippery surfaces)
  35. -- Raise this value to make vehicles lose more traction on slippery surfaces (make vehicles drift more on slippery surfaces)
  36. Config.generalTractionLoss = 100
  37.  
  38.  
  39.  
  40. -------------------------------------------------
  41. --- VEHICLE MODIFIERS
  42. -------------------------------------------------
  43.  
  44. -- Changes that offroad tires will make.
  45. -- upgradeValue = value of how much better the vehicle should perform when deep in a surface (mud, sand, etc.)
  46. -- tractionOnSoft = Additional traction when on materials of softness that's more than 10
  47. -- tractionOnHard = Additional (in default case negative) traction on hard materials (softness less than 10)
  48. Config.offroadTires = {
  49.     upgradeValue = 50,
  50.     tractionOnSoft = 20,
  51.     tractionOnHard = -10,
  52. }
  53.  
  54. -- Handling upgrade in deep surface for AWD (4WD) vehicles
  55. Config.awdUpgrade = 25
  56.  
  57.  
  58.  
  59. -------------------------------------------------
  60. --- SCRIPT PERFORMANCE SETTINGS
  61. -------------------------------------------------
  62.  
  63. -- The refresh rate of all the sinking/surface logic. The higher the value the less smoother the visuals but better script performance.
  64. -- If your server is known for players with slower devices you might want to turn this up
  65. -- If your players have better computers or you really want the off-roading to look good try turning it down
  66. -- Values between 100 - 500
  67. Config.refreshRate = 200
  68.  
  69.  
  70.  
  71. -------------------------------------------------
  72. --- DETAILED SETTINGS
  73. -------------------------------------------------
  74.  
  75. -- If you define a model specific multiplier it will be used instead of the class multiplier
  76. -- Vehicle classes https://docs.fivem.net/natives/?_0x29439776AAA00A62
  77. -- Abstract value - Determines how well the class or model of the vehicle can handle being submerged in the surface
  78. -- 0 = Default
  79. -- Positive values = Better handling / ability to get out of deep surface
  80. -- Negative values = Worse handling / less ability to get out of deep surface
  81. Config.depthHandlingQuality = {
  82.     models = {
  83.         seminole2 = 20,
  84.         sandking = 20,
  85.         sandking2 = 20,
  86.         issi2 = -10,
  87.         panto = -20,
  88.         comet4 = 30,
  89.  
  90.         -- dirt bikes
  91.         bf400 = 30,
  92.         sanchez = 20,
  93.         manchez = 20,
  94.         esskey = 0,
  95.         cliffhanger = 0,
  96.         enduro = 0,
  97.     },
  98.     classes = {
  99.         [0] = 5, -- Compacts
  100.         [1] = -5, -- Sedans
  101.         [2] = 15, -- SUVs
  102.         [3] = 0, -- Coupes
  103.         [4] = -5, -- Muscle
  104.         [5] = 5, -- Sports Classics
  105.         [6] = 5, -- Sports
  106.         [7] = 5, -- Super
  107.         [8] = -10, -- Motorcycles
  108.         [9] = 35, -- Off-road
  109.         [10] = -10, -- Industrial
  110.         [11] = -10, -- Utility
  111.         [12] = -5, -- Vans
  112.         [17] = 10, -- Service
  113.         [18] = 10, -- Emergency
  114.         [19] = 15, -- Military
  115.         [20] = -5, -- Commercial
  116.     }
  117. }
  118.  
  119. --- SURFACES
  120. -- name = Only used for the ease of config as well as the debug mode
  121. -- traction = Amount of traction on the surface. Anything below 100 will make the vehicles skid. Lower value = more skid
  122. -- Maximum 100
  123. -- Minimum 0
  124.  
  125. -- depth = Maximum depth of the surface in mm (millimeter) - (100mm = +-4 inches)
  126. -- Maximum infinite
  127. -- Minimum 0
  128.  
  129. -- softness = The softness of the material. This dictates how fast the vehicles will sink into the surface. (This is also used for off-road tires to decide their handling boost
  130. -- Maximum infinite
  131. -- Minimum 0
  132.  
  133. -- Values which will be assigned to all un-configured surfaces
  134. Config.fallbackSurface = {
  135.     name = 'Fallback Surface',
  136.     traction = 100,
  137.     depth = 0,
  138.     softness = 0,
  139. }
  140.  
  141. Config.surfaces = {
  142.     [1] = {
  143.         name = 'Concrete',
  144.         traction = 100,
  145.         depth = 0,
  146.         softness = 0,
  147.     },
  148.     [4] = {
  149.         name = 'Road',
  150.         traction = 100,
  151.         depth = 0,
  152.         softness = 0,
  153.     },
  154.     [5] = {
  155.         name = 'Metal',
  156.         traction = 100,
  157.         depth = 0,
  158.         softness = 0,
  159.     },
  160.     [6] = {
  161.         name = 'Sandy roadside',
  162.         traction = 80,
  163.         depth = 50,
  164.         softness = 5,
  165.     },
  166.     [9] = {
  167.         name = 'Sandstone',
  168.         traction = 80,
  169.         depth = 0,
  170.         softness = 0,
  171.     },
  172.     [10] = {
  173.         name = 'Rock',
  174.         traction = 80,
  175.         depth = 0,
  176.         softness = 0,
  177.     },
  178.     [11] = {
  179.         name = 'Rock',
  180.         traction = 80,
  181.         depth = 0,
  182.         softness = 0,
  183.     },
  184.     [13] = {
  185.         name = 'Cobble',
  186.         traction = 90,
  187.         depth = 0,
  188.         softness = 0,
  189.     },
  190.     [16] = {
  191.         name = 'Limestoneesque sand',
  192.         traction = 80,
  193.         depth = 0,
  194.         softness = 0,
  195.     },
  196.     [17] = {
  197.         name = 'Rocky dry dirt',
  198.         traction = 80,
  199.         depth = 50,
  200.         softness = 5,
  201.     },
  202.     [18] = {
  203.         name = 'Dry sand',
  204.         traction = 80,
  205.         depth = 130,
  206.         softness = 40,
  207.     },
  208.     [19] = {
  209.         name = 'Road sand',
  210.         traction = 90,
  211.         depth = 30,
  212.         softness = 5,
  213.     },
  214.     [20] = {
  215.         name = 'Grainy Sand',
  216.         traction = 80,
  217.         depth = 100,
  218.         softness = 10,
  219.     },
  220.     [21] = {
  221.         name = 'Gravely sand',
  222.         traction = 70,
  223.         depth = 220,
  224.         softness = 30,
  225.     },
  226.     [22] = {
  227.         name = 'Wet hard sand',
  228.         traction = 70,
  229.         depth = 250,
  230.         softness = 50,
  231.     },
  232.     [23] = {
  233.         name = 'Gravel road',
  234.         traction = 75,
  235.         depth = 50,
  236.         softness = 5,
  237.     },
  238.     [24] = {
  239.         name = 'Wet sand',
  240.         traction = 60,
  241.         depth = 350,
  242.         softness = 70,
  243.     },
  244.     [31] = {
  245.         name = 'Gravely dirt/path',
  246.         traction = 70,
  247.         depth = 50,
  248.         softness = 5,
  249.     },
  250.     [32] = {
  251.         name = 'Gravely dirt',
  252.         traction = 70,
  253.         depth = 200,
  254.         softness = 15,
  255.     },
  256.     [35] = {
  257.         name = 'Tuff Sand',
  258.         traction = 90,
  259.         depth = 50,
  260.         softness = 5,
  261.     },
  262.     [36] = {
  263.         name = 'Dirt',
  264.         traction = 70,
  265.         depth = 300,
  266.         softness = 40,
  267.     },
  268.     [37] = {
  269.         name = 'Deep road sand',
  270.         traction = 60,
  271.         depth = 75,
  272.         softness = 15,
  273.     },
  274.     [38] = {
  275.         name = 'Rocky sand',
  276.         traction = 70,
  277.         depth = 150,
  278.         softness = 10,
  279.     },
  280.     [40] = {
  281.         name = 'Moist dirt path',
  282.         traction = 60,
  283.         depth = 150,
  284.         softness = 50,
  285.     },
  286.     [41] = {
  287.         name = 'Swamp grass',
  288.         traction = 50,
  289.         depth = 250,
  290.         softness = 50,
  291.     },
  292.     [42] = {
  293.         name = 'Swamp sand',
  294.         traction = 70,
  295.         depth = 500,
  296.         softness = 110,
  297.     },
  298.     [43] = {
  299.         name = 'Hard Sand',
  300.         traction = 75,
  301.         depth = 50,
  302.         softness = 10,
  303.     },
  304.     [44] = {
  305.         name = 'Dirt/Sand',
  306.         traction = 50,
  307.         depth = 200,
  308.         softness = 25,
  309.     },
  310.     [46] = {
  311.         name = 'Hard grass',
  312.         traction = 80,
  313.         depth = 50,
  314.         softness = 5,
  315.     },
  316.     [47] = {
  317.         name = 'Grass',
  318.         traction = 65,
  319.         depth = 125,
  320.         softness = 10,
  321.     },
  322.     [48] = {
  323.         name = 'Tall grass',
  324.         traction = 60,
  325.         depth = 150,
  326.         softness = 20,
  327.     },
  328.     [49] = {
  329.         name = 'Farmland',
  330.         traction = 60,
  331.         depth = 200,
  332.         softness = 35,
  333.     },
  334.     [50] = {
  335.         name = 'Podzol',
  336.         traction = 70,
  337.         depth = 125,
  338.         softness = 25,
  339.     },
  340.     [51] = {
  341.         name = 'Podzol',
  342.         traction = 70,
  343.         depth = 125,
  344.         softness = 25,
  345.     },
  346.     [52] = {
  347.         name = 'Dry podzol',
  348.         traction = 80,
  349.         depth = 75,
  350.         softness = 10,
  351.     },
  352.     [64] = {
  353.         name = 'Metal',
  354.         traction = 90,
  355.         depth = 0,
  356.         softness = 0,
  357.     },
  358.     [125] = {
  359.         name = 'Drain concrete',
  360.         traction = 70,
  361.         depth = 0,
  362.         softness = 0,
  363.     },
  364. }
  365.  
  366.  
  367. -- Zone multiplier
  368. -- This has been added to modify the maximum depth of all surfaces located within zones.
  369. -- Its used to make grass located (for example) in the city less deep to make it more realistic and easier to drive on.
  370. -- If you have popular areas in your city in which you want the off-roading (think of road medians etc.) to be easier you can add the zone here.
  371. -- Same goes for areas which you want to be more difficult. You can make the depth multiplier higher for those
  372.  
  373. -- You can view the zone you're in by using the debug command /surfaceDebug
  374.  
  375. -- Map of zones: https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2F5cw11krz9kcz.jpg
  376. -- Zone names and hashes: https://docs.fivem.net/natives/?_0xCD90657D4C30E1CA
  377.  
  378. Config.zones = {
  379.     {
  380.         name = 'City',
  381.         depthMultiplier = 0.3,
  382.         zones = {
  383.             'MOVIE',
  384.             'ROCKF',
  385.             'DOWNT',
  386.             'DTVINE',
  387.             'EAST_V',
  388.             'GOLF',
  389.             'LEGSQU',
  390.             'ROCKF',
  391.             'MORN',
  392.             'STAD',
  393.             'DAVIS',
  394.             'RANCHO',
  395.             'STRAW',
  396.             'CHAMH',
  397.             'PBOX',
  398.             'SKID',
  399.             'TEXTI',
  400.             'LMESA',
  401.             'ELYSIAN',
  402.             'TERMINA',
  403.             'HAWICK',
  404.             'ALTA',
  405.             'BURTON',
  406.             'DELPE',
  407.         },
  408.     },
  409.     {
  410.         name = 'City beaches',
  411.         depthMultiplier = 0.75,
  412.         zones = {
  413.             'BEACH',
  414.             'DELBE',
  415.         },
  416.     },
  417.     {
  418.         name = 'Mountains',
  419.         depthMultiplier = 1.25,
  420.         zones = {
  421.             'MTCHIL',
  422.             'MTGORDO',
  423.             'MTJOSE',
  424.             'PALHIGH',
  425.         },
  426.     },
  427.     {
  428.         name = 'Zancudo Swamp',
  429.         depthMultiplier = 1.1,
  430.         zones = {
  431.             'LAGO',
  432.             'ZANCUDO',
  433.         },
  434.     },
  435.     {
  436.         name = 'Popular',
  437.         depthMultiplier = 0.75,
  438.         zones = {
  439.             'PALETO',
  440.             'HARMO',
  441.             'GRAPES',
  442.             'SANDY',
  443.             'RTRAK',
  444.             'ZQ_UAR',
  445.             'HUMLAB',
  446.         },
  447.     },
  448. }
  449.  
Advertisement
Add Comment
Please, Sign In to add comment