HUD opacity by range from enemies

Trying to set up a HUD that shows up when near an enemy AI and goes away as you move away. Trying to set it up as a slow progression as a percentage. Currently I have set up that only slightly works as it climbs as I both move closer and further away.

Goals of Blueprint:

  1. Detect AI range from player
  2. Give HUD widget range to change opacity level

Hey there, usually to get the distance you subtract one location from the other. You can also use the node Get Distance To instead of doing that. The enemy distance variable will hold the value between 0 and 1 (it might surpass that but thats not problematic i would say, worst case you can clamp it from 0 to 1) so in your umg widget you set the opacity to the value that comes from that variable.