Popular Post Dzsozi (h03) Posted October 10, 2017 Popular Post Share Posted October 10, 2017 (edited) 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! Edited November 8, 2017 by Dzsozi (h03) Added video + a few changes 6 1 Link to comment
Dzsozi (h03) Posted October 14, 2017 Author Share Posted October 14, 2017 Added video and a few more content! Link to comment
xeon17 Posted October 14, 2017 Share Posted October 14, 2017 Truly amazing work! Makes the game look completely different! Keep it up 1 Link to comment
Dzsozi (h03) Posted October 14, 2017 Author Share Posted October 14, 2017 4 hours ago, xeon17 said: Truly amazing work! Makes the game look completely different! Keep it up Thank you! And thanks for your feedback! Link to comment
Dzsozi (h03) Posted October 14, 2017 Author Share Posted October 14, 2017 New update! Link to comment
Captain Cody Posted October 14, 2017 Share Posted October 14, 2017 Should make it slowly build dirt instead of sudden changes to different textures. Link to comment
Dzsozi (h03) Posted October 14, 2017 Author Share Posted October 14, 2017 (edited) 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 October 14, 2017 by Dzsozi (h03) Link to comment
Captain Cody Posted October 14, 2017 Share Posted October 14, 2017 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. Link to comment
Dzsozi (h03) Posted October 14, 2017 Author Share Posted October 14, 2017 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
Captain Cody Posted October 14, 2017 Share Posted October 14, 2017 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. Link to comment
Dzsozi (h03) Posted October 15, 2017 Author Share Posted October 15, 2017 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
TheTrue Posted October 20, 2017 Share Posted October 20, 2017 Looking real good, was thinking abote this day ago Link to comment
Dzsozi (h03) Posted October 26, 2017 Author Share Posted October 26, 2017 (edited) 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 October 26, 2017 by Dzsozi (h03) 1 Link to comment
Dzsozi (h03) Posted November 8, 2017 Author Share Posted November 8, 2017 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! 1 Link to comment
Dzsozi (h03) Posted November 8, 2017 Author Share Posted November 8, 2017 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
Markn1 Posted November 9, 2017 Share Posted November 9, 2017 Niccccccccccccccccccccce ♥ 1 Link to comment
DiGiTal Posted November 10, 2017 Share Posted November 10, 2017 very good script THE BEST KEEP your Working !!! 1 Link to comment
raynner Posted December 25, 2017 Share Posted December 25, 2017 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
maximumdrive Posted December 28, 2017 Share Posted December 28, 2017 The other way to use your great idea is to let vehicles become rusty 2 Link to comment
Dzsozi (h03) Posted January 17, 2018 Author Share Posted January 17, 2018 On 2017. 12. 28. at 18:45, maximumdrive said: The other way to use your great idea is to let vehicles become rusty Yes I agree and I was also thinking about it. Link to comment
M3desh Posted May 31, 2022 Share Posted May 31, 2022 Hello This script dose not work with me what can i do for it to work Link to comment
Prox69 Posted May 28 Share Posted May 28 On 31/05/2022 at 14:15, M3desh said: Hello This script dose not work with me what can i do for it to work the issue with the function itself it is no longer works https://wiki.multitheftauto.com/wiki/SetVehicleDirtLevel 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