├── server ├── server.lua └── version.lua ├── fxmanifest.lua ├── LICENSE ├── README.md ├── update?.md └── client └── client.lua /server/server.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent("realistic_ragdoll:applyRagdoll") 2 | AddEventHandler("realistic_ragdoll:applyRagdoll", function(pedNetID) 3 | TriggerClientEvent("realistic_ragdoll:applyRagdollToPed", -1, pedNetID) 4 | end) 5 | -- This does server checks to help prevent ragdoll's from glitching when players are nearby. -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | 4 | author 'TheRaccoon' 5 | description 'This is to increase the euphoria physics trying to mimic GTA IV.' 6 | version 'v1.0.4' 7 | 8 | client_script 'client/client.lua' 9 | server_script { 10 | 'server/server.lua', 11 | 'server/version.lua' 12 | } 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 TheRaccoon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Realistic Euphoria Physics 2 | 3 | This is a customizable and well-optimized ragdoll script for FiveM. With adjustable physics settings and event triggers for a range of gameplay scenarios, this script offers a dynamic and engaging gameplay experience for players. 4 | 5 | 6 | 7 | Questions? Contact me on Discord @NokaAngel. 8 | 9 | ## Features 10 | Adjustable physics settings for different bones in the body, including strength, damping, inertia, elasticity, and damping free settings 11 | Event listeners that trigger the ragdoll effect when a player or NPC falls, gets hit, enters melee combat, or is hit by a vehicle 12 | Additional feature that applies the ragdoll effect when a player or NPC is hit by a vehicle 13 | Customizable settings for events and triggers to fit your specific gameplay scenario 14 | Well-optimized for optimal performance on your FiveM server 15 | 16 | ## Installation 17 | Download the latest release of the script from the GitHub repository. 18 | 19 | Extract the contents of the archive to your FiveM server's resources folder. 20 | 21 | Add start Realistic_Euphoria_Ragdoll to your server.cfg file. 22 | 23 | Restart your FiveM server. 24 | 25 | ## Customization 26 | To customize the script, modify the corresponding function in the **'Euphoria'** table in the client script. The **'SetBoneProperties'** function allows you to adjust the strength, damping, inertia, elasticity, and damping free settings for different bones in the body, giving you full control over the ragdoll effect. The **'ApplyRagdollOnCarHit'** function allows for a more realistic and immersive experience when interacting with vehicles in the game. 27 | 28 | Additionally, the event listeners in the client script can be customized to adjust the trigger parameters to fit your specific gameplay scenario. This allows you to create a more dynamic and immersive gameplay experience for your players. 29 | 30 | ## Support 31 | If you encounter any issues or have any questions about the script, please feel free to open an issue on the GitHub repository or contact me directly. 32 | 33 | ## License 34 | This ragdoll script is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use and modify this script as needed, but please credit the original author if sharing any modifications or derivatives. 35 | -------------------------------------------------------------------------------- /server/version.lua: -------------------------------------------------------------------------------- 1 | local label = 2 | [[ 3 | // 4 | || 5 | || 6 | || +-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ 7 | || |R|e|a|l|i|s|t|i|c| |E|u|p|h|o|r|i|a| |P|h|y|s|i|c|s| 8 | || +-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ 9 | || Created by NokaAngel (TheRaccoon) 10 | || 11 | ]] 12 | Citizen.CreateThread(function() 13 | local CurrentVersion = GetResourceMetadata(GetCurrentResourceName(), 'version', 0) 14 | if not CurrentVersion then 15 | print('^1Realistic Euphoria Physics Version Check Failed!^7') 16 | end 17 | 18 | function VersionCheckHTTPRequest() 19 | PerformHttpRequest('https://versions.theraccoon.dev/version.php?resource=realistic-euphoria-physics', VersionCheck, 'GET') 20 | end 21 | 22 | function VersionCheck(err, response, headers) 23 | Citizen.Wait(3000) 24 | if err == 200 then 25 | local version, download, changes = response:match('([^|]+)|([^|]+)|(.+)') 26 | if not version or version == 'error' then 27 | print(label) 28 | print(' || ^1Error fetching version data from server.\n^0 ||\n \\\\\n') 29 | return 30 | end 31 | -- Strip 'v' prefix from version for comparison 32 | version = version:gsub('^v', '') 33 | if CurrentVersion ~= version then 34 | print(label) 35 | print(' || \n || Realistic Euphoria Physics is outdated!') 36 | print(' || Current version: ^2' .. version .. '^7') 37 | print(' || Your version: ^1' .. CurrentVersion .. '^7') 38 | print(' || Please download the latest version from ^5' .. download .. '^7') 39 | if changes ~= '' then 40 | print(' || \n || ^5Changes: ^7' .. changes .. "\n^0 \\\\\n") 41 | end 42 | else 43 | print(label) 44 | print(' || ^2Realistic Euphoria Physics is up to date!\n^0 ||\n \\\\\n') 45 | end 46 | else 47 | print(label) 48 | print(' || ^1There was an error getting the latest version information, if the issue persists contact NokaAngel on Discord.\n^0 ||\n \\\\\n') 49 | end 50 | 51 | SetTimeout(60000, VersionCheckHTTPRequest) -- 60 seconds 52 | end 53 | 54 | VersionCheckHTTPRequest() 55 | end) 56 | -------------------------------------------------------------------------------- /update?.md: -------------------------------------------------------------------------------- 1 | # Realistic Euphoria Physics (GTA IV & RDR2) 2 | 3 | Enhance your FiveM experience with *Realistic Euphoria Physics*, a mod that brings the chaotic, exaggerated ragdoll physics of GTA IV and the grounded, cinematic reactions of RDR2 to GTA V. Created by NokaAngel (aka TheRaccoon), this resource lets you toggle between two distinct euphoria styles, complete with vehicle grab mechanics, detailed shot reactions, and optimized network syncing. 4 | 5 | **Current Version**: v1.1.0 (April 10, 2025) 6 | **Game**: GTA V (FiveM) 7 | **License**: [MIT LICENSE](https://opensource.org/licenses/MIT) 8 | 9 | --- 10 | 11 | ## Features 12 | 13 | - **Dual Physics Styles**: 14 | - **GTA IV**: High-force, flailing ragdolls with bouncy vehicle hits (e.g., `bounceForce = 150.0`). 15 | - **RDR2**: Subtle, realistic reactions with crumpling effects (e.g., `crumpleForce = 20.0`). 16 | - Switch styles via `SELECTED_STYLE` in `client.lua`. 17 | - **Grab-on-Vehicle Mechanic**: Peds have a 50% chance (`GRAB_ON_VEHICLE_CHANCE`) to grab vehicles when hit, influenced by health and speed. 18 | - **Shot Reactions**: Bone-specific responses (e.g., lethal headshots, staggering limbs) with animations. 19 | - **Optimization**: Visibility filtering (`NETWORK_VISIBILITY_DISTANCE = 100.0`), caching, and event cooldowns for performance. 20 | - **Network Sync**: Server-side validation and proximity-based broadcasting for seamless multiplayer. 21 | - **Version Checking**: Automatic updates check via `https://versions.theraccoon.dev/`. 22 | 23 | --- 24 | 25 | ## Installation 26 | 27 | 1. **Download**: Grab the latest release from [GitHub Releases](https://github.com/NokaAngel/Realistic-Euphoria-Physics/releases) or clone this repo. 28 | 2. **Extract**: Place the `Realistic-Euphoria-Physics` folder in your FiveM server’s `resources` directory. 29 | 3. **Configure**: Edit `client.lua` to set `SELECTED_STYLE` ("GTAIV" or "RDR2") and tweak physics settings if desired. 30 | 4. **Enable**: Add `ensure Realistic-Euphoria-Physics` to your `server.cfg`. 31 | 5. **Restart**: Restart your server or use `refresh` followed by `start Realistic-Euphoria-Physics`. 32 | 33 | --- 34 | 35 | ## Configuration 36 | 37 | Adjust these settings in `client.lua`: 38 | - `SELECTED_STYLE`: `"GTAIV"` or `"RDR2"` (default: `"GTAIV"`). 39 | - `GRAB_ON_VEHICLE_CHANCE`: Base grab chance (default: `50`). 40 | - `HEALTH_MODIFIER_STRENGTH`: Health impact on grab chance (default: `0.5`). 41 | - `SPEED_MODIFIER_STRENGTH`: Speed impact on grab chance (default: `0.5`). 42 | - `MAX_SPEED_FOR_GRAB`: Speed threshold for grab chance reduction (default: `15.0`). 43 | - See `PHYSICS_CONFIGS` and `SHOT_REACTION_CONFIGS` for detailed physics tuning. 44 | 45 | --- 46 | 47 | ## Changelog 48 | 49 | See [releases](https://github.com/NokaAngel/Realistic-Euphoria-Physics/releases/tag/v1.1.0) for full details. Highlights from v1.1.0: 50 | - Added GTA IV and RDR2 physics styles. 51 | - Introduced grab-on-vehicle feature. 52 | - Enhanced shot reactions and network optimization. 53 | 54 | --- 55 | 56 | ## Credits 57 | 58 | - **Author**: NokaAngel (aka TheRaccoon) 59 | - **Discord**: Join [my Discord](https://discord.gg/RxHQjtg7c8) for support or feedback! 60 | - **Inspiration**: GTA IV and RDR2 euphoria systems. 61 | 62 | --- 63 | 64 | ## Contributing 65 | 66 | Feel free to fork, submit pull requests, or report issues on GitHub. 67 | -------------------------------------------------------------------------------- /client/client.lua: -------------------------------------------------------------------------------- 1 | local Euphoria = {} 2 | 3 | function Euphoria.SetBoneProperties(ped, bone, strength, damping, inertia, elasticity, dampingFree) 4 | SetPedRagdollOnCollision(ped, true) 5 | SetPedRagdollForceFall(ped) 6 | 7 | SetRagdollDamping(ped, damping) 8 | SetRagdollForce(ped, 1.0) 9 | SetRagdollInertia(ped, inertia) 10 | SetRagdollElasticity(ped, elasticity) 11 | SetRagdollDampingFree(ped, dampingFree) 12 | end 13 | 14 | RegisterNetEvent("realistic_ragdoll:applyRagdollToPed") 15 | AddEventHandler("realistic_ragdoll:applyRagdollToPed", function(pedNetID) 16 | local ped = NetToPed(pedNetID) 17 | if IsPedRagdoll(ped) then 18 | Euphoria.SetBoneProperties(ped, "SKEL_Head", 6.5, 0.35, 6.5, 0.6, 0.6) 19 | Euphoria.SetBoneProperties(ped, "SKEL_Spine0", 6.5, 0.35, 6.5, 0.6, 0.6) 20 | Euphoria.SetBoneProperties(ped, "SKEL_Spine1", 6.5, 0.35, 6.5, 0.6, 0.6) 21 | Euphoria.SetBoneProperties(ped, "SKEL_Spine2", 6.5, 0.35, 6.5, 0.6, 0.6) 22 | Euphoria.SetBoneProperties(ped, "SKEL_Spine3", 6.5, 0.35, 6.5, 0.6, 0.6) 23 | end 24 | end) 25 | 26 | function EnumeratePeds() 27 | return coroutine.wrap(function() 28 | local handle, ped = FindFirstPed() 29 | local success 30 | 31 | repeat 32 | coroutine.yield(ped) 33 | success, ped = FindNextPed(handle) 34 | until not success 35 | 36 | EndFindPed(handle) 37 | end) 38 | end 39 | 40 | function IsPedHitByVehicle(ped) 41 | local veh = GetVehiclePedIsIn(ped, true) 42 | return (veh ~= 0) and (veh ~= nil) 43 | end 44 | 45 | function MakePedGrabVehicle(ped, vehicle) 46 | local animDict = "nm@on_foot@action@vehicle@context@dispatch@180@2h@base" 47 | local animName = "grab_on_vehicle" 48 | 49 | RequestAnimDict(animDict) 50 | 51 | while not HasAnimDictLoaded(animDict) do 52 | Citizen.Wait(100) -- Too many players getting 'Reliable network overflow'? Increase the wait time to fix this. 53 | end 54 | 55 | TaskPlayAnim(ped, animDict, animName, 4.0, -4.0, -1, 33, 0, false, false, false) 56 | end 57 | 58 | local grabStartTime = nil 59 | 60 | Citizen.CreateThread(function() 61 | while true do 62 | Citizen.Wait(100) 63 | 64 | local playerPed = GetPlayerPed(-1) 65 | local pedTable = {} 66 | 67 | for ped in EnumeratePeds() do 68 | if not IsPedAPlayer(ped) then 69 | table.insert(pedTable, ped) 70 | end 71 | end 72 | 73 | for _, ped in ipairs(pedTable) do 74 | if IsPedRagdoll(ped) then 75 | local netID = PedToNet(ped) 76 | TriggerServerEvent("realistic_ragdoll:applyRagdollToPed", netID) 77 | elseif IsPedHitByVehicle(ped) then 78 | local vehicle = GetVehiclePedIsIn(ped, true) 79 | local animDict = "nm@on_foot@action@vehicle@context@dispatch@180@2h@base" 80 | local animName = "grab_on_vehicle" 81 | 82 | if not IsEntityPlayingAnim(ped, animDict, animName, 3) then 83 | MakePedGrabVehicle(ped, vehicle) 84 | grabStartTime = GetGameTimer() 85 | end 86 | end 87 | end 88 | 89 | for i = 0, 255 do 90 | if NetworkIsPlayerActive(i) then 91 | local player = GetPlayerPed(i) 92 | if IsPedRagdoll(player) then 93 | local netID = PedToNet(player) 94 | TriggerServerEvent("realistic_ragdoll:applyRagdoll", netID) 95 | elseif IsPedHitByVehicle(player) then 96 | local vehicle = GetVehiclePedIsIn(player, true) 97 | local animDict = "nm@on_foot@action@vehicle@context@dispatch@180@2h@base" 98 | local animName = "grab_on_vehicle" 99 | 100 | if not IsEntityPlayingAnim(player, animDict, animName, 3) then 101 | MakePedGrabVehicle(player, vehicle) 102 | grabStartTime = GetGameTimer() 103 | end 104 | end 105 | end 106 | end 107 | 108 | if grabStartTime ~= nil then 109 | local elapsedTime = GetGameTimer() - grabStartTime 110 | local ped = GetPlayerPed(-1) 111 | local vehicle = GetVehiclePedIsIn(ped, false) 112 | 113 | if vehicle ~= 0 and vehicle ~= nil then 114 | local speed = GetEntitySpeed(vehicle) * 3.6 115 | 116 | if elapsedTime > 5000 or speed < 2.0 then 117 | ClearPedTasks(ped) 118 | grabStartTime = nil 119 | end 120 | end 121 | end 122 | end 123 | end) 124 | --------------------------------------------------------------------------------