i want the ai to lose the player after a certain amount of time and if the player is not being seen by the ai. i have no idea how to make it like that, and i have never made a ai before. if anyone has good videos or can show me a little about ai i would be very happy. thanks for reading
Time Problem: You can use tick() when the chasing begins and loop a couple times until the time equals the time you want. You could also just use task.wait() and set the time and run the raycast to see if it see’s the player.
Seeing Problem: You could try using a raycast that goes from the rootPart maybe 100 studs to see if there is a part ahead.
I can give you an example, but hopefully you can try searching through the devhub or the new devhub to make the code.
Example:
-- start
task.wait(10)
--raycast
thanks! ill look up and do some research on making a ai
I think you should probably use some Vectors. There are methods like Dot() and Angle(). Try using that. If you want to see that the AI is looking or not, use Dot() on the LookVector of the Character’s head and AI’s head. If you don’t want to use Vectors at all, then you should probably Raycast.
I think you mean “npc”. Especially nowadays, AI means something different.
yes you can just use raycast to see if there visibility to the character and if you want it smart then use pathfinding