Hit Effects
Hit effects are sounds and visual effects played in response to in-game hits. They provide impact feedback and help communicate damage, blocking, and other combat results. OpenBOR includes native hit-sound and hit-flash systems that creators may configure to give projects a distinct presentation.
Documentation in progress.
Flash Adjustments
Position and Layer
OpenBOR games commonly allow movement along the Z axis. Hit flashes must therefore be positioned and layered in a way that remains visually consistent when the attacker and target occupy different depths.
By default, OpenBOR places a flash at the collision point. Its drawing layer is then adjusted to place it over the attacker or target nearest the foreground.
Three groups of properties modify this behavior:
- Flash Z Source selects the Z position where the flash entity spawns.
- Flash Layer Source selects the Z position used as the flash entity's base drawing layer.
- Flash Layer Adjustment applies an arbitrary offset to the selected drawing layer.
Global, attack-box, and body-box values are additive. OpenBOR combines all three values before selecting the relevant position or layer.
Flash Z Source
Flash Z Source determines where OpenBOR obtains the Z position used to spawn a native hit flash. The flash's X and Y positions remain at the collision point.
OpenBOR calculates the source value as follows:
flash_z_source =
global_z_source
+ attack_box_z_source
+ body_box_z_source
Properties
| Property | Default | Scope |
|---|---|---|
global_config_flash_z_source {int}
|
0
|
Models.txt property providing the initial source value for all native hit flashes. |
attack.effect.hit.flash.z.source {int}
|
0
|
Attack-box property that adjusts the source value for hits caused by the attack box. |
bbox.effect.hit.flash.z.source {int}
|
0
|
Body-box property that adjusts the source value when the body box receives a hit. |
Source Selection
OpenBOR adds the three properties and selects the flash Z position according to the resulting value.
| Total Source Value | Flash Z Position |
|---|---|
<= -255
|
Lowest Z position between the attacker and target. |
-254 through -1
|
Attacker's Z position. |
0
|
Collision Z position. |
1 through 254
|
Target's Z position. |
>= 255
|
Highest Z position between the attacker and target. |
Note: When a scripted hit does not provide an attacker or target entity, the missing entity's Z position defaults to the collision Z position. An unspecified collision position defaults to 0.
Tip: Since the three properties are added together, an attack box or body box may preserve, counteract, or replace the global behavior for an individual collision.
Flash Layer Source
Flash Layer Source determines the base drawing layer assigned to the spawned flash entity. This allows the flash to remain visually overlaid on the desired participant regardless of the Z position where the flash itself spawns.
Source values do not act as direct layer offsets. They select which Z position OpenBOR uses as the base layer.
OpenBOR calculates the source value as follows:
flash_layer_source =
global_layer_source
+ attack_box_layer_source
+ body_box_layer_source
Properties
| Property | Default | Scope |
|---|---|---|
global_config_flash_layer_source {int}
|
255
|
Models.txt property providing the initial layer-source value for all native hit flashes. |
attack.effect.hit.flash.layer.source {int}
|
0
|
Attack-box property that adjusts the layer-source value for hits caused by the attack box. |
bbox.effect.hit.flash.layer.source {int}
|
0
|
Body-box property that adjusts the layer-source value when the body box receives a hit. |
Source Selection
OpenBOR adds the three properties and selects the flash's base drawing layer according to the resulting value.
| Total Source Value | Base Drawing Layer |
|---|---|
<= -255
|
Lowest Z position between the attacker and target. |
-254 through -1
|
Attacker's Z position. |
0
|
Resolved flash Z position selected by Flash Z Source. |
1 through 254
|
Target's Z position. |
>= 255
|
Highest Z position between the attacker and target. |
The default global value of 255 selects the highest Z position between the attacker and target. This ordinarily places the flash over whichever participant is nearest the foreground.
Flash Layer Adjustment is applied after this source selection.
Flash Layer Adjustment
Flash Layer Adjustment applies an arbitrary offset after OpenBOR selects the flash's base drawing layer.
OpenBOR calculates the final drawing layer as follows:
final_flash_layer =
selected_base_layer
+ global_layer_adjustment
+ attack_box_layer_adjustment
+ body_box_layer_adjustment
Properties
| Property | Default | Scope |
|---|---|---|
global_config_flash_layer_adjust {int}
|
1
|
Models.txt property providing the initial layer adjustment for all native hit flashes. |
attack.effect.hit.flash.layer.adjust {int}
|
0
|
Attack-box property that adjusts the final layer for hits caused by the attack box. |
bbox.effect.hit.flash.layer.adjust {int}
|
0
|
Body-box property that adjusts the final layer when the body box receives a hit. |
Positive values move the flash forward in the drawing order. Negative values move it backward. The default global adjustment of 1 places the flash one layer ahead of its selected source.
Configuration Example
The following example retains the default collision Z position while placing flashes one layer ahead of the participant nearest the foreground.
# data/models.txt global_config_flash_z_source 0 global_config_flash_layer_source 255 global_config_flash_layer_adjust 1
An individual attack box may override the global source behavior through additive adjustment:
- Select collision Z instead of the global foreground source
- when determining this attack's flash layer.
attack.effect.hit.flash.layer.source -255
With the default global value of 255, the attack adjustment of -255 produces a total layer-source value of 0. OpenBOR therefore uses the flash's resolved Z position as its base drawing layer.
