Vilespring Posted February 2, 2019 Share Posted February 2, 2019 (edited) So yesterday I decided to get into modding Project Zomboid, and I got my lovely vehicle ingame. However, there's a strange issue where things like glass and rust is showing up on my custom wheels. (yeah the right wheels are inverted, one thing at a time lol) The code I use to load the models is as follows: Spoiler local function info() dir = getDir(MOD_ID); loadVehicleModel("Vehicles_VileMilitaryTruck", dir.."/media/models/Vehicles_VileMilitaryTruck.txt", dir.."/media/textures/Vehicles/Vehicle_VileMilitaryTruck_Shell.png"); loadVehicleModel("Vehicles_WheelMiliTruckR", dir.."/media/models/Vehicles_WheelMiliTruckR.txt", dir.."/media/textures/Vehicles/Vehicle_WheelMiliTruck.png"); loadVehicleModel("Vehicles_WheelMiliTruckL", dir.."/media/models/Vehicles_WheelMiliTruckL.txt", dir.."/media/textures/Vehicles/Vehicle_WheelMiliTruck.png"); VehicleDistributions[1].VileMilitaryTruck = { Normal = VehicleDistributions.Normal, Specific = { VehicleDistributions.Groceries, VehicleDistributions.Carpenter, VehicleDistributions.Farmer, VehicleDistributions.Electrician, VehicleDistributions.Survivalist, VehicleDistributions.Clothing, VehicleDistributions.ConstructionWorker, VehicleDistributions.Painter }, } ISCarMechanicsOverlay.CarList["Base.VileMilitaryTruck"] = {imgPrefix = "smallcar_", x=10,y=0}; VehicleZoneDistribution.parkingstall.vehicles["Base.VileMilitaryTruck"] = {index = -1, spawnChance = 30}; end Events.OnInitWorld.Add(info); And another small mildly unrelated non-issue I have, whenever I export a model and convert it to its .txt counterpart, the UV map gets flipped vertically. This isn't a huge problem, it's just a minor inconvenience. Is there a solution to this besides flipping my textures vertically as well? Edited February 2, 2019 by Vilespring Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 2, 2019 Share Posted February 2, 2019 The main problem is your using loadVehicleModel to load the wheels. The model loading code your using seems to be based off the same code 95% of other mods use (a old example thats been passed around), and is actually incorrect. It works fine on windows but tends to utterly bail on linux and mac (fails to load the textures), because the "/media/textures/" part of the path is automatically added inside the java. local function info() -- EDIT local dir = getDir(MOD_ID); loadVehicleModel("Vehicles_VileMilitaryTruck", dir.."/media/models/Vehicles_VileMilitaryTruck.txt", "/Vehicles/Vehicle_VileMilitaryTruck_Shell.png"); loadStaticZomboidModel("Vehicles_WheelMiliTruckR", dir.."/media/models/Vehicles_WheelMiliTruckR.txt", "/Vehicles/Vehicle_WheelMiliTruck.png"); loadStaticZomboidModel("Vehicles_WheelMiliTruckL", dir.."/media/models/Vehicles_WheelMiliTruckL.txt", "/Vehicles/Vehicle_WheelMiliTruck.png"); -- END EDIT VehicleDistributions[1].VileMilitaryTruck = { Normal = VehicleDistributions.Normal, Specific = { VehicleDistributions.Groceries, VehicleDistributions.Carpenter, VehicleDistributions.Farmer, VehicleDistributions.Electrician, VehicleDistributions.Survivalist, VehicleDistributions.Clothing, VehicleDistributions.ConstructionWorker, VehicleDistributions.Painter }, } ISCarMechanicsOverlay.CarList["Base.VileMilitaryTruck"] = {imgPrefix = "smallcar_", x=10,y=0}; VehicleZoneDistribution.parkingstall.vehicles["Base.VileMilitaryTruck"] = {index = -1, spawnChance = 30}; end Events.OnInitWorld.Add(info); One other bit of advice: use lowercase texture names. "vehicles/vehicle_vilemilitarytruck_shell.png" instead of "Vehicles/Vehicle_VileMilitaryTruck_Shell.png" Not only in the lua, but in your scripts *.txt files, and for the actual folder and filename. Mixed case has caused problems, which is why they switched to lowercase vehicle texture names for vanilla. Link to comment Share on other sites More sharing options...
Vilespring Posted February 2, 2019 Author Share Posted February 2, 2019 Thank you! I’ll do those changes when I can and get back to you when I’m done. Glad to know there’s a solution. By any chance is there a hunk of documentation for future reference? Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 2, 2019 Share Posted February 2, 2019 Documentation is...limited. Theres the online java api http://projectzomboid.com/modding/ but its VERY outdated, and doesn't actually document much more then method names, argument and return types. Its a lot easier to just decompile and read the java since you get the same information (and more), and its up-to-date. Link to comment Share on other sites More sharing options...
Vilespring Posted February 3, 2019 Author Share Posted February 3, 2019 So, I messed around with the "loadStaticZomboidModel" for the wheels, and that worked. Oddly enough, if I didn't add the complete path to the textures folder, the game hung up on game load. However, I did get the wheels fixed! A question I do have is if I can do off with the metallic effect that's on the body. Military vehicles are matte, and well, metallic wood is my favorite. After that, it's just tuning the thing to feel like a truck. Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 3, 2019 Share Posted February 3, 2019 48 minutes ago, Vilespring said: Oddly enough, if I didn't add the complete path to the textures folder, the game hung up on game load. That is odd. We don't include the "/media/textures' in the model loading code in ORGM, or Filibuster Rhymes Used Cars. With it there, textures wouldn't load on linux or mac at all, and in a few instances on windows it wouldn't load the wheel textures and would use the vehicle shell texture on the wheels instead. Though on windows it was rare, and probably video card related. Link to comment Share on other sites More sharing options...
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