Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Forum Support

    3. Suggestions

[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.


Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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.