Hale Posted June 19, 2017 Share Posted June 19, 2017 Hi! I'm trying to make a script that'll give a player an ability to change their nitro color, however, I seem to fail at it . I tried applying the color to the world texture with engineApplyShaderToWorldTexture and then put the player's current vehicle as the third argument, but it doesn't change. Then I tried doing the same but without the third argument, and what happened is the shader was applied to every single nitro on every vehicle, not just the player's vehicle like I want. Any ideas on how to fix this? nitroShader = dxCreateShader("nitro.fx") function updateNitroColor(r,g,b) if not nitroShader then return end if not r or not g or not b then return end local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end engineApplyShaderToWorldTexture (nitroShader,"smoke", vehicle) dxSetShaderValue (nitroShader, "gNitroColor", r/100, g/100, b/100) end Link to comment
Jayceon Posted June 19, 2017 Share Posted June 19, 2017 Try this: nitroShader = dxCreateShader("nitro.fx", 0, 100, false, "vehicle") Link to comment
Hale Posted June 20, 2017 Author Share Posted June 20, 2017 2 hours ago, Jayceon said: Try this: nitroShader = dxCreateShader("nitro.fx", 0, 100, false, "vehicle") I tried it before and now again, same thing happens. No errors in debug but the nitro smoke is not affected either. Link to comment
MIKI785 Posted June 20, 2017 Share Posted June 20, 2017 You can't. The nitro texture is global, it's not tied to vehicle elements. Hence you can't change it for only one vehicle, it's either all of them or none. Link to comment
Hale Posted June 20, 2017 Author Share Posted June 20, 2017 14 hours ago, MIKI785 said: You can't. The nitro texture is global, it's not tied to vehicle elements. Hence you can't change it for only one vehicle, it's either all of them or none. What would be the best way to create custom nitro colors for everyone then? My first thought was to create marker but that'd look ugly as hell, there must be a better way. Link to comment
pro-mos Posted July 12, 2017 Share Posted July 12, 2017 On 6/20/2017 at 04:28, MIKI785 said: You can't. The nitro texture is global, it's not tied to vehicle elements. Hence you can't change it for only one vehicle, it's either all of them or none. "smoke" and "shad_car" also can't be tied to one vehicle as i've tried and failed. But what's the point of `targetElement` then ?! engineApplyShaderToWorldTexture ( shader, textureName [, element targetElement) On 6/20/2017 at 19:24, Hale said: What would be the best way to create custom nitro colors for everyone then? My first thought was to create marker but that'd look ugly as hell, there must be a better way. did you find an alternative? Link to comment
pa3ck Posted July 12, 2017 Share Posted July 12, 2017 There are other components which can be changed on individual vehicles like paintjobs, rims, glass etc and that is when targetElement comes in to play. Link to comment
pro-mos Posted July 12, 2017 Share Posted July 12, 2017 3 hours ago, pa3ck said: There are other components which can be changed on individual vehicles like paintjobs, rims, glass etc and that is when targetElement comes in to play. The thing is there's servers that use custom under-vehicle neon, and custom nitro colors which is unique for each player, it just confuses me. Link to comment
koragg Posted July 12, 2017 Share Posted July 12, 2017 15 minutes ago, pro-mos said: The thing is there's servers that use custom under-vehicle neon, and custom nitro colors which is unique for each player, it just confuses me. https://github.com/JarnoVgr/Mr.Green-MTA-Resources/blob/master/resources/[gameplay]/mrgreen-settings/visual.lua Here you can see how the different nitro color works (if you wanna search around the resource a bit). Link to comment
pro-mos Posted July 12, 2017 Share Posted July 12, 2017 8 minutes ago, koragg said: https://github.com/JarnoVgr/Mr.Green-MTA-Resources/blob/master/resources/[gameplay]/mrgreen-settings/visual.lua Here you can see how the different nitro color works (if you wanna search around the resource a bit). I took a look at it, it uses same nitro color for every vehicle. I have an idea to use `createEffect` with shaders, i wonder if that will work, will probably try later. Link to comment
koragg Posted July 12, 2017 Share Posted July 12, 2017 1 hour ago, pro-mos said: I took a look at it, it uses same nitro color for every vehicle. I have an idea to use `createEffect` with shaders, i wonder if that will work, will probably try later. I'm pretty sure every player has a different nos color cuz I'm using it at my server Maybe not in that particular file but that's the resource for sure. Link to comment
pro-mos Posted July 12, 2017 Share Posted July 12, 2017 50 minutes ago, koragg said: I'm pretty sure every player has a different nos color cuz I'm using it at my server Maybe not in that particular file but that's the resource for sure. here's the nitro shader script: https://github.com/JarnoVgr/Mr.Green-MTA-Resources/blob/master/resources/[gameplay]/-shaders-nitro/client.lua it doesn't have targetElement argument in engineApplyShaderToWorldTexture Link to comment
koragg Posted July 12, 2017 Share Posted July 12, 2017 Well in that case try something from here: http://www.mediafire.com/file/emwel4ayeobp8sp/vehiclepaintjob.zip I'm not familiar how it syncs paintjobs with everyone (since it's client side?) but paintjobs are shaders so hope you find something useful there. Link to comment
pa3ck Posted July 12, 2017 Share Posted July 12, 2017 There's a difference between paintjobs and nitro effect. Basically every single car got their own body, which you can change, because the "parent" is the vehicle itself. But not all cars have the nitro effect element, the parent is basically the "word", or at least that is what I understand. For example if you want to use shader for the ocean, you wouldn't be able to differentiate between the ocean in San Fierro and Los Santos, they are the same. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now