Jump to content

Vehicle shell overlays showing on wheel textures.


Vilespring

Recommended Posts

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.

 

ab8eeaffac2cff6bff91040481d9bb8d.png

(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 by Vilespring
Link to comment
Share on other sites

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

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!

4c0d0d42398307460f795026cf6d812a.png

 

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

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

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
×
×
  • Create New...