Jump to content
Sign in to follow this  

Small unit tactics mini-scripts

Recommended Posts

Pretty late here, wanted to brainstorm these small unit tactics publicly. Will tackle actual scripting later after sleep.


Flank and spank tactic


taro8 brought up this idea in the ASR AI thread:




I've tried all the AI mods, but for flanking or etc they don't seem to reliably perform what taro8 describes. Most will handle individual AI units within the group, and sometimes I think emergent tactics happen but not by design for team tactics of > 1 AI unit -- e.g. bounding fireteams temporarily split from a section/squad, binaries split from a team, individuals split from a binary. (let me know if I'm blatantly wrong!). I am not a good or elegant scripter by any means, so this is mostly a learning project. Elegant solutions and suggestions for me to investigate would be welcome.


I prefer ASR AI to stay simple, robust, and not heavy on specifics -- it's proven to be pretty timeless and effective b/c it doesn't try to be a fully loaded bells-and-whistles AI suite (which are very cool when they work, but somewhat fragile and more vulnerable to Arma 3 updates). Thus I personally would prefer any higher-level tactics script to stay out of ASR AI's way. I'm starting with Zenophon's framework and trying to stick to KK's and code optimization best practices (blindly following, since I don't yet have experience in being selective when to use a less efficient loop construct or whatevs just b/c it'll get the overall job done simpler), making a small script to be executed on an AI group leader, where:


<nested if checks are faster/lazy than if/else>

Checks if that AI (assume OPFOR for this concept) knowsAbout any BLUFOR > 0.


If true, check distance < _distance. Sort distance for nearest qualifying group.


If true, <insert black script magic to count units group, divide into 3, create 2 new group leaders and attach AI units to them. All dynamically.>


Ensure group 1 seeks cover and keeps the attention of BLUFOR (maybe even suppresses BLUFOR). If with johnnyboy's blessings, incorporate his up-and-down mini-script. https://forums.bistudio.com/topic/190815-release-jboy-combat-up-down-script/


Set new groups 2 and 3 to disable combat mode, then assign "FULL" movement waypoint. Figure out bearing from AI leader group 1 to Zen_FindAveragePosition (finds average point between all objects) of nearest known BLUFOR group. Generate 2-4 WP for each of groups 2 and 3, with relative bearings [-90, -45] and [45, 90] to the 1-BLUFOR source bearing, distance for each WP is random 25-50 (If 25m is a fair distance for a single "I'm up, I'm moving, he sees me, I'm down" sprint). Follow each WP with an immediate setUnitPos "DOWN" with a sleep random 3-5 seconds (Hold WP?). Then execute/create/assign/skip the hold WP to move onto the next disable combat sprint WP.


Now groups 2 and 3 get no further assigned WPs, so they should revert to default AI behavior (or whatever ASR or otherwise AI mod is running).


Once WPs complete, group 1 is assigned a WP with relative bearing [-45, 45] to the source bearing. Movement distance 25-50.


At end of this sequence, regroup all of them back under group 1.


distances could be user-specified parameters, naturally (go for the 300m flanking end run!).


Would it be possible to make AI behave like this when an enemy is spotted: leader divides team into three groups, orders group 2 and 3 to flank left and right. Its pretty basic, but the "flank-n-spank" tactic is the most basic tactics used in combat, so having AI use it would be nice. At least it would make battles a bit more dynamic.



Bounding tactic


Starts off same way, but splits into only 2 groups. Script takes parameter for a final destination. Assigns a dynamic icon marker?


Group 1 gets the disable combat sprint waypoint. When WP complete, they do the up-and-down behind cover.


Group 2 first gets the up-and-down. Then is assigned a created waypoint per group 1.

etc. until one of the groups passes a check for if (group distance destination_marker < 10), then the two groups rejoin.


(mad cheese's Command and Control has a regular peel and Aussie peel that are magnificent to watch in action, knowing anything about wayward AI scripting. :P )



Urban street/building patrol from scratch


[edit: before anyone gets upset, I'm only referencing these spawn scripts as examples, and will message the authors whose work I respect and currently enjoy using as-is, before using their scripts as springboards for any actual work I may do on this. Otherwise, I'll be attempting to reinvent the wheel from only the concept of their scripts, as a learning exercise for myself. I'm not educated enough to actually understand what their scripts are doing -- I get lost following the variables and script structure -- so I don't want to copy something I don't understand and break it anyway.]


T-800a's spawn script already has this function, where units will randomly patrol streets within an area marker, with random waypoints during patrol, set to random building positions. Grahame and I touched on the topic of using existing civ spawn scripts to create roaming zombie patrols. I thought it'd induce a bit of bonus terror if players seek cover in a building, but some staggering zombie randomly wanders into the building. Instead of having to launch the entire T-800a script just to hook in this one component, I wanted to see if I could do the same with Enigma's civilian spawn (super simple script, easily allows a custom script to fire for each spawned unit -- i.e. a script that dynamically spawns patrol WPs for that zombie.


Given that the zombie will spawn in the correct area, thanks to Enigma:


call Zen_FindGroundPosition 5-15 times (or parameter number of times) with limitation of on-road and minimum distance from each other positions. Maybe with condition: testing for buildings nearby (60%+ building coverage in the user-specified radius).


call Zen_FindBuildingPosition on at least some of those waypoints. (Something possibly broke this for me in my current testbed mission -- unit refuses to acknowledge and setpos to that marker about half the time.)

  • Like 1

Share this post

Link to post
Share on other sites


If with johnnyboy's blessings, incorporate his up-and-down mini-script. https://forums.bistu...up-down-script/

But of course.  All my scripts, or codes snippets from them, can be used in any way by anybody.   All I ask is an honorable mention.


I like your ideas and will keep an eye on this thread.

Share this post

Link to post
Share on other sites

You do not actually need to create new groups for flanking. A simple color assigned team is enough. That's how I command my AI: 10 people including me, 3 into team red and green, 3 and me in team white, team red flank left, team green flank right, team white either take cover or advance. This causes my team to nicely fan out, then I either order to flank more or to advance.


With FHQ Combat mode disable addon I usualy set the flanking groups into aware state to turn off their combat mode and have them flank faster.

Share this post

Link to post
Share on other sites

Sorry, I should have clarified that this idea I'm playing with is for AI groups and AI leaders to send their own flanking elements out (possibly with group split, possibly not).

This isn't meant for a player to directly use -- unless an AI group leader can make use of assigned color sub-groups?


It may be partially moot, as I'm seeing that VCOM and AISS 3 FOA 2.0 both have behaviors for flanking. Still keen to figure out whether I can force an obvious bounding overwatch behavior.

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
Sign in to follow this