Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  

[C#] Can't manage to draw particle FX

Recommended Posts


Hey there,


I'm trying to draw particle FX in C#, but it simply does not seem to show up. The exact same code _does_ work in another mod in C++, so I must be calling a wrong function, I think.


First, the C++ variant, which works.


// PtfxHandles is a vector of ints, gV has a valid Vehicle member, boneIdxs is also a vector of ints
                    -0.15f, 0.0f, 0.0f,
                    0.0f, 0.0f, -90.0f,
                    boneIdxs[i], 1.5f,
                    false, false, false);
                GRAPHICS::SET_PARTICLE_FX_LOOPED_EVOLUTION(gV.PtfxHandles[i], "boost", 0.0f, 0);
                GRAPHICS::SET_PARTICLE_FX_LOOPED_EVOLUTION(gV.PtfxHandles[i], "charge", 1.0f, 0);
                GRAPHICS::SET_PARTICLE_FX_LOOPED_ALPHA(gV.PtfxHandles[i], 255);

void RequestEffectLibrary(const char* lib) {


And the C# variant, which does not work.


                    Function.Call(Hash._0x6C38AF3693A69A91, "veh_impexp_rocket"); //USE_PARTICLE_FX_ASSET
                    v.PtfxHandles[i] = Function.Call<int>(Hash._START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE,
                        -0.15f, 0.0f, 0.0f,
                        0.0f, 0.0f, -90.0f,
                        boneIdxs[i], 1.5f,
                        false, false, false);
                    Function.Call(Hash.SET_PARTICLE_FX_LOOPED_EVOLUTION, v.PtfxHandles[i], "boost", 0.0f, 0);
                    Function.Call(Hash.SET_PARTICLE_FX_LOOPED_EVOLUTION, v.PtfxHandles[i], "charge", 1.0f, 0);
                    Function.Call(Hash.SET_PARTICLE_FX_LOOPED_ALPHA, v.PtfxHandles[i], 255);

    void RequestEffectLibrary(string lib)
        Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, lib);
        while (!Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, lib))

I really don't see (pun not intended) what's going on. It seems the particle effect is spawned, as my car was set on fire, but no visual effects were drawn.


Share this post

Link to post
Share on other sites
Posted (edited)

I haven't used the native to put particles on a vehicle bone, so I've not used those evolution natives... well, other than the alpha one. I honestly can't see why that wouldn't work, unless it's getting hung up in that RequestEffectLibrary function.


I've got _SET_PTFX_ASSET_NEXT_CALL in my code, which is just the same as _0x6C38AF3693A69A91 from what I can see.


The only other difference is my request code is slightly different but that shouldn't really matter. I do this:

	Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, FxLibrary);

	if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, FxLibrary))
		// Spawn the particle code here...

So it's not waiting for it to load, it just doesn't spawn anything until it does.


Unless the calls through SHVDN work slightly different, I'm not too sure.


Edit: Well I have tried several different ways now and I can't get that effect to appear either. Then again, I don't know if it's for a specific vehicle and a specific bone. I tried it on the voltic2 and the exhaust bone. The particle gets generated, because it creates a valid ID but I get nothing visible.


Another Edit: I noticed there's also a _START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE_2 but I can't get it to work with that either.

Edited by Guest

Share this post

Link to post
Share on other sites

I'm incredibly stupid. The function is SET_PARTICLE_FX_LOOPED_ALPHA(int ptfxHandle, float alpha).


Alpha should be between 0.0f and 1.0f. Not 0 and 255.


It probably just happened to work in C++ because it implicitly set it to 255.0f. Not sure what it did with my 255, probably turn it into its integer representation.


Thank you for taking a look at it and confirming the rest was good.

Share this post

Link to post
Share on other sites
Posted (edited)

How on earth did I miss that? I wouldn't mind, in my ground effects, I have this:

public void EvolveAlpha()
	Alpha = Math.Max(Math.Min(Alpha, 1f), .1f);
	Function.Call(Hash.SET_PARTICLE_FX_LOOPED_ALPHA, ID, Alpha);

But I store all the colours in XML like this, because they're easier to understand as colour values.


I must have looked at the XML and thought... 64, that's an int, so 255 must be right. Glad you figured it out anyway.

Edited by Guest

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.