modding:developerinfo:models:events_animations

Events and Animations

Events are triggered by the game engine and can play animations accordingly, for example drive and door animation of vehicles.

Event names are predefined, while animation names can be freely chosen.

Events

Events are listed in model files, which are triggered depending on the state of model.

The following vehicle events are available:

Event Trigger Aircraft Train Boat Truck / Bus / Tram
forever* running constantly
drive* while driving
open_all_doors
close_all_doors
after arriving at station
before departing from station
open_doors_left
close_doors_left
open_doors_right
close_doors_right
after arriving at station
before departing from station
after arriving at station
before departing from station
open_wheels
close_wheels
before landing
after take-off

*animation is looped

Note that the wheel rotation and steering as weel as additional animations for aircraft and boats (elevator, aileron, flaps, rudder, paddles, flags) are calculated by the game engine. The mesh files used for these animations can be defined in the metadata section of the model file.

The following building and person events are available:

Event Trigger Depot Crossing Industry Person
forever* running constantly
open

close
train arriving at crossing
vehicle arriving at depot
train left crossing
vehicle left depot
idle_open*
idle_closed*
after crossing opened
after crossing closed
productionFull
productionHalf
when running above half capacity
when neither idle nor exceeding half capacity
walk*
idle*
sitting*
while walking
while idle
while sitting

*animation is looped

Example code:

events = {
    open_doors_right = {
        [2] = { name = "opend1", forward = true },
        [5] = { name = "opend2", forward = true },
    },
    close_doors_right = {
        [2] = { name = "opend1", forward = false },
        [5] = { name = "opend2", forward = false },
    },
    open_doors_left= {
        [3] = { name = "opend2", forward = true },
        [4] = { name = "opend1", forward = true },
    },
    close_doors_left = {
        [3] = { name = "opend2", forward = false },
        [4] = { name = "opend1", forward = false },
    },
},

The number in the square bracket refers to the position of the mesh file listed in the model file starting with 1. 0 is used to reference the model file itself.

Animations

Animations are defined in model or mesh files. They can be keyframe or file based.

Example code for a keyframe based vehicle door animation:

animations = {
    opend1 = {
        type = "KEYFRAME",
        params = {
            origin = {
                0, 0, 0,
            },
            keyframes = {
                {
                    time = 0,
                    rot = { 0, 0, 0 },
                    transl = { 0, 0, 0 }
                }, {
                    time = 1100,
                    rot = { 92, 0, 0 },
                    transl = { 0, 0, 0 }
                }
            }
        }
    },
 },

Example code for a file based person animation:

animations = {
    idle = {
	params = {
	    id = "man01_idle_lod_0/_root.ani",
	    },
	type = "FILE_REF",
    },
    sitting = {
	params = {
	    id = "man01_sitting_lod_0/_root.ani",
	},
	type = "FILE_REF",
    },
    walk = {
	params = {
	    id = "man01_walk_lod_0/_root.ani",
	},
	type = "FILE_REF",
    },
},

Animation files are stored in the .ani format in the res\models\animation\ folder.

modding/developerinfo/models/events_animations.txt · Last modified: 2019/03/19 10:18 (external edit)