Log in to reply
 

[C# | SOLVED] Spawn exhaust fire particle & bloom lights



  • Hello guys, I'm nearly done with my nitro, I just need to add the fire on the exhausts and the bloom lights while using the nitro.

    FOR THE EXHAUST FIRE:
    I've searched in the natives the method for spawning FX, but I don't know which particle's name is and which method is the best to use, FX_LOOPED_ON_ENTITY (I can't manage to get the exhaust entity) or FX_LOOPED_AT_COORD?

    FOR THE BLOOM LIGHTS:
    Is there a way to increase the lights bloom only on the brakelights?

    Thanks!



  • Hi,

    You need to call START_PARTICLE_FX_NON_LOOPED_AT_COORD (sometimes along with _USE_PARTICLE_FX_ASSET_NEXT_CALL) every frame for the exhaust fire effect.
    Some list of particles here :

    Of course the list is non-exhaustive. @CamxxCore had also made a complete particle list but I'm not able to find it anymore, maybe if he comes around he'll share it.

    Particles effect

    The particles you need for the exhaust fire effect is : "scr_carsteal4", "scr_carsteal5_car_muzzle_flash".
    The first part is the dictionnary while the other one is the particle itself, note that some particles are not meant to be used with some particle_fx natives.

    First of all you need to tell the game you need a certain particle asset to be loaded :

    • REQUEST_NAMED_PTFX_ASSET

    Then you have to check whether it has loaded properly with :

    • HAS_NAMED_PTFX_ASSET_LOADED

    Once you have finished working with your particles (e.g : end of a subroutine) you can call _REMOVE_NAMED_PTFX_ASSET which will release the asset from the memory.

    Vehicle bones

    In order to work with vehicle bones, you need to know their respective name or handle.
    Here's a complete list : https://pastebin.com/D7JMnX1g (note that a lot of bones actually don't exist for certain vehicles)

    According to the previous list, here are the exhausts bones :
    "exhaust", "exhaust_2", "exhaust_3", "exhaust_4", "exhaust_5", "exhaust_6", "exhaust_7", "exhaust_8", "exhaust_9", "exhaust_10", "exhaust_11", "exhaust_12", "exhaust_13", "exhaust_14", "exhaust_15", "exhaust_16"

    As stated previously, you're going to use START_PARTICLE_FX_NON_LOOPED_AT_COORD therefore you need to get the bone coords at runtime. But you can't directly work with bone names, you have to convert them into their respective integrer index.

    You can grab the bone index with GET_ENTITY_BONE_INDEX_BY_NAME. Then you can get the world coordinates of the given bone with GET_WORLD_POSITION_OF_ENTITY_BONE and it should return a Vector3 variable.

    Syncing

    Now that you have almost all the elements to build the exhaust fire effect, there is one last step.
    There are still a few parameters you need to provide in order to run the native correctly. One of them is the rotation vector.

    The X rotation axis doesn't need specific values with this particle, but if you have other particles providing a similar effect, you might have to play with it. So I suggest you to keep it null (0.0f)

    • GET_ENTITY_PITCH will return you the relative vehicle pitch.
      alt text

    Once you have your float pitch (which is the Y rotation value), you can finally get the heading to set the Z rotation value with yourVehicle.Heading-90.0F .

    The last three bools BOOL xAxis, BOOL yAxis, BOOL zAxis are used in case you want to invert the axis, which most of the time is not really needed.

    If you're having trouble with the natives above, for example you're not able to call them because they are not named yet in the global native enum, you can get their respective hash here : http://www.dev-c.com/nativedb/

    Call them with Function.Call(Hash._0xYourHash)

    FOR THE BLOOM LIGHTS:
    Is there a way to increase the lights bloom only on the brakelights?

    There is probably a way to do it directly by accessing the light component itself with the right memory offset (just as the emergency light bar lights) but I guess an in-game screen effect could give you almost the same result.

    Greets,

    winject



  • @winject Wow, I thought at glance that was very hard but, I understood everything, I'll try it now and I'll tell you if everything works!
    Thanks!

    Edit: It seems is not working, but I can't find the error @winject
    That's the method Backfire(Vehicle);
    0_1501784377176_upload-6ec848ed-4db0-4f62-a277-ff2af3e332c6

    That's how I call the Backfire function:
    0_1501784449364_upload-28fa4373-55c5-403a-88c4-fa0e5a7ee11f

    I've put it on the H key for testing purpose, and I was in a car.

    Edit 2: FIXED
    I didn't put Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4"); after the bool check ahahahah
    Thanks it works!


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.