Note: This tutorial uses a backported model, and does not cover creating & exporting a custom model
As usual, we have our custom folder root at the root of the game_pak. In my case, the folder is genesis
Models can be put in genesis/objects
For the 8 box freighter, it should be in genesis\objects\env\06_unit\05_carriage
In every .cal
and .mtl
file, you need to fix the paths to add the genesis
folder at the start.
Prefabs can be put in genesis/prefabs
.
Prefabs are basically a xml file with a collection of <Prefab>
objects. You can look at vehicle_tractor.xml
for an example. Nothing forces us to add to an existing file, so since this tutorial is based on backporting the 8 box freighter, we will create a new file: genesis/prefabs/vehicle_tractor_8box.xml
.
We then put this in the file :
<PrefabsLibrary>
...
</PrefabsLibrary>
In that tag, we will then paste the 8box prefabs from the 3.0 file (All tags that look like this: <Prefab Name="vehicle_tractor_b_8box.tractor_b_8box_body"...>
)
We want to move all of them over in our new custom file.
Do not forget to change paths for the models, adding the genesis
folder at the start (after 'game' if present)
You can test the newly created model by changing an existing vehicle_model (I suggest a tractor)'s prefab to the new one. In this instance, the prefab path would be: prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body
// TODO!!!!!!!
INSERT INTO "slaves"
("id", "name", "model_id", "mountable", "offset_x", "offset_y", "offset_z", "obb_pos_x", "obb_pos_y", "obb_pos_z", "obb_size_x", "obb_size_y", "obb_size_z", "portal_spawn_fx_id", "portal_scale", "portal_time", "portal_despawn_fx_id", "hp25_doodad_count", "hp50_doodad_count", "hp75_doodad_count", "spawn_x_offset", "spawn_y_offset", "faction_id", "level", "cost", "slave_kind_id", "spawn_valid_area_range", "slave_initial_item_pack_id", "slave_customizing_id", "customizable")
VALUES (9000001, 'Farm Freighter', 9000002, 't', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1263, 3.0, 1.0, 1264, 0, 0, 0, 5.0, 5.0, 143, 50, 10, 6, 50, 0, 0, 'f');
9000002 = Model ID
INSERT INTO "models"
("id", "comment", "sub_id", "sub_type", "dying_time", "sound_material_id", "big", "target_decal_size", "use_target_decal", "use_target_silhouette", "use_target_highlight", "name", "camera_distance", "show_name_tag", "name_tag_offset", "sound_pack_id", "despawn_doodad_on_collision", "play_mount_animation", "selectable", "mount_pose_id", "camera_distance_for_wide_angle")
VALUES (9000002, 'farm freighter', 9000001, 'VehicleModel', 3.3, 7, 'f', 0.0, 'f', 'f', 't', 'Farm Freighter', 20.0, 't', 3.0, 176, 'f', 'f', 't', 0, 16.0);
9000001 = vehicle_model id
INSERT INTO "vehicle_models"
("id", "normal", "damaged50", "dying", "dead", "wheel", "turret_pitch_angle_max", "lin_inertia", "lin_deaccel_inertia", "rot_inertia", "rot_deaccel_inertia", "velocity", "angVel", "can_fly", "driver_walk", "wheel2", "turret_yaw_angvel", "turret_pitch_angvel", "damaged25", "damaged75", "floating_height", "floating_wave_height", "floating_wave_period_ratio", "auto_level", "trail_align_ratio", "sound_id", "susp_stroke", "max_climb_ang", "susp_axle", "turret_yaw_angle_max", "installed_turret", "use_proxy_collision", "use_center_spindle", "turret_pitch_angle_min", "turret_yaw_angle_min", "use_wheeled_vehicle_simulation", "wheeled_vehicle_mass", "wheeled_vehicle_power", "wheeled_vehicle_brake_torque", "wheeled_vehicle_max_gear", "wheeled_vehicle_gear_speed_ratio_reverse", "wheeled_vehicle_gear_speed_ratio_1", "wheeled_vehicle_gear_speed_ratio_2", "wheeled_vehicle_gear_speed_ratio_3", "wheeled_vehicle_susp_stroke", "wheeled_vehicle_susp_damping", "wheeled_vehicle_drive", "wheeled_vehicle_front_optimal_sa", "wheeled_vehicle_rear_optimal_sa", "wheeled_vehicle_ballast_mass", "wheeled_vehicle_ballast_pos_y")
VALUES (9000001, 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body', 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body_damage75', 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body_dying', 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body_dead', 'cgf://objects\env\06_unit\05_carriage\transfers_trailer_a_wheel01.cgf', 60.0, 0.4, 0.4, 0.2, 0.2, 5.0, 0.4, 'f', 'f', 'cgf://objects\env\06_unit\05_carriage\transfers_trailer_a_wheel02.cgf', 30.0, 10.0, 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body', 'prefab://genesis/prefabs/vehicle_tractor_8box.xml/vehicle_tractor_b_8box.tractor_b_8box_body_damage75', 0.0, 0.0, 0.0, 'f', 0.0, 0, 0.0, 45.0, 'f', 360.0, 'f', 'f', 't', -60.0, -360.0, 'f', 1000.0, 20.0, 4000.0, 2, -0.5, 0.5, 1.0, 1.0, 0.3, 0.3, 0, 10.0, 10.0, 100.0, 0.0);
INSERT INTO "unit_modifiers" ("id", "owner_id", "owner_type", "unit_attribute_id", "unit_modifier_type_id", "value", "linear_level_bonus") VALUES ('9000001', '9000001', 'Slave', '10', '0', '1000', '0');
INSERT INTO "unit_modifiers" ("id", "owner_id", "owner_type", "unit_attribute_id", "unit_modifier_type_id", "value", "linear_level_bonus") VALUES ('9000002', '9000001', 'Slave', '72', '0', '100', '0');
INSERT INTO "unit_modifiers" ("id", "owner_id", "owner_type", "unit_attribute_id", "unit_modifier_type_id", "value", "linear_level_bonus") VALUES ('9000003', '9000001', 'Slave', '6', '0', '2500', '0');
INSERT INTO "unit_modifiers" ("id", "owner_id", "owner_type", "unit_attribute_id", "unit_modifier_type_id", "value", "linear_level_bonus") VALUES ('9000004', '9000001', 'Slave', '8', '0', '10000', '0');
INSERT INTO "unit_modifiers" ("id", "owner_id", "owner_type", "unit_attribute_id", "unit_modifier_type_id", "value", "linear_level_bonus") VALUES ('9000005', '9000001', 'Slave', '64', '0', '10000', '0');
These are what make the vehicle move ingame
- MaxHealth = 6
- Armor = 8
- MoveSpeedMul = 10 (REQUIRED FOR THE VEHICLE TO MOVE)
- MagicResist = 64
- TurnSpeed = 72 (REQUIRED FOR THE VEHICLE TO MOVE)
- FictionMul = 124 (REQUIRED FOR CARS, NOT NEEDED FOR CARTS)