# Module `Event`

The EVENT class models an efficient event handling process between other classes and its units, weapons.

## Global(s)

EVENT |

## Type `EVENT`

EVENT.ClassID |
EVENT.ClassName |
EVENT:EventText(EventID) |
EVENT.Events |
EVENT:Init(EventID, EventClass) | Initializes the Events structure for the event
EVENT:New() |
EVENT:OnBirth(EventFunction, EventSelf) | Set a new listener for an SEVENTBIRTH event, and registers the unit born.
EVENT:OnBirthForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate) | Create an OnBirth event handler for a group
EVENT:OnBirthForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTBIRTH event.
EVENT:OnCrash(EventFunction, EventSelf) | Set a new listener for an SEVENTCRASH event.
EVENT:OnCrashForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate) | Create an OnCrash event handler for a group
EVENT:OnCrashForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTCRASH event.
EVENT:OnDead(EventFunction, EventSelf) | Set a new listener for an SEVENTDEAD event.
EVENT:OnDeadForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate) | Create an OnDead event handler for a group
EVENT:OnDeadForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTDEAD event.
EVENT:OnEngineShutDownForTemplate(EventTemplate, EventFunction, EventSelf) | Create an OnDead event handler for a group
EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTENGINE_SHUTDOWN event.
EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTENGINE_STARTUP event.
EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventSelf, OnEventFunction) | Create an OnDead event handler for a group
EVENT:OnEventForUnit(EventDCSUnitName, EventFunction, EventSelf, EventID) | Set a new listener for an SEVENTX event
EVENT:OnEventGeneric(EventFunction, EventSelf, EventID) | Set a new listener for an SEVENTX event independent from a unit or a weapon.
EVENT:OnHit(EventFunction, EventSelf) | Set a new listener for an SEVENTHIT event.
EVENT:OnHitForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTHIT event.
EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventSelf) | Create an OnDead event handler for a group
EVENT:OnLandForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTLAND event.
EVENT:OnPilotDeadForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTPILOT_DEAD event.
EVENT:OnShot(EventFunction, EventSelf) | Set a new listener for an SEVENTSHOT event.
EVENT:OnShotForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTSHOT event for a unit.
EVENT:OnTakeOffForTemplate(EventTemplate, EventFunction, EventSelf) | Create an OnDead event handler for a group
EVENT:OnTakeOffForUnit(EventDCSUnitName, EventFunction, EventSelf) | Set a new listener for an SEVENTTAKEOFF event.
EVENT:onEvent(Event) |

## Type `EVENT.Events`

EVENT.Events.IniUnit |

## Type `EVENTDATA`

EVENTDATA.IniDCSGroup |
EVENTDATA.IniDCSGroupName |
EVENTDATA.IniDCSUnit |
EVENTDATA.IniDCSUnitName |
EVENTDATA.TgtDCSGroup |
EVENTDATA.TgtDCSGroupName |
EVENTDATA.TgtDCSUnit |
EVENTDATA.TgtDCSUnitName |
EVENTDATA.Weapon |
EVENTDATA.WeaponName |
EVENTDATA.WeaponTgtDCSUnit |
EVENTDATA.id |
EVENTDATA.initiator |
EVENTDATA.target |
EVENTDATA.weapon |

## Global(s)

#EVENT EVENT

## Type `Event`

The EVENT structure

### Field(s)

#number EVENT.ClassID

#string EVENT.ClassName

EVENT:EventText(EventID)

  ### Parameter

  - `EventID` :

#EVENT.Events EVENT.Events

EVENT:Init(EventID, EventClass)

  Initializes the Events structure for the event

  ### Parameters

  - `DCSWorld#world.event EventID` :

  - `#string EventClass` :

  ### Return value

  #EVENT.Events:

EVENT:New()

EVENT:OnBirth(EventFunction, EventSelf)

  Set a new listener for an SEVENTBIRTH event, and registers the unit born.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` :

  ### Return value

  #EVENT:

EVENT:OnBirthForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate)

  Create an OnBirth event handler for a group

  ### Parameters

  - `Group#GROUP EventGroup` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  - `EventTemplate` :

  ### Return value

  #EVENT:

EVENT:OnBirthForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTBIRTH event.

  ### Parameters

  - `#string EventDCSUnitName` : The id of the unit for the event to be handled.

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` :

  ### Return value

  #EVENT:

EVENT:OnCrash(EventFunction, EventSelf)

  Set a new listener for an SEVENTCRASH event.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` :

  ### Return value

  #EVENT:

EVENT:OnCrashForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate)

  Create an OnCrash event handler for a group

  ### Parameters

  - `Group#GROUP EventGroup` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  - `EventTemplate` :

  ### Return value

  #EVENT:

EVENT:OnCrashForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTCRASH event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnDead(EventFunction, EventSelf)

  Set a new listener for an SEVENTDEAD event.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` :

  ### Return value

  #EVENT:

EVENT:OnDeadForTemplate(EventGroup, EventFunction, EventSelf, EventTemplate)

  Create an OnDead event handler for a group

  ### Parameters

  - `Group#GROUP EventGroup` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  - `EventTemplate` :

  ### Return value

  #EVENT:

EVENT:OnDeadForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTDEAD event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnEngineShutDownForTemplate(EventTemplate, EventFunction, EventSelf)

  Create an OnDead event handler for a group

  ### Parameters

  - `#table EventTemplate` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTENGINE_SHUTDOWN event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTENGINE_STARTUP event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventSelf, OnEventFunction)

  Create an OnDead event handler for a group

  ### Parameters

  - `#table EventTemplate` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  - `#function OnEventFunction` :

  ### Return value

  #EVENT:

EVENT:OnEventForUnit(EventDCSUnitName, EventFunction, EventSelf, EventID)

  Set a new listener for an SEVENTX event

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  - `EventID` :

  ### Return value

  #EVENT:

EVENT:OnEventGeneric(EventFunction, EventSelf, EventID)

  Set a new listener for an SEVENTX event independent from a unit or a weapon.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  - `EventID` :

  ### Return value

  #EVENT:

EVENT:OnHit(EventFunction, EventSelf)

  Set a new listener for an SEVENTHIT event.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnHitForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTHIT event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventSelf)

  Create an OnDead event handler for a group

  ### Parameters

  - `#table EventTemplate` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnLandForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTLAND event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnPilotDeadForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTPILOT_DEAD event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnShot(EventFunction, EventSelf)

  Set a new listener for an SEVENTSHOT event.

  ### Parameters

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnShotForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTSHOT event for a unit.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnTakeOffForTemplate(EventTemplate, EventFunction, EventSelf)

  Create an OnDead event handler for a group

  ### Parameters

  - `#table EventTemplate` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:OnTakeOffForUnit(EventDCSUnitName, EventFunction, EventSelf)

  Set a new listener for an SEVENTTAKEOFF event.

  ### Parameters

  - `#string EventDCSUnitName` :

  - `#function EventFunction` : The function to be called when the event occurs for the unit.

  - `Base#BASE EventSelf` : The self instance of the class for which the event is.

  ### Return value

  #EVENT:

EVENT:onEvent(Event)

  ### Parameter

  - `Event` :

## Type `EVENT.Events`

The Events structure

### Field(s)

#number EVENT.Events.IniUnit

## Type `EVENTDATA`

The Event structure

### Field(s)

EVENTDATA.IniDCSGroup

EVENTDATA.IniDCSGroupName

EVENTDATA.IniDCSUnit

EVENTDATA.IniDCSUnitName

EVENTDATA.TgtDCSGroup

EVENTDATA.TgtDCSGroupName

EVENTDATA.TgtDCSUnit

EVENTDATA.TgtDCSUnitName

EVENTDATA.Weapon

EVENTDATA.WeaponName

EVENTDATA.WeaponTgtDCSUnit

EVENTDATA.id

EVENTDATA.initiator

EVENTDATA.target

EVENTDATA.weapon