Jump to content

Vehicle Type and Specialization


bdbssb

Recommended Posts

So I have had a couple of people working with vehicle type and specialization and I wanted to pass on how the game engine handles these attributes.  So every vehicle has a type name at the top of the xml.   Example below.

 

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<vehicle type="carFillable">
    <annotation>Copyright (C) GIANTS Software GmbH, All Rights Reserved.</annotation>

 

The "carFillable" tells the game engine to look for specific attributes in the xml.  I do not know the specific name however this is how I refer to this process.  I will attach a file called FS19_vehicleTypes.xml that will come in helpful and what I will be referring to.  So when I search "carFillable" in the file we will see this

    <type name="carFillable" parent="baseDrivable">
        <specialization name="fillVolume" />
        <specialization name="dischargeable" />
        <specialization name="trailer" />
        <specialization name="tensionBelts" />
        <specialization name="foldable" />
    </type>

The xml is telling the game load vehicle type "carFillable" which has the specializations listed below of fillVolume, dischargeable, trailer, tensionBelts, foldable.  But then you see parent with the name "baseDrivable" so we need to search the xml for "baseDrivable", be sure to go to the top of the document to find the actual type "baseDrivable" not a listing of a parent like above.

You want to see this

    <type name="baseDrivable" parent="base">
        <specialization name="ikChains" />
        <specialization name="wheels" />
        <specialization name="crawlers" />
        <specialization name="slopeCompensation" />
        <specialization name="speedRotatingParts" />
        <specialization name="enterable" />
        <specialization name="fillUnit" />
        <specialization name="motorized" />
        <specialization name="drivable" />
        <specialization name="aiVehicle" />
        <specialization name="aiImplement" />
        <specialization name="articulatedAxis" />
        <specialization name="lights" />
        <specialization name="attacherJoints" />
        <specialization name="powerTakeOffs" />
        <specialization name="suspensions" />
        <specialization name="connectionHoses" />
        <specialization name="honk" />
        <specialization name="wipers" />
        <specialization name="frontloaderAttacher" />
        <specialization name="bunkerSiloCompacter" />
    </type>

 

As you can see there are many more specializations in this vehicle type but we also have a parent of "base" so lets search for base.

 

    <type name="base" className="Vehicle" filename="dataS/scripts/vehicles/Vehicle.lua" >
        <specialization name="baseMaterial" />
        <specialization name="tipOccluder" />
        <specialization name="foliageBending" />
        <specialization name="washable" />
        <specialization name="wearable" />
        <specialization name="dynamicallyLoadedParts" />
        <specialization name="animatedVehicle" />
        <specialization name="dashboard" />
        <specialization name="cylindered" />
        <specialization name="mountable" />
    </type>

As you can see there is no parent listed so there is no need to reference any further.  Now if we simply look at all the referenced specializations we have this list.

        <specialization name="baseMaterial" />
        <specialization name="tipOccluder" />
        <specialization name="foliageBending" />
        <specialization name="washable" />
        <specialization name="wearable" />
        <specialization name="dynamicallyLoadedParts" />
        <specialization name="animatedVehicle" />
        <specialization name="dashboard" />
        <specialization name="cylindered" />
        <specialization name="mountable" />

        <specialization name="ikChains" />
        <specialization name="wheels" />
        <specialization name="crawlers" />
        <specialization name="slopeCompensation" />
        <specialization name="speedRotatingParts" />
        <specialization name="enterable" />
        <specialization name="fillUnit" />
        <specialization name="motorized" />
        <specialization name="drivable" />
        <specialization name="aiVehicle" />
        <specialization name="aiImplement" />
        <specialization name="articulatedAxis" />
        <specialization name="lights" />
        <specialization name="attacherJoints" />
        <specialization name="powerTakeOffs" />
        <specialization name="suspensions" />
        <specialization name="connectionHoses" />
        <specialization name="honk" />
        <specialization name="wipers" />
        <specialization name="frontloaderAttacher" />
        <specialization name="bunkerSiloCompacter" />

        <specialization name="fillVolume" />
        <specialization name="dischargeable" />
        <specialization name="trailer" />
        <specialization name="tensionBelts" />
        <specialization name="foldable" />

This seems like a lot to take in but honestly just take the time to search and follow the names.

Now if you have a vehicle you are building and you cannot find a default vehicle with the specializations you want then you need to add a custom vehicle type in your modDesc.  You would add these lines in your modDesc file.  I use a customized vehicle type in my Factory pack but below is an example of the lines you would need to add.

 

    <vehicleTypes>    
    <type name="fuelTrailer2" parent="baseFillable" filename="$dataS/scripts/vehicles/Vehicle.lua">
        <specialization name="fillTriggerVehicle" />
        <specialization name="dischargeable" />    
        <specialization name="waterTrailer" />
    </type>    
    </vehicleTypes>

 

It is important that you use a type name that is not used as a default type or the game will simply load the default vehicle type.  The easiest way to do this is to search for your new name in the FS19_vehicleTypes.xml and be sure it is not found. 

Next you would put "fuelTrailer2" in the vehicle's xml type name and it would be adding the 3 specialization's listed along with every specialization loaded from parent "baseFillable" as I showed how to do above.

Hope this helped and please feel free to respond with any questions or suggestions.

 

 

 

FS19_vehicleTypes.xml

Link to comment
Share on other sites

  • 11 months 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