When using Damage(Amount:float):void:
The animations + sound effects are only working while the function is damaging shields.
There are no SFX, VFX while it removes “white health”
Damage(Args:damage_args):void:
Only the camera shake animation is there while it removes shields.
There are no SFX, VFX while it removes “white health”
Code to reproduce:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
custom_dmg_volume := class(creative_device):
@editable
zone1 : mutator_zone_device = mutator_zone_device {}
@editable
zone2 : mutator_zone_device = mutator_zone_device {}
var zone1Agent : ?agent = false
var zone2Agent : ?agent = false
var lastReceivedDmg : float = 0.0
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
zone1.AgentEntersEvent.Subscribe(agentEntersMutatorZone1)
zone1.AgentExitsEvent.Subscribe(agentExitsMutatorZone1)
zone2.AgentEntersEvent.Subscribe(agentEntersMutatorZone2)
zone2.AgentExitsEvent.Subscribe(agentExitsMutatorZone2)
loop:
##### First case:
# Damage the `damageable` object anonymously by `Amount`. Setting `Amount` to less than 0 will cause no damage.Use `Damage(:damage_args):void` when damage is being applied from a known instigator and source.
# Damage<public>(Amount:float):void
if (fortChar1 := zone1Agent?.GetFortCharacter[]):
currentTime : float = GetSimulationElapsedTime()
if (currentTime >= lastReceivedDmg + 1.0):
fortChar1.Damage(10.0)
set lastReceivedDmg = currentTime
##### Second case:
# Damage the `damageable` object by `Args.Amount`. Setting `Amount` to less than 0 will cause no damage.
# Damage<public>(Args:damage_args):void
if (fortChar2 := zone2Agent?.GetFortCharacter[], dmgInstigator := zone2Agent?.GetInstigator(), source := game_action_causer[fortChar2]):
currentTime : float = GetSimulationElapsedTime()
if (currentTime >= lastReceivedDmg + 1.0):
dummyDmg : damage_args = damage_args {Instigator := option{dmgInstigator},
Amount:=10.0,
Source:=option{source}}
fortChar2.Damage(dummyDmg)
set lastReceivedDmg = currentTime
Sleep(0.0)
agentEntersMutatorZone1(Agent:agent):void=
Print("Agent entered zone1")
set zone1Agent = option{Agent}
set lastReceivedDmg = GetSimulationElapsedTime()
agentExitsMutatorZone1(Agent:agent):void=
Print("Agent has left zone1")
set zone1Agent = false
agentEntersMutatorZone2(Agent:agent):void=
Print("Agent entered zone2")
set zone2Agent = option{Agent}
set lastReceivedDmg = GetSimulationElapsedTime()
agentExitsMutatorZone2(Agent:agent):void=
Print("Agent has left zone2")
set zone2Agent = false