Forums Gallery LOGIN |REGISTER

AI Defend position

Seeking artificial intelligence? Waypoint queries? Post it here!


 

User avatar Dynamite1000
Just getting started
Just getting started
 
Posts: 24
Member since: 01.08.2011, 23:19
Likes: 0

AI Defend position

Postby Dynamite1000 » 15.10.2011, 17:06

Hi, Im trying to get AI to defend some houses. What tends to happen at the moment is they are alerted and move closer to where the player is. I want them to stay by a number of buildings.

I thought I could use an ai_anchor. It has an option combat_protecy_this_point. I also made sure the group.id was set the same. Even so, the grunt I tested with just ran away from me instead of defending the anchor?

So, if anyone knows of a way to make an ai defend a position id love to know how! I dont want to surround these areas with forbidden areas as other ai need free movement.

Cheers!
User avatar ka40
Just getting started
Just getting started
 
Posts: 31
Member since: 30.09.2010, 22:11
Likes: 0

Re: AI Defend position

Postby ka40 » 21.10.2011, 02:38

well, the only way to strict the AI from getting out of the building is with a forbidden area around the house with a AINavigationModifier without an enter/exit aipoint.

Like this:

Image



don't worry with the other AI unless you want them to enter the house or something else.

Good luck!
User avatar ShadowKnight155
Junior Dev
Junior Dev
 
Posts: 218
Member since: 19.02.2010, 20:16
Likes: 0

Re: AI Defend position

Postby ShadowKnight155 » 29.12.2011, 20:32

You can also surround the area with an AI Shape and set the anchor(in the properties panel) to combat territory or I think there's a protect this area anchor. The combat territory one will stop for the most part people straying out of the shape, and then you can set up a flowgraph that runs like this:

misc:start(or add a trigger of any other kind) --> then add an AI:Execute node and set the action to protect this point. Add another node called Entity:EntityID, connect that to the object ID port on the execute node. Then assign a grunt to the AI:Execute node and add a tagpoint(under ai>>tagpoint in the properties) put that at the center of the defence point, and asign that to the entity id node. I attached a pic to show, cuz this explanation was prob a little confusing. :)

Lemme know if you need more help with the flowgraph. This should work. Good luck!
Attachments
flowgraph.png