I’m currently working on a game, and i was wondering if i should add Npc’s that are responsive. I do not want to have a game where you shoot and the Npc just stands there or you drive close to them and they just keep walking straight forward like almost every game with Npc’s on it. But I was wondering if Roblox is able to have this ability
That requires some skill in scripting with accountability of some factors in order for them to “detect” the player and then start moving “smart”.
A way to do this is for the npcs to have pathfinding for them to patrol and detect if a player is near . To detect whether they have been shot you could code it that when a bullet hits it adds a value for 0.2 secs and a script in the npc detects this and it’s detection becomes larger
I also recommend checking out Y3llow mustang on YouTube he’s very good at AI
Does Y3llow have a roblox game and user?
I’m not sure about that since I havnt checked
Contrary to popular belief, the AI doesn’t just have to be weak to the player, kill them. Responsive AI is 100% possible.
When coding these sorts of AIs, I would give them a job, or a passive behavior. By this I mean that the job “Patrol” could mean that the passive AI is going to repeatedly walk from point A to point B.
Then give them different states for different situations. What if something explodes? What if the player has high ground over them. The best AI would likely work with their teammates to flank the player. While this is complex, I think it could be implemented in Lua.
Ik this is years old but quick warning that the value method is kinda bad and you should instead just call a function in the script