How to get the correct bone data for vehicle modifications?

Hello all,

When it comes to getting the coordinates or bone for that matter of vehicle modifications, a few challenges can arise. The issue I am primarily faced with is the lack of ways to get the bone position of modified exhausts (changed via SetVehicleMod()).

Calling the native, GetEntityBoneIndexByName(), with the bone name “exhaust” will only ever reference the stock exhaust location, even if you try “exhaust_2” all the way through to “exhaust_16”, it will not provide the location/s of the other exhaust exits.

I have even tried a simple debug script which runs through bones 0 through to 1,000 and not a single bone references these alternative/modified exhaust exit points.

After having a look through the game’s files, i have concluded that there is a seperate .ytf for most of, if not all, of these modified exhausts.

This leads me to think of these exhausts as almost props that are attached to the vehicle in some manner. However, to my knowledge, there is no way (at least currently) to get this prop/objects data.

I have thought about trying to construct a new native that would be able to pull this data - as I assume somewhere in the base code there would be something of use. But i just don’t have the technical ability at this stage.

Just wanted to put this out there and see if anyone has any ideas on potential method to resolve this issue?

Thank you for taking the time to read this and I look forward to reading potential solutions :slight_smile:

To solve this issue as a quick fix you need to use this native : SetVehicleNitroEnabled

To make the flames work on all exhaust bones even on custom ones !

Try and see if it help’s !

mb its too late, but i hope it help someone

// 1. Get the maximum number of exhaust slots for the vehicle.
// Native: GET_VEHICLE_MAX_EXHAUST_BONE_COUNT (0x3EE18B00CD86C54F)
int maxExhaustBones = invoke(0x3EE18B00CD86C54F);

for (int i = 0; i < maxExhaustBones; i++) {
int boneIndex = -1;
BOOL axisX = false;

// 2. Check if a bone exists in this slot.
// Native: GET_VEHICLE_EXHAUST_BONE (0xE728F090D538CB18)
BOOL success = invoke<BOOL>(0xE728F090D538CB18, vehicle, i, &boneIndex, &axisX);

if (success && boneIndex != -1) {
    
    // 3. Check if it's a VIRTUAL bone (custom exhaust)
    if (boneIndex >= 10000) { 
        
        // 4. GET THE COORDINATES 
        // Native: GET_ENTITY_BONE_POSITION_2 (0x46F8696933A63C9B)
        Vector3 pos = invoke<Vector3>(0x46F8696933A63C9B, vehicle, boneIndex);
        
        //  CRITICAL SAFETY CHECK: Prevent silent crashes from NaN/Infinity
        if (!std::isnan(pos.x) && !std::isinf(pos.x) && 
            !std::isnan(pos.y) && !std::isinf(pos.y) && 
            !std::isnan(pos.z) && !std::isinf(pos.z)) {
            
            // You now have the exact world coordinates of the custom exhaust pipe!
        }
    }
}

}

// 1. Request a unique Sound ID from the game.
// Native: GET_SOUND_ID (0x430386FE9BF80B45)
int soundId = invoke(0x430386FE9BF80B45);

if (soundId != -1) {
// … play the sound (see step 3) …

// 2. RELEASE the ID back to the game pool when finished.
// Native: RELEASE_SOUND_ID (0x353FC880830B88FA)
invoke<Void>(0x353FC880830B88FA, soundId); 

}

// 1. Play the sound from specific 3D coordinates.
// Native: PLAY_SOUND_FROM_COORD (0x8D8686B622B88120)
invoke(0x8D8686B622B88120,
soundId, // The ID from GET_SOUND_ID
“sound_name”, // e.g., “adder_exhaust_pops”
pos.x, pos.y, pos.z, // Coordinates from the bone retrieval
“audio_bank_name”, // e.g., “vehicles” (or empty string “”)
false, // loop
0, // p8
true // p9
);

// 2. Optional: Set max distance so it fades properly.
// Native: SET_VARIABLE_ON_SOUND (0xAD6B3148A78AE9B6)
invoke(0xAD6B3148A78AE9B6, soundId, “max_distance”, 200.0f);