I can’t find a solution to my problem anywhere online and was wondering if someone here can help me?
I made a blueprint script where my AI will go after an object (in my case a piece of cheese, so that’s what I’ll refer to it as), but if it sees the player it will go after them instead and attack. I also have it where if the player breaks the line of sight of the AI for a few seconds, the AI will go back to the cheese. The problem I am encountering is how to make the AI loop damage when it touches the cheese. I have it able to loop and repeat damaging the player just fine, but the same method won’t work on the cheese. I tried a timer method when the AI goes after the object. But that starts before it even touches it. This is the code I have for it so far.
What if you put a collider on the CHEESE object that uses the fire code from the documentation- checking to see if the overlapping actor is “Mouse” but instead of damaging the overlapper (like fire would) you damage self?
So your AI is supposed to receive damage when approaching the “cheese”? But, why does the AI go to the cheese if they know it will affect them? Perhaps it’s a trap or some sort?
I’m assuming it’s a trap for the AI by the player. If so, you can just create a sphere collision around the “cheese” which checks if the respective particular AI is overlapping. If so, then apply damage otherwise stop the timer.
Alright, it’s the same thing. Do the check from the “Cheese” actor class to see if the respective AI is overlapping with the class or not. If so, then apply the damage to the overlapping AI.