Does anybody know how to get the agent who triggered the HitEvent from a shooting_range_target_device ? Or at least, how to know which of the player hit or shot on a target ?
1 Like
Looking for this answer as well.
I’ll try to get someone to help.
Hey all, we’re digging in here. Ticket: FORT-784634
In the meantime you can workaround this issue by utilizing the trigger_device to obtain a reference to the Agent. Here’s an example to obtain a reference to the Agent who triggered the device.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
hello_world_device := class(creative_device):
@editable
SRT : shooting_range_target_device = shooting_range_target_device {}
@editable
TRG : trigger_device = trigger_device {}
OnBegin<override>()<suspends>:void=
TRG.TriggeredEvent.Subscribe(OnTriggered)
SRT.HitEvent.Subscribe(OnHit)
OnHit(Info : tuple()):void=
TRG.Trigger()
OnTriggered(MaybeAgent : ?agent):void=
if(Agent := agent[MaybeAgent?]):
# do stuff with Agent