Grogger
(Grogger)
April 5, 2016, 11:12pm
234
Is there a way to ask if an NPC is currently inside the player’s UseScanner range of view?
I would like to do this from inside the NPC, and then fire off some nodes to spawn an indicator arrow above the NPC’s head. Just to indicate that they can be talked to. And when the player walks away the arrow disappears.
There is no “OnEnterScannerRange” or “OnLeaveScannerRange” trigger for the NPC to use, right? Then what’s the ideal way to do this?
The way this is done in the demo doesn’t work too well in this case. Because A) I have to also tell the indicator to vanish as soon as the Usable gets out of range, and B) I want to spawn the indicator at the location of a certain dummy anchor component inside the NPC, so it always appears exactly where I want it.
There are two event dispatches you could register to on the UseScanner: NewUsableDetected and UsableLost. I handle this in the player controller or the hud class and then I deal with the ‘usable’ actor in a game specific way from there.