Download

Help needed on AI, before I'm losing it...

I’m quite new to AI and after watching several tutorials I thought I will make my own, very simple version.

What I wanted: inside a task I had two events: one tick AI, and one on exeute AI. The “on execute” made my ai run to random points in an area, it always worked well.

The other was responsible for sight on every frame (I wanted to reduce it later). For this it was doing multiple sphere traces, in a shape of a cone. And it also worked…

however there were problems: for example the raycast only happened at the endpoints, when the character reached the actual target location not during running, and not during turning, which needs to be solved some point anyway.

but what is really strange is that after some tries the whole thing just stopped working, the “tick event” is no longer working (not even for a print string)…or more precisely sometimes randomly works for a tick or two then stops again… I’m 100% sure I had rebuilt everything to the same state when it used to be working, and now no idea what could be wrong…

Maybe the whole approach is bad. I don’t want to use the pawnsense and other components for now.
I’d apreciate if someone could guess what could be the problem.

Edit: by now I realized that it has something to do with the radius I give to the ai. When it’s small it always fires a trace, then the larger it gets the more rare that the tick event fires… probably it was not a good idea to put two different events into the task, but i’m sure I saw a tutorial doing it…

If you want the test to happen as the AI is moving to locations, check out the AI services, they can run on top of other tasks, in this case your move. You’d then have a bool or similar flag in your blackboard that the visibility test service would change. Your move task would have a conditional check against this bool and abort the move, if the bool value changes.

I will try it, right now I have no services anywhere.
At first the visibility check was inside a service linked to a selector above the move task. it was working fine, however the ai’s visibility was bad, the trace was too rare, so I moved the trace inside the task hoping it could work better but doesn’t.