View unanswered posts | View active topics

Post a new topicPost a reply
Previous topic | Next topic 

  Beginner BeginnerMember since: 01.08.2011, 23:19Posts: 24 Likes: 0

 Post Topic: AI Defend position
PostPosted 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 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.


  Beginner BeginnerMember since: 30.09.2010, 22:11Posts: 31 Likes: 0

 Post Topic: Re: AI Defend position
PostPosted 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:


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

Good luck!
User avatar   Trained Modder Trained ModderMember since: 19.02.2010, 20:16Posts: 218 Likes: 0

 Post Topic: Re: AI Defend position
PostPosted 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!