Jump to content

[SHOW] Vehicles Get Dirty


Dzsozi (h03)

Recommended Posts

1 hour ago, CodyJ(L) said:

Should make it slowly build dirt instead of sudden changes to different textures.

After the base system is done it could be done easily by adding more textures and lowering the time values.

-- current

local grungeTextures = {}
grungeTextures[1] = dxCreateTexture("files/images/nogrunge.png")
grungeTextures[2] = dxCreateTexture("files/images/lowgrunge.png")
grungeTextures[3] = dxCreateTexture("files/images/defaultgrunge.png")
grungeTextures[4] = dxCreateTexture("files/images/biggrunge.png")
grungeTextures[5] = dxCreateTexture("files/images/megagrunge.png")

You can add as many textures as you want. But I don't know how adding more textures would affect the performance. Right now this is the only way I could think of a solution for what you wrote.

Edited by Dzsozi (h03)
Link to comment
3 minutes ago, CodyJ(L) said:

I did one before that slowly faded in and moved a dirt texture (Then layered a variety of dirt textures depending on how dirty it is) wish I still had files for it though lost it along with my latest server build.

If you can remember and explain how it must be done, I might remake it.

Link to comment
6 hours ago, CodyJ(L) said:

I had WIP dynamic dirt system meaning only the bits of the car that should get dirt on them got dirt and going through water washed the car up to the point where the water submerged it.

From my perspective, it requires more shader knowledge than I have, I wouldn't be able to do it by myself yet. Maybe later, when I get more experienced with shaders, for now I stick to the method that can be seen here.

Link to comment

New update! This resource is almost done, I will do a few more testing and improvements and I might release it, don't know for sure yet, first of all I would like to make sure it's flawless.

 Note that I don't spend my whole days sitting in front of my PC, scripting MTA. Don't expect me to finish this / any other project(s) I have posted in 2 days. 

Edited by Dzsozi (h03)
  • Sad 1
Link to comment
  • 2 weeks later...

 Released! 

Check the post for download link!

Sorry for making it that long, I didn't have enough energy to work with MTA in the last few days. Anyways, enjoy the resource, hope you like it!

Note that it might contain bugs or glitches, if that's the case please report them and I will try to fix it as soon as possible!

You can edit the resource based on your needs, all I ask for is to leave the credits for me!

 Have fun! 

  • Like 1
Link to comment

 Information for the resource: 

Shared custom functions:

int getVehicleDirtLevel(element vehicle) - Returns a number representing the dirt level of the vehicle. 1 is the lowest (fully clean) and 5 is the highest (most dirty).

int getVehicleDirtProgress(element vehicle) - Returns a number representing the dirt progress of the vehicle. See the script files for better understanding!

int getNextDirtTime(element vehicle) - Returns a number representing the time limit when the vehicle gets dirty again. See the script files for better understanding!

bool setVehicleDirtLevel(element vehicle, int level) - Returns true if set succesfully, false otherwise.  IMPORTANT:  Using this on client side won't make the vehicle "globally" dirty, only for the client, use this on server side mostly, since this is where other things like dirt progress and other datas are being set. Also, it will only work for other clients (by that I mean that they will see the effects of the shader) if you use this function on server side.

Server side custom functions:

bool setVehicleDirtProgress(element vehicle, int progress) - Returns true if set succesfully, false otherwise. Sets the dirt progress of a vehicle. See the script files for better understanding!

bool setVehicleDirtTime(element vehicle, int time) - Returns true if set succesfully, false otherwise. Sets the dirt time of a vehicle. This is a limit which checks if a vehicle has to get a dirt level or not. See the script files for better understanding!

Server side custom events:

onVehicleDirtLevelChange - Parameters: int oldLevel int newLevel

oldLevel: The old dirt level of the vehicle, before the event was triggered.

newLevel: The new dirt level of the vehicle, after the event was triggered.

The source of this event is the vehicle that got its dirt level changed.

This event is called when a vehicle got its dirt level changed. For example a vehicle was washed in a carwash.

Client side custom events:

onClientVehicleDirtLevelChange - Parameters: int oldLevel int newLevel

oldLevel: The old dirt level of the vehicle, before the event was triggered.

newLevel: The new dirt level of the vehicle, after the event was triggered.

The source of this event is the vehicle that got its dirt level changed.

This event is called when a vehicle got its dirt level changed. For example a vehicle was washed in a carwash.

Link to comment
  • 1 month later...
On 14/10/2017 at 15:33, Dzsozi (h03) said:

Depois que o sistema base for feito, pode ser feito facilmente adicionando mais texturas e diminuindo os valores de tempo.




 
  
  
  
  
  

Você pode adicionar tantas texturas quanto desejar. Mas eu não sei como a adição de mais texturas afetaria o desempenho. Agora, esta é a única maneira de pensar uma solução para o que você escreveu.

use this feature to do this you can increase the level of dirt by "changing the textures according to which greater distance traveled".
 

 

Link to comment
  • 3 weeks later...
  • 4 years later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...