Event Handlers – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Page creation)
 
(Add IEntity Event Handlers)
Line 1: Line 1:
{{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"
|-
! System/Component
! System/Component
! Event Name
! Event Name
Line 5: Line 8:
! Description
! Description
|-
|-
|DamagerManagerComponent
| DamagerManagerComponent
|OnDestroyed
| OnDestroyed
|IEntity owner
| IEntity owner
|when default hitzone is set to destroyed
| when default hitzone is set to destroyed
|-
|-
|CharacterControllerComponent
| CharacterControllerComponent
|OnADSChanged
| OnADSChanged
|BaseWeaponComponent currentWeapon, bool Value
| BaseWeaponComponent currentWeapon, bool Value
|on player character which switches to ADS
| on player character which switches to ADS
|-
|-
| CharacterControllerComponent
| CharacterControllerComponent
Line 20: Line 23:
| on player character which switches in/out of inspection mode
| on player character which switches in/out of inspection mode
|-
|-
|InventoryStorageManagerComponent
| InventoryStorageManagerComponent
|OnMagazineCountChanged
| OnMagazineCountChanged
|BaseWeaponComponent currentWeapon, int count, bool isGrenade
| BaseWeaponComponent currentWeapon, int count, bool isGrenade
|
|
|-
|-
|BaseCompartmentManagerComponent
| BaseCompartmentManagerComponent
|OnCompartmentEntered
| OnCompartmentEntered
|IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
| IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
|
|
|-
|-
|BaseCompartmentManagerComponent
| BaseCompartmentManagerComponent
|OnCompartmentLeft
| OnCompartmentLeft
|IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
| IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
|
|
|-
|-
|BaseMuzzleComponent
| BaseMuzzleComponent<br>BaseWeaponManagerComponent
 
| OnAmmoCountChanged
BaseWeaponManagerComponent
| BaseWeaponComponent currentWeapon, BaseMuzzleComponent currentMuzzle, BaseMagazineComponent magazine, int ammoCount, bool isChambered
|OnAmmoCountChanged
| Both weapon and character can raise the event
|BaseWeaponComponent currentWeapon, BaseMuzzleComponent currentMuzzle, BaseMagazineComponent magazine, int ammoCount, bool isChambered
|Both weapon and character can raise the event
|-
|-
|BaseWeaponManagerComponent
| BaseWeaponManagerComponent
|OnWeaponChanged
| OnWeaponChanged
|BaseWeaponComponent currentWeapon, BaseWeaponComponent oldWeapon
| BaseWeaponComponent currentWeapon, BaseWeaponComponent oldWeapon
|
|
|-
|-
|BaseWeaponManagerComponent
| BaseWeaponManagerComponent
|OnMagazineChanged
| OnMagazineChanged
|BaseWeaponComponent weapon, BaseMagazineComponent newMagazine, BaseMagazineComponent oldMagazine
| BaseWeaponComponent weapon, BaseMagazineComponent newMagazine, BaseMagazineComponent oldMagazine
|
|
|-
|-
Line 55: Line 56:
| OnMuzzleChanged
| OnMuzzleChanged
| BaseWeaponComponent weapon, BaseMuzzleComponent newMuzzle, BaseMuzzleComponent oldMuzzle
| BaseWeaponComponent weapon, BaseMuzzleComponent newMuzzle, BaseMuzzleComponent oldMuzzle
|  
|
|-
|-
| BaseMuzzleComponent
| BaseMuzzleComponent
| OnFiremodeChanged
| OnFiremodeChanged
| BaseWeaponComponent weapon, BaseMuzzleComponent muzzle, int newFiremode
| BaseWeaponComponent weapon, BaseMuzzleComponent muzzle, int newFiremode
|  
|
|-
|-
| BaseSightsComponent
| BaseSightsComponent
Line 77: Line 78:
| 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 ==
{{Feature|informative|'''E''' in e.g '''E'''OnInit stands for Event (not Entity).}}
=== EOnInit ===
Event after the entity is allocated and initialized.
* IEntity owner: the entity
=== EOnVisible ===
{{Wiki|TODO}}
* IEntity owner: the entity itself
* int frameNumber:
=== EOnFrame ===
This event, as its name suggests, triggers on each simulation frame.
* IEntity owner: the entity
* float timeSlice: time spent since the last frame, in seconds
=== EOnPostFrame ===
Triggers after physics update.
* IEntity owner: the entity itself
* float timeSlice:
=== EOnFixedFrame ===
* IEntity owner: the entity itself
* float timeSlice:
=== EOnFixedPostFrame ===
* IEntity owner: the entity itself
* float timeSlice:
=== EOnAnimEvent ===
Event from the animation system
* IEntity owner: the entity itself
* int type:
* int slot:
=== EOnPhysicsActive ===
Triggers on (de)activation of the {{hl|RigidBody}}'s physics.
* IEntity owner: the entity itself
* bool activeState:
=== EOnPhysicsMove ===
Triggers when the physics engine moves this entity. {{Wiki|TODO}}
* IEntity owner: the entity itself
=== EOnSimulate ===
Happens before physics engine iteration - called from sub-iterations. {{Wiki|TODO}}
* IEntity owner: the entity itself
* float timeSlice:
=== EOnPostSimulate ===
Happens after physics engine iteration. Happens once per frame.
* IEntity owner: the entity itself
* float timeSlice:
=== EOnJointBreak ===
Triggers when a joint attached to this entity's {{hl|RigidBody}} is broken.
* IEntity owner: the entity itself
* IEntity other: the other entity
=== EOnTouch ===
Event when touched by another entity. It requires the entity to have {{hl|TouchComponent}}. {{Wiki|TODO}}
* IEntity owner: the entity itself
* IEntity other: the touched entity
* int touchTypesMask: unused as of {{armaR}} 0.9.5
=== EOnContact ===
Triggers when contact with another {{hl|RigidBody}} has been registered.
* IEntity owner: the entity itself
* IEntity other: the other entity
* Contact contact:
=== EOnDiag ===
Happens every frame after {{HashLink#EOnFrame}} when "Entity Diag" is enabled in the debug menu (e.g Workbench).
* IEntity owner: the entity itself
* float timeSlice:
=== EOnUser0 ===
* IEntity other:
* int extra:
=== EOnUser1 ===
* IEntity other:
* int extra:
=== EOnUser2 ===
* IEntity other:
* int extra:
=== EOnUser3 ===
* IEntity other:
* int extra:
=== EOnUser4 ===
* IEntity other:
* int extra:


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

Revision as of 17:31, 30 May 2022

The following table is a list of the most useful events and is not an extensive list of each event handlers.
System/Component Event Name Callback Parameters Description
DamagerManagerComponent OnDestroyed IEntity owner when default hitzone is set to destroyed
CharacterControllerComponent OnADSChanged BaseWeaponComponent currentWeapon, bool Value on player character which switches to ADS
CharacterControllerComponent OnInspectionModeChanged bool newState on player character which switches in/out of inspection mode
InventoryStorageManagerComponent OnMagazineCountChanged BaseWeaponComponent currentWeapon, int count, bool isGrenade
BaseCompartmentManagerComponent OnCompartmentEntered IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
BaseCompartmentManagerComponent OnCompartmentLeft IEntity vehicle, BaseCompartmentManagerComponent manager, IEntity occupant, int managerID, int slotID
BaseMuzzleComponent
BaseWeaponManagerComponent
OnAmmoCountChanged BaseWeaponComponent currentWeapon, BaseMuzzleComponent currentMuzzle, BaseMagazineComponent magazine, int ammoCount, bool isChambered Both weapon and character can raise the event
BaseWeaponManagerComponent OnWeaponChanged BaseWeaponComponent currentWeapon, BaseWeaponComponent oldWeapon
BaseWeaponManagerComponent OnMagazineChanged BaseWeaponComponent weapon, BaseMagazineComponent newMagazine, BaseMagazineComponent oldMagazine
BaseWeaponComponent OnMuzzleChanged BaseWeaponComponent weapon, BaseMuzzleComponent newMuzzle, BaseMuzzleComponent oldMuzzle
BaseMuzzleComponent OnFiremodeChanged BaseWeaponComponent weapon, BaseMuzzleComponent muzzle, int newFiremode
BaseSightsComponent OnZeroingChanged BaseWeaponComponent weapon, int range currently does not carry currentMuzzle
WeaponComponent OnWeaponAttachmentChanged WeaponComponent weapon, bool isAttached, IEntity attachmentEntity isAttached is true if attachmentEntity was attached to the weapon, and false if it was detached.
TurretControllerComponent OnTurretReload BaseWeaponComponent weapon, bool isFinished, TurretControllerComponent turretController isFinished is true when reload is done and false when it started.


Entity Event Handlers

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

EOnInit

Event after the entity is allocated and initialized.

  • IEntity owner: the entity

EOnVisible

🚧
TODO: this must be updated.
  • IEntity owner: the entity itself
  • int frameNumber:

EOnFrame

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

  • IEntity owner: the entity
  • float timeSlice: time spent since the last frame, in seconds

EOnPostFrame

Triggers after physics update.

  • IEntity owner: the entity itself
  • float timeSlice:

EOnFixedFrame

  • IEntity owner: the entity itself
  • float timeSlice:

EOnFixedPostFrame

  • IEntity owner: the entity itself
  • float timeSlice:

EOnAnimEvent

Event from the animation system

  • IEntity owner: the entity itself
  • int type:
  • int slot:

EOnPhysicsActive

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

  • IEntity owner: the entity itself
  • bool activeState:

EOnPhysicsMove

Triggers when the physics engine moves this entity.

🚧
TODO: this must be updated.
  • IEntity owner: the entity itself

EOnSimulate

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

🚧
TODO: this must be updated.
  • IEntity owner: the entity itself
  • float timeSlice:

EOnPostSimulate

Happens after physics engine iteration. Happens once per frame.

  • IEntity owner: the entity itself
  • float timeSlice:

EOnJointBreak

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

  • IEntity owner: the entity itself
  • IEntity other: the other entity

EOnTouch

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

🚧
TODO: this must be updated.
  • IEntity owner: the entity itself
  • IEntity other: the touched entity
  • int touchTypesMask: unused as of Arma Reforger 0.9.5

EOnContact

Triggers when contact with another RigidBody has been registered.

  • IEntity owner: the entity itself
  • IEntity other: the other entity
  • Contact contact:

EOnDiag

Happens every frame after -no link specified- when "Entity Diag" is enabled in the debug menu (e.g Workbench).

  • IEntity owner: the entity itself
  • float timeSlice:

EOnUser0

  • IEntity other:
  • int extra:

EOnUser1

  • IEntity other:
  • int extra:

EOnUser2

  • IEntity other:
  • int extra:

EOnUser3

  • IEntity other:
  • int extra:

EOnUser4

  • IEntity other:
  • int extra: