Jump to content
crp19851

Code AI in a group to a specific building location

Recommended Posts

Hi all I am working on a map to test AI accuracy and intelligent behavior using the WW2 mods. I have a mission setup using the WW2 Egypt map where a single German squad supported by a reconnaissance 234 advances into the main city. The player plays the role of a UK squadron defending the area. The goal of the map is to test various AI settings to give a good realistic feeling to shooting accuracy which I have achieved. The next thing I'm working on is making the AI act much more intelligently. I'm experimenting with using individual teams in the editor instead of a single rifle squadron. The German squad is now three teams advancing on the player. On the German's right flank (the machine gun team) there is a building that can be utilized by the AI to lay down suppressing fire. I'm having trouble with making the machine gunner from the machine gun team go to the rooftop of the building to lay down fire. Does anyone know of a good solution to get the AI unit to do this? The only AI mod I'm using currently is tactical combat link. I'm thinking about adding Vcom AI also but am not sure if they work well together. Anyone run this combination? The other issue I need to solve is how to sync the three German teams advance speed. In arma2 one could just sync the waypoints with each other; that feature seems to be missing in Arma 3. How can this be done?

Thanks in advance for any help!

 

 

Edited by R0adki11
removed unnecessary formatting
  • Like 1

Share this post


Link to post
Share on other sites

@crp19851,
First off, I might post in easy to read size more often. Thanks for that idea.
 

Quote

I'm having trouble with making the machine gunner from the machine gun team go to the rooftop of the building to lay down fire. Does anyone know of a good solution to get the AI unit to do this?

There are generally two schools of thought, somewhat determined by the situation. Can the player see this happen or not? If so, heavily scripted animation sequence. If not,

gunner setpos (getpos gunnerPOS);

all done.
 

Quote

The other issue I need to solve is how to sync the three German teams advance speed.

There's a few of ways to do this, too.

Edited by R0adki11
removed unnecessary formatting

Share this post


Link to post
Share on other sites
55 minutes ago, crp19851 said:

The other issue I need to solve is how to sync the three German teams advance speed. In arma2 one could just sync the waypoints with each other;

You can still do this. Right click a waypoint select Connect > Set Waypoint Activation, then click another waypoint and a synced connection between the two will be made.

  • Like 1

Share this post


Link to post
Share on other sites

@Wogz187, The building is approximately 200 meters or so from the player. It doesn't really matter if the player sees it or not. Does the code you provided work for an infantry unit in a group moving (or rather teleporting) to a specific position inside a building? The specific building is 51853 position #7 which is on the rooftop. He would probably need "Path" disabled after moving there so he doesn't wander off. Also would this code work placing it in waypoint activation or deactivation (so it happens when the group reaches the building)?

 

@Larrow I knew set waypoint activation works with a countdown trigger when using it with a hold waypoint. Very basic timing trigger etc,. I didn't know you could use this with another waypoint to sync group timing. Thanks 🙂

 

Edited by R0adki11
removed unnecessary formatting

Share this post


Link to post
Share on other sites

@crp19851,
 

Quote

Does the code you provided work for an infantry unit in a group...

 Yes. "setPos" will work for any object (vehicle). If the unit is Editor placed it should be named-- that makes it super-easy. If the unit is spawned we have to use another line of code to determine the unit among his group.
 

Quote

The specific building is 51853 position #7 which is on the rooftop.

I'm positive you can use the building position data to select the teleport point but it's a 1000% easier to put a helper arrow down where you want the gunner to teleport to and name it, like "gunnerPOS1". Your "helper" can be an arrow like I said or a can of tactical beans-- it really doesn't matter-- just make sure to name it, disallow damage and un-check "Show Model" in object special states. Disable simulation in most cases.
 

Quote

He would probably need "Path" disabled after moving there so he doesn't wander off.

Exactly.

If you name the unit and place a named helper arrow, in your trigger ON ACTIVATION,

gunner1 setpos (getpos gunnerPOS1)
gunner1 setDir 45;  // need a bearing
gunner1 disableAI (path);

If the gunner is spawned and/or we need to use the building position data, there's a bit more work to do.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×