So I programmed a Code that helps me for the Actor (In that Case a Lamp) to detect via Line Trace if the Player is in the Range of the Light.
If he is in Range and gets hit by the Line Trace (Light), the Boolean is set to “TRUE” and if he is not in Range it’ll be “FALSE”.
So far everything works but I hit a roadblock on this one:
If I place more than one of the Actor within the Level the Player still gets damage (Through Mental Health Darkness Event) because even if he is in the Light the “FALSE” Bool on the other Actors overwrite the “TRUE” Boolean.
I don’t know how I can find the Solution to that Problem.
Make the line traces longer then. I wanted you to do that to know if it would work that way, so I think the problem is not in that function you call afterwards.
You can increase the range of the line traces by getting the angle from the player to the actor according to the world (globally the (x = 1, y = 0, z = 0) unit vector is considered to be pointing at 0 degrees), create that unit vector using the “make vector” node, drag a “rotate vector” node out of it, plug in that angle to rotate it accordingly, multiply the result how long you want it to be, add the actor’s location to it and plug that into the “end” pin of your line trace node.
About your hesitation on using event tick, you see maybe now you’re not having the computer questioning that, but you also make it run the same thing another way. You don’t need to worry about that, it won’t reduce performance.
Use a counter in the player. Every line trace that hits the player increments that counter. If the counter is at 0 - damage the player at the start of the next tick. (you will have to wait for all lights to make their trace - that’s way “at the start of the next tick”)
Better yet you can use a float instead of the counter. That way you can add how much light is hitting the player based on the distance to the light. If the total light is below a certain threshold - damage the player.
Hope this helps.
PS. You can use SetTimerByEvent to plug your Light detection. You can also use the TickEvent of the object and set the tick interval to 1 second. (the last one assumes that the blueprints are in the light and it has nothing else to do on tick)