How would one go about scripting an enemy AI that lets an enemy know whether to break through or go around an obstacle. Also, how about if there are multiple enemies that could each contribute to breaking down the obstacle faster, so the most efficient way to get to the player would be to break an obstacle rather than go around? Also, what about going to break down a weaker obstacle instead of a stronger one. How would you calculate if walking a little farther to break down a weaker obstacle is more cost effective than just breaking the stronger one that is closer?
Hey, so couple questions,
How are you gonna check this, what I mean by this is like just for example, if the distance between the object and enemy AI is lets say 5f, it goes around, and if it’s less, it’ll break it??? I dunno the word for this but what do you wanna check to see if it should go around or break it.
What are you using to break it? Like is there a weapon
I’d just give the obstacle health, and if someone with the tag “Enemy” hits it deal damage, and when it hits 0, destroy it
I hope you could answer my first 2 questions! Thanks.
If it takes less time to break an obstacle and walk to the player’s current position than to walk around the obstacle then it should break the obstacle
The enmies just hit it with their hands. They are zombies
Whats the point of having 2 options then? if 1 is quicker, then the second one wouldn’t be used then.
So when they get to the obstacle, just play the hit anim, and every time they hit the obstacle, deal damage
I’m asking how you would calculate if option 1 or option 2 would be quicker
What I’m saying is why have 2 options, if the zombie is gonna pick the quicker one just find out your self which one is quicker, and stick with one option instead of making the AI pick it. To find how long it’ll take. Find:
- Object health
- How long does the enemy take to attack
- How much damage does the enemy do
- Find the time
Example: If the health of the obstacle is 500, and enemy attacks every second, and deals 100 damage. It’ll take it 5 seconds to break the obstacle. To find out how long it’ll take to go around, Honestly just play it and see, it’ll take 10 seconds to find out. And then whichever one is quicker, make your Enemy AI do that every time it comes in range with the obstacle. Hope that helps