Hello!
I would like to show you my current project I am working on. This is about vehicles getting dirtier while you are driving them (something you can see in GTA IV and GTA V). It is currently in beta, I may release if after I finished it!
Here you can see some pictures of the current features of the script:
Every vehicle that has the vehiclegrunge256 texture on it is compatible with this script (you can add your own textures in the script you would like to change, for example if the modded vehicle doesn't have the vehiclegrunge256 texture, but has a texture named only grunge, you can add this in a table, so it will work with that one as well).
replaceTextures = {
{"vehiclegrunge256"},
{"grunge"},
}
The script contains car washes (you go into a car wash --> your vehicle gets cleaned).
You can enable/disable custom car wash garage maps via script when adding a new car wash.
carwashes = {
-- x, y, z, rotation (for garage only), garage
{2454.51343, -1461.01477, 24.00000, 0, false},
{1911.29041, -1776.22644, 13.38281, 0, false},
{1017.74756, -917.59283, 42.17969, 0, false},
{1574.125, -2350, 13.56247, 90, true},
}
When the weather is rainy or you go into water with your vehicle it gets cleaner over time. Every vehicle is affected in this case, for example if there are vehicles parked around on the map with dirt on it and it is raining, they will get cleaner slowly.
There are 5 states of dirt level, 1 is fully clean and 5 is the dirtiest. The script currently has 2 export functions which with you can change and get the dirt level of a vehicle (you can also get the dirt level of a vehicle with getElementData, but can't change it with setElementData, I will add dirt level changing with setElementData in further updates).
Vehicles will get dirty faster if you drive on grass, sand, dirt, etc. They will get dirty anyways, but it is faster on materials that is not concrete or something similar.
I will upload a video soon of the script so you can see it in progress. As I mentioned before, I might release it after it's done. Not much to add/improve, this means it will more likely to happen sooner than later.
VIDEO:
This is still a beta version!
The video doesn't show real values of time and other intervals, everything is because of testing and showing a pre-version of the script.
Work is currently in progress regarding this script / project!
TO DO:
[GREEN] = Done [ORANGE] = In progress [RED] = Need to be done
- Fix any appearing bugs, requires a few more testing to make sure there are none [ * ]
- Make it compatible with car paint shaders (I don't know yet if it is possible, I will try to do it) [ * ]
- Add useful custom events (on[Client]VehicleDirtLevelChange, on[Client]VehicleWashed, etc. everything that is useful for further scripting and for developers) [ * ]
- Make a better handler for getting vehicle dirty, right now the script uses onClientRender, there might be another solution that is more client friendly, I don't know, I will play around with possibilities [ * ]
WHAT'S NEW:
* 2017. 10. 13.
- Custom dirt textures
- Vehicle streaming optimization
- Useful, dynamic debug panel, outputs and values for testing - You can switch between debug mode in game
- Fixed syncing bugs / errors between client and server (some things still need to be fixed)
- Improved car washes (far from done, still needs improving and adding some extras)
- Improved "dirt-add-handling-progress" (can't say it better )
* 2017. 10. 14.
- Fixed various present bugs (a few of them can be seen in the video)
- Vehicles now store the current dirt progress when they are streamed out and streamed in
- Rewritten dirt progress handling, more dynamic and 0 (didn't found any yet) bugs, depending on conditions (is it raining, is vehicle in water, etc.)
- Client side event now triggers when server side event is triggered but not the opposite way
- Improved debug display
- Shortened and more optimized script
Client side is about 350 lines (with debug) and server side is about 50 lines (with debug and commands) of code.
* 2017. 10. 26.
- Fixed a bug where the vehicles' dirt progress wasn't synchronized between players.
- More optimized script
- Custom functions:
* getVehicleDirtLevel (shared) * setVehicleDirtLevel (server) * * getVehicleDirtProgress (shared) * setVehicleDirtProgress (server) * * getNextDirtTime (shared) * setVehicleDirtTime (server) *
- Custom events:
* onClientVehicleDirtLevelChange (client) * onVehicleDirtLevelChange (server) *
*
I always like to read suggestions, so feel free to comment your thoughts and what should I add/remove!
Thank you for reading, hope you like it!
Part of the Advanced Vehicle System project.
EDIT: I would appreciate if somebody could tell me a simple but interesting name for the resource, that is not "Vehicles Get Dirty" (it is too long). I was thinking about VGD, but this is not good enough, nobody will know what does that mean if it gets uploaded to the community.
Download:
https://community.multitheftauto.com/?p=resources&s=details&id=14960
Note that you will have to give up on car paint shaders if you would like to use this resource, unless you know how to make both work, since I couldn't figure it out. But if you know, please let me know as well and I will fix this problem with a quick update on this resource!