# Modeldef (decl)

Model declarations define parameters for the engine to take into account when dealing with a specific animated model.

## Syntax

model [name] {
[keywords]
[animation declarations]
}

Model declarations begin with a header which consists of model followed by the name of the model declaration.

The header is followed by the body of the declaration which is enclosed in curly brackets.

The body is composed of several keywords and is followed by one or more animation declarations .

### Keywords

Keyword & Usage Description
anim name file [{…}] A declarations that assigns a name to the specified md5anim and allows for the declaration of frame events enclosed in curly brackets.
channel name (joints) Defines an animation channel or isolated region of the skeleton. Channels allow a character’s legs to move independently of their torso.
inherit name Inherits properties from specified model declaration.
mesh file The md5model to use.
offset x, y, z Offsets the model from it’s origin.
skin name Default skin to apply. Can be overridden by entity declarations.
remove name Removes an unwanted animation inherited via the inherit keyword.

#### Channel Syntax

Channels are defined by a list comprised of all the bones to be included in the group. Each bone can be listed individually or through the use of special characters like the astrix or minus signs, one can use the skeletal higharchy to include or exclude child bones.

channel torso ( *Waist )
channel legs  ( *Hips Body origin ROT -*Waist)

The asterix is believed to be inclusive of child bones. In other words, all bones parented to the waist bone are included in the group through the statment “*Waist”.

The minus sign is believed to negate a single bone or group when used in conjunction with the asterix.

NOTE : No formal documentation exists to confirm the syntax described here is correct.

#### Anim Syntax

The animation keyword can be used to define a name for an animation file, or as a full blown declaration, in which case one can define frame events.

anim af_pose  models/md5/monsters/cyberdemon/af_pose.md5anim
anim ik_pose  models/md5/monsters/cyberdemon/ik_pose.md5anim

anim stand    models/md5/monsters/cyberdemon/idle.md5anim
anim idle     models/md5/monsters/cyberdemon/idle.md5anim
anim sight1   models/md5/monsters/cyberdemon/sight.md5anim {
frame 16.5  sound_voice    snd_sight1
}
anim walk     models/md5/monsters/cyberdemon/walk3.md5anim {
frame 17    sound_body snd_footstep
frame 17    triggerSmokeParticle cyber_rfoot_dust
frame 37    sound_body snd_footstep
frame 37    triggerSmokeParticle cyber_lfoot_dust
}
anim pain     models/md5/monsters/cyberdemon/pain_big1.md5anim {
frame 1    call overrideLegs
frame 1    sound_voice snd_pain
frame 16   sound_body  snd_footstep
frame 49   sound_body  snd_footstep
}
##### Frame Events

Frame events are used to syncronize special effects, sounds, or events with animation. Frame events consist of the keyword frame followed by the frame number (which does not have to be a whole number), and then the frame event to call.

Event & Usage Description
call function Calls the specified script function.
object_call function Calls the specified script function on the entity
event event [args…] Sends the specified event to the entity
sound snd Plays the specified sound on any available channel
sound_voice snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_voice2 snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_body snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_body2 snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_body3 snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_weapon snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_global snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_item snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
sound_chatter snd Plays the specified sound on the specified channel. If the channel is busy, the currently playing sound is halted.
skin skin Changes the model’s skin to the specified skin. This setting acts as a default for when no skin is specified in entity declarations.
fx fx Triggers the specified fx declaration.
trigger name Triggers the specified level trigger.
recordDemo name Starts recording a demo under the specified name. Stops recording if no name is specified.
aviGame name Starts recording an avi under the specified name. Useful for making animations to be used on video screens.

The following events are aliases for hardcoded events that do not accept parameters

Event Alias
triggerSmokeParticle triggerParticles
melee attackMelee
direct_damage directDamage
attack_begin attackBegin
attack_end attackEnd
muzzle_flash muzzleFlash
create_missile createMissile
launch_missile launchMissile
fire_missile_at_target fireMissileAtTarget
footstep footstep
leftfoot leftfoot
rightfoot rightfoot
jump jump
enableEyeFocus enableEyeFocus
disableEyeFocus disableEyeFocus
disableGravity disableGravity
enableGravity enableGravity
enableClip enableClip
disableClip disableClip
enableWalkIK enableWalkIK
disableWalkIK disableWalkIK
enableLegIK enableLegIK
disableLegIK disableLegIK
prevent_idle_override ???