User:N-neko/sandbox

From Valve Developer Community
< User:N-neko
Revision as of 06:15, 30 December 2005 by N-neko (talk | contribs)
Jump to navigation Jump to search

Animation events

Animation events are flags in the animation sequence representing interactions between the character and the world. Animation events tell the AI at what moment an attack is launched, or a character dies, when a scripted event (such as a scientist opening a door) has happened, and so on.

A sequence may have multiple animation events (for example a walk animation might have a footfall sound for each foot hitting the ground. Some scripted sequences can have quite a few events.

Events are enclosed in curly brackets. The simplest event calls look like {event <#> <frame>} where <#> is the number or the name which tells the system what kind of event has occurred and <frame> tells the system at which frame the event takes place.

Events can have an additional parameter. For example, events that call sound files have an additional parameter, which specifies which sound to play. Events which trigger map entities have an extra parameter for the name of the trigger (enclosed in quotes).

Events with ID numbers below 1000 are specific to individual monsters, so the scientists' event 1 is different from the Vortigaunts' event 1. The meaning of monster specific events is indicated in the monster AI code.

Events with numbers in the 1000 range are scripted sequence events.

Events with numbers in the 2000's are for NPCs.

Events with numbers in the 3000's are for weapons.

Events in the 5000 range are client-side only, and are used primarily for muzzleflash or sound effects for weapon viewmodels.

Server events

Scripted sequence events

NPC events

Weapon events

Client-side events

Custom animation events

To declare custom animation event, you need to use DECLARE_ANIMEVENT macro within AI_BEGIN_CUSTOM_NPC section.

Then you can catch that custom event in HandleAnimEvent(animeevent_t *pEvent).