Using event handlers to cause AI to counter attack

Workshop for all Mission Engineer Comrades. Home of the FA Mission Making Template.
Post Reply
Raptoer
Posts: 30
Joined: Sun Sep 07, 2014 10:34 pm

Using event handlers to cause AI to counter attack

Post by Raptoer »

Have any of the other mission makers used event handlers on units (who then die) to give other AI waypoints?

I have a mission set up to do this, a set of units get a killed event handler that call in another set of groups that respond (sweep units). Each unit that dies calls in the next group in the cycle, once the last group has been directed it loops back to the first unit again. It could cause units to run in circles, but at least they would be running. I haven't tried it on the test server yet, but the events should fire correctly (I believe the killed event is fired on the server).

User avatar
Eagle_Eye
Posts: 209
Joined: Wed Feb 11, 2015 2:35 am
Location: Cork, Ireland

Re: Using event handlers to cause AI to counter attack

Post by Eagle_Eye »

I haven't used the event handler to do what you suggest, but I can offer up some ideas/alternatives.
  • With the event handler "killed", you get access to the victim and the killer. I guess all you have to do is set a new waypoint for the next squad, pointing at the killer/victim, and let them counterattack. I have used this previously in a couple of missions, just using a trigger or waypoint.
  • In one mission, I have a trigger which fires once IndFOR are detected inside the AO (ie. someone radios for help). This trigger is a switch, which cuts a hold trigger on a group of NATO trucks, and creates a new waypoint centered on the enemy VIP. A few minutes later and they should hopefully come the rescue of the VIP, wherever he may be.
  • In another mission, there is a wrecked ghosthawk that spawns randomly around the town. I have 2 squads patrolling the town, but 5 crash sites, so rather than have to spawn too many people to cover each site, I give them a waypoint, and in the on act. I tell them to move towards the helicopter object, where they should be in position defending once the players arrive.
  • Another thing to look up would be the "gaurd" waypoint, which gets linked to a trigger, and people will attempt to protect that area. I haven't used it much but it might be just what you're looking for.
  • Finally, if your AO is not that large, you could probably get away with simulating a counterattack using simple switch triggers. In any mission where I have reinforcements show up, I simply have a player present or detected trigger with a countdown of 5/10/15 minutes, which once up calls in the set of units. Units can also be given a move waypoint with a timeout of however long, and they wont move on in the list until that timer counts down. This means you can have multiple waves of enemies arriving at different times. (This is how my original version of Hold The Line was made, but all of the triggers and units and timers seemed to botch up the server, so use with caution)
These are all very simple alternatives, and probably not as general use as an event handler, but they might save you some trouble where its not needed. To be honest in most cases the ai never do what you want, so if you can get them up and moving towards the players and let their own behaviour take over after that, you're in a good spot.

PS: I think for all of the above I use the "move" command (when giving a simple 1 point waypoint order), or the "addWaypoint" command if you need to make a chain of waypoints. Waypoints however made this way have to be set to be move waypoints by : _wp setWaypointType "MOVE"

PPS: This might all be really simple and you might already know about it all, apologies if so, but maybe other people will find it interesting.

Post Reply