Event Handlers – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix link)
(Some wiki formatting)
Line 1: Line 1:
{{TOC|side}}
== Common Event Handlers ==
{{Feature|informative|The following table is a list of the most useful events and is not an extensive list of each event handlers.}}
{{Feature|informative|The following table is a list of the most useful events and is not an extensive list of each event handlers.}}


{| class="wikitable sortable"
{| class="wikitable sortable valign-top"
|-
! Class
! System/Component
! Event
! Event Name
! class="unsortable" | Description
! Callback Parameters
! Description
|-
|-
| DamagerManagerComponent
| style="font-size: 0.8em" |
| OnDestroyed
=== OnDestroyed ===
| IEntity owner
| {{Link/Enfusion|armaR|DamageManagerComponent}}
| when default hitzone is set to destroyed
| when default hitzone is set to destroyed
|-
|-
| CharacterControllerComponent
| style="font-size: 0.8em" |
| OnADSChanged
=== OnADSChanged ===
| BaseWeaponComponent currentWeapon, bool Value
| rowspan="2" | {{Link/Enfusion|armaR|CharacterControllerComponent}}
| on player character which switches to ADS
| on player character which switches to ADS
|-
|-
| CharacterControllerComponent
| style="font-size: 0.8em" |
| OnInspectionModeChanged
=== OnInspectionModeChanged ===
| bool newState
| on player character which switches in/out of inspection mode
| on player character which switches in/out of inspection mode
|-
|-
| InventoryStorageManagerComponent
| style="font-size: 0.8em" |
| OnMagazineCountChanged
=== OnMagazineCountChanged ===
| BaseWeaponComponent currentWeapon, int count, bool isGrenade
| {{Link/Enfusion|armaR|InventoryStorageManagerComponent}}
|
|
|-
|-
| BaseCompartmentManagerComponent
| style="font-size: 0.8em" |
| OnCompartmentEntered
=== OnCompartmentEntered ===
| IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
| rowspan="2" | {{Link/Enfusion|armaR|BaseCompartmentManagerComponent}}
|
|
|-
|-
| BaseCompartmentManagerComponent
| style="font-size: 0.8em" |
| OnCompartmentLeft
=== OnCompartmentLeft ===
| IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
|
|
|-
|-
| BaseMuzzleComponent<br>BaseWeaponManagerComponent
| style="font-size: 0.8em" |
| OnAmmoCountChanged
=== OnAmmoCountChanged ===
| BaseWeaponComponent currentWeapon, BaseMuzzleComponent currentMuzzle, BaseMagazineComponent magazine, int ammoCount, bool isChambered
| {{Link/Enfusion|armaR|BaseMuzzleComponent}}
| Both weapon and character can raise the event
| Both weapon and character can raise the event (see {{Link|#BaseWeaponManagerComponent}})
|-
| style="font-size: 0.8em" |
=== OnAmmoCountChanged ===
| rowspan="3" | {{Link/Enfusion|armaR|BaseWeaponManagerComponent}}
| Both weapon and character can raise the event (see {{Link|#BaseMuzzleComponent}})
|-
|-
| BaseWeaponManagerComponent
| style="font-size: 0.8em" |
| OnWeaponChanged
=== OnWeaponChanged ===
| BaseWeaponComponent currentWeapon, BaseWeaponComponent oldWeapon
|
|
|-
|-
| BaseWeaponManagerComponent
| style="font-size: 0.8em" |
| OnMagazineChanged
=== OnMagazineChanged ===
| BaseWeaponComponent weapon, BaseMagazineComponent newMagazine, BaseMagazineComponent oldMagazine
|
|
|-
|-
| BaseWeaponComponent
| style="font-size: 0.8em" |
| OnMuzzleChanged
=== OnMuzzleChanged ===
| BaseWeaponComponent weapon, BaseMuzzleComponent newMuzzle, BaseMuzzleComponent oldMuzzle
| {{Link/Enfusion|armaR|BaseWeaponComponent}}
|
|
|-
|-
| BaseMuzzleComponent
| style="font-size: 0.8em" |
| OnFiremodeChanged
=== OnFiremodeChanged ===
| BaseWeaponComponent weapon, BaseMuzzleComponent muzzle, int newFiremode
| {{Link/Enfusion|armaR|BaseMuzzleComponent}}
|
|
|-
|-
| BaseSightsComponent
| style="font-size: 0.8em" |
| OnZeroingChanged
=== OnZeroingChanged ===
| BaseWeaponComponent weapon, int range
| {{Link/Enfusion|armaR|BaseSightsComponent}}
| currently does not carry currentMuzzle
| currently does not carry currentMuzzle
|-
|-
| WeaponComponent
| style="font-size: 0.8em" |
| OnWeaponAttachmentChanged
=== OnWeaponAttachmentChanged ===
| WeaponComponent weapon, bool isAttached, IEntity attachmentEntity
| {{Link/Enfusion|armaR|WeaponComponent}}
| isAttached is true if attachmentEntity was attached to the weapon, and false if it was detached.
| {{hl|isAttached}} is true if attachmentEntity was attached to the weapon, and false if it was detached.
|-
|-
| TurretControllerComponent
| style="font-size: 0.8em" |
| OnTurretReload
=== OnTurretReload ===
| BaseWeaponComponent weapon, bool isFinished, TurretControllerComponent turretController
| {{Link/Enfusion|armaR|TurretControllerComponent}}
| isFinished is true when reload is done and false when it started.
| isFinished is true when reload is done and false when it started.
|}
|}




{{TOC|side}}
== Entity Event Handlers ==
== Entity Event Handlers ==


The following events are present and available in the '''{{Link/Enfusion|armaR|IEntity}}''' class - read the code documentation to learn more about them and how to use them.
{{Feature|informative|'''E''' in e.g '''E'''OnInit stands for Event (not Entity).}}
{{Feature|informative|'''E''' in e.g '''E'''OnInit stands for Event (not Entity).}}


{| class="wikitable sortable valign-top"
! Event
! class="unsortable" | Description
|-
| style="font-size: 0.8em" |
=== EOnInit ===
=== EOnInit ===
 
| Event after the entity is allocated and initialized.
Event after the entity is allocated and initialized.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity
 
=== EOnVisible ===
=== EOnVisible ===
 
| This event triggers when the entity is made visible (versus being invisible).
This event triggers when the entity is made visible (versus being invisible).
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* int frameNumber:
 
=== EOnFrame ===
=== EOnFrame ===
 
| This event, as its name suggests, triggers on each simulation frame.
This event, as its name suggests, triggers on each simulation frame.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity
* float timeSlice: time spent since the last frame, in seconds
 
=== EOnPostFrame ===
=== EOnPostFrame ===
 
| Triggers after physics update.
Triggers after physics update.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* float timeSlice:
 
=== EOnFixedFrame ===
=== EOnFixedFrame ===
 
|
* IEntity owner: the entity itself
|-
* float timeSlice:  
| style="font-size: 0.8em" |
 
=== EOnFixedPostFrame ===
=== EOnFixedPostFrame ===
 
|
* IEntity owner: the entity itself
|-
* float timeSlice:  
| style="font-size: 0.8em" |
 
=== EOnAnimEvent ===
=== EOnAnimEvent ===
 
| Event from the animation system
Event from the animation system
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* int type:  
* int slot:
 
=== EOnPhysicsActive ===
=== EOnPhysicsActive ===
 
| Triggers on (de)activation of the {{hl|RigidBody}}'s physics.
Triggers on (de)activation of the {{hl|RigidBody}}'s physics.
|-
* IEntity owner: the entity itself
| style="font-size: 0.8em" |
* bool activeState:  
 
=== EOnPhysicsMove ===
=== EOnPhysicsMove ===
 
| Triggers when the physics engine moves this entity.
Triggers when the physics engine moves this entity. {{Wiki|TODO}}
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
 
=== EOnSimulate ===
=== EOnSimulate ===
 
| Happens before physics engine iteration - called from sub-iterations.
Happens before physics engine iteration - called from sub-iterations. {{Wiki|TODO}}
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* float timeSlice:
 
=== EOnPostSimulate ===
=== EOnPostSimulate ===
| Happens after physics engine iteration. Happens once per frame.


Happens after physics engine iteration. Happens once per frame.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* float timeSlice:
 
=== EOnJointBreak ===
=== EOnJointBreak ===
 
| Triggers when a joint attached to this entity's {{hl|RigidBody}} is broken.
Triggers when a joint attached to this entity's {{hl|RigidBody}} is broken.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* IEntity other: the other entity
 
=== EOnTouch ===
=== EOnTouch ===
 
| Event when touched by another entity. It requires the entity to have {{hl|TouchComponent}}.
Event when touched by another entity. It requires the entity to have {{hl|TouchComponent}}. {{Wiki|TODO}}
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* IEntity other: the touched entity
* int touchTypesMask: unused as of {{armaR}} 0.9.5
 
=== EOnContact ===
=== EOnContact ===
 
| Triggers when contact with another {{hl|RigidBody}} has been registered.
Triggers when contact with another {{hl|RigidBody}} has been registered.
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* IEntity other: the other entity
* Contact contact:
 
=== EOnDiag ===
=== EOnDiag ===
 
| Happens every frame after {{Link|#EOnFrame}} when "Entity Diag" is enabled in the [[Arma Reforger:Diag Menu|Diag Menu]] (e.g [[Arma Reforger:Workbench|Workbench]]).
Happens every frame after {{Link|#EOnFrame}} when "Entity Diag" is enabled in the [[Arma Reforger:Diag Menu|Diag Menu]] (e.g [[Arma Reforger:Workbench|Workbench]]).
|-
 
| style="font-size: 0.8em" |
* IEntity owner: the entity itself
* float timeSlice:
 
=== EOnUser0 ===
=== EOnUser0 ===
 
|
* IEntity other:
|-
* int extra:  
| style="font-size: 0.8em" |
 
=== EOnUser1 ===
=== EOnUser1 ===
 
|
* IEntity other:
|-
* int extra:  
| style="font-size: 0.8em" |
 
=== EOnUser2 ===
=== EOnUser2 ===
 
|
* IEntity other:
|-
* int extra:  
| style="font-size: 0.8em" |
 
=== EOnUser3 ===
=== EOnUser3 ===
 
|
* IEntity other:
|-
* int extra:  
| style="font-size: 0.8em" |
 
=== EOnUser4 ===
=== EOnUser4 ===
 
|
* IEntity other:
|}
* int extra:




{{GameCategory|armaR|Modding|Guidelines|Scripting}}
{{GameCategory|armaR|Modding|Guidelines|Scripting}}

Revision as of 18:04, 19 May 2023

Common Event Handlers

The following table is a list of the most useful events and is not an extensive list of each event handlers.
Class Event Description

OnDestroyed

DamageManagerComponent when default hitzone is set to destroyed

OnADSChanged

CharacterControllerComponent on player character which switches to ADS

OnInspectionModeChanged

on player character which switches in/out of inspection mode

OnMagazineCountChanged

InventoryStorageManagerComponent

OnCompartmentEntered

BaseCompartmentManagerComponent

OnCompartmentLeft

OnAmmoCountChanged

BaseMuzzleComponent Both weapon and character can raise the event (see BaseWeaponManagerComponent)

OnAmmoCountChanged

BaseWeaponManagerComponent Both weapon and character can raise the event (see BaseMuzzleComponent)

OnWeaponChanged

OnMagazineChanged

OnMuzzleChanged

BaseWeaponComponent

OnFiremodeChanged

BaseMuzzleComponent

OnZeroingChanged

BaseSightsComponent currently does not carry currentMuzzle

OnWeaponAttachmentChanged

WeaponComponent isAttached is true if attachmentEntity was attached to the weapon, and false if it was detached.

OnTurretReload

TurretControllerComponent isFinished is true when reload is done and false when it started.


Entity Event Handlers

The following events are present and available in the IEntity class - read the code documentation to learn more about them and how to use them.

E in e.g EOnInit stands for Event (not Entity).
Event Description

EOnInit

Event after the entity is allocated and initialized.

EOnVisible

This event triggers when the entity is made visible (versus being invisible).

EOnFrame

This event, as its name suggests, triggers on each simulation frame.

EOnPostFrame

Triggers after physics update.

EOnFixedFrame

EOnFixedPostFrame

EOnAnimEvent

Event from the animation system

EOnPhysicsActive

Triggers on (de)activation of the RigidBody's physics.

EOnPhysicsMove

Triggers when the physics engine moves this entity.

EOnSimulate

Happens before physics engine iteration - called from sub-iterations.

EOnPostSimulate

Happens after physics engine iteration. Happens once per frame.

EOnJointBreak

Triggers when a joint attached to this entity's RigidBody is broken.

EOnTouch

Event when touched by another entity. It requires the entity to have TouchComponent.

EOnContact

Triggers when contact with another RigidBody has been registered.

EOnDiag

Happens every frame after EOnFrame when "Entity Diag" is enabled in the Diag Menu (e.g Workbench).

EOnUser0

EOnUser1

EOnUser2

EOnUser3

EOnUser4