Jump to content
t-800a

[RELEASE] T8 Units - a less dynamic AI creator

Recommended Posts

T8U-LOGO.png


Hey all,
I wanted to share my script, I use to spawn units in coop missions, with you. I first started developing this somewhere during the A3 beta. Playing around with BIN_taskPatrol by Binesi, BangaBobs EOS and similar things somehow caught my interrest in scripting and I started to create a script that would fit my needs. In the past months I finally motivated myself to create some english documentation for this, what took ages for me, so I can release the script here.
I designed this script for the CO-OP missions I play with friends and the 1PARA. It is mostly based around Infantry combat, but you can spawn vehicles with it, too. The script is based on groups and adding waypoints to those groups, and "FiredNear"/"Killed" eventhandlers added to the group leaders. If you have other scripts messing around with groups oder using these eventhandlers, my script will probably not work correct.
 

V.070 changes / enhancements for the script user:

Spoiler

What changes / enhancements can the script user expect:

S C R I P T   I N I T   C H A N G E S

+    no changes on how to spawn groups
+    in the description.ext:


#include <T8\CONFIG.hpp>

class cfgFunctions
{
	#include <T8\FUNCTIONS.hpp>
};

C O N F I G   C H A N G E S

+    everything is now class based according to A3 configs

    main Config:
    cfgT8Units
        class debug:                    debug settings
        class main:                        main settings (time delays, zeus, etc.)
        class dac:                        D.A.C. settings
        class behaviorAndSkills:        base AI skill settings
        class groupSettings:            predefined AI skill settings, can be applied to a single group individually (e.g. if a group should have different skill)
        class groupCompilations:        predefined group compilations to use in definitions
        class groupRandomCompilations:    predefined unit selections to use with T8U_fnc_createUnitContainer
       

G R O U P   C O N T A I N E R   C H A N G E S


MY_EXAMPE_CONTAINER = 
[
	[[ BASIC SETTINGS ], [ TASK SETTINGS ], ( COMMUNICATION SETTINGS ), (GROUP SETTINGS), ( SPAWN POS )],
	[...]
];


BASIC SETTINGS
[ UNITS, SPAWN MARKER, (SIDE), (VEHICLE GROUP), (FUNCTION) ]
+ SIDE, VEHICLE GROUP, FUNCTION are optinal an don't need to be in this order

 

UNITS
can be ARRAY, STRING, OR CONFIG:
+ [ "O_soldier_TL_F", "O_medic_F", "O_soldier_F", "O_soldier_AR_F" ]
+ ( configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam" )
+ "fireteam"
    - this points to group compilations defined in "class groupCompilations"

+ ([ "infantry", 5, 3 ] call T8U_fnc_createUnitContainer )
    - this function can be used to create a randomized unit selection based on "class groupRandomCompilations"
        Parameters:
            TYPE:            optional, "infantry"             - type of units, check "class groupRandomCompilations"
            MIN UNITS:        optional, 4                        - min. spawned units
            RANDOM UNITS:    optional, 4, [123]],            - additional random units
            FACTION:        optional, T8U_var_EnemySide     - spawn side, check "class groupRandomCompilations"
            MOD SET:        optional, T8U_var_modSet        - modset to select from, check "class groupRandomCompilations"

 

SPAWN MARKER
can be ARRAY or STRING
+ "my_marker"
+ [ "my_first_marker", "my_second_marker" ]        - patrol tasks will work over various markers

 

SIDE

- unchanged -
+ optional, spawn side of units -> east, west, independent, civilian

 

VEHICLE GROUP
- unchanged -
+ optional, BOOL, true if vehicle group (e.g. units should not disembark on waypoints)

 

FUNCTION
- unchanged -
+ optional, STRING, function to call after units are spawned, called for each unit once


TASK SETTINGS
- unchanged -


COMMUNICATION SETTINGS
- unchanged -


GROUP SETTINGS
optional, can be ARRAY, STRING, BOOL
    + BOOL:        - true, teleport unit to first waypoint
    + STRING    - points to the config "class groupSettings" and a special AI skill setting + teleport setting (may be extended)
    + ARRAY        - [ true ], teleport unit to first waypoint (maybe more options in the array later on)


SPAWN POS
optional, can be ARRAY or STRING, custom spawn position, if you don't want the units to spawn at the task marker
    + ARRAY:    - regular position array > [0,0,0]
    + STRING:    - a marker


SOME EXAMPLES


A_EXAMPE_CONTAINER = 
[
	[[ ( configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam" ), "marker" ], [ "PATROL" ]],
	[[ [ "O_soldier_TL_F", "O_medic_F", "O_soldier_F", "O_soldier_AR_F" ], "marker" ], [ "PATROL" ]],
	[[ ([ "infantry", 5, 3 ] call T8U_fnc_createUnitContainer ), "marker" ], [ "PATROL" ]],
	[[ "squad", "marker" ], [ "PATROL" ]],
	
	[[ "squad", [ "marker_01", "marker_02" ], true, "TMP_fnc_someFunction", WEST ], [ "PATROL" ]],
	
	[[ "squad", "marker" ], [ "PATROL" ], [], "base_militia", "spawn_marker" ],
	[[ "squad", "marker" ], [ "PATROL" ], [], true, ( getPos someObject )],
	
	[ "fireteam", [ "marker_01", "marker_02" ], "TMP_fnc_someFunction", RESISTANCE, false ], [ "PATROL_MARKER", [ "ip1", "ip2", "ip3" ]], , [ false, false, false ],  "base_militia", "spawn_marker" ]]
];



CHANGELOG:

27-JAN-2017 | update to V.070

  • moved all CONFIG things to A3 config type definitions and syntax

  • T8U_fnc_loadConfig
    parse the new config

  • T8U_fnc_handleGroups
    all groups are now controlled from one single handle / loop!
    now only one spawned function controlls all groups, and not a spawned function for each group.

  • T8U_fnc_teleportGroupToCurrentWaypoint
    teleport group to first waypoint id desired

  • T8U_fnc_createUnitContainer
    create randomized unit selection based on config

  • FIXES and CHANGHES EVERYWHERE ...

 

25-JAN-2016 | update to V.061

  • new Task: OCCUPY
  • multi-marker support for PATROL type tasks
  • fixes in wp-positon finding

 

10-DEC-2015 | update to V.060

  • cfgFunctions
  • file structure
  • param / params
  • includes
  • basic macros
  • auto post init
  • better waypoint creation
  • ...

 

17-OCT-2014 | update to V.052

  • pushback/count errors fixed
  • added possibility to define a custom function for each group which will be called for each unit
  • communication var array now consists of 3 parts
  • in CONFIG: T8U_var_ZeusModul -> T8U_var_ZeusModules (now is an array where you can add multiple zeus modules)
  • other small fixes / undfined var stuff / ...

 

15-SEP-2014 | update to V.051

 


How this thing works:
1. You create "Zone" markes in the editor where you want your Units to spawn.
2. You define the Groups you want to spawn and give them a tasks they should execute in a script file.
3. Start your mission and have fun.

Ok, maybe not that easy... :)
For a quick overview of how the script works in your mission you should check the First Steps Guide I prepared.

Units are defined in groups with a task assigned to them:

ATTACK: The group will "attack" given marker (move from A to B and do SAD at B)
PATROL: The group patrols in the marker area
PATROL_AROUND: The group patrols mostly around the marker area
PATROL_MARKER: The group is spawned at a marker and then patrols a set off markers (the center positions / no area).
PATROL_URBAN: The group will patrol in the marker area, the waypoints are placed on streets
PATROL_GARRISON: The group will patrol the area and garrison buildings at it's waypoints for some time.
GARRISON: The group will garrison houses in the marker area.
OCCUPY: The group will occupy houses in the marker area.
DEFEND: The group will man static weapons and empty vehicle with turrets in the area.
DEFEND_BASE: The group will man static weapons and get in military cargo type buildings
LOITER: The group will loiter near the markers center
OVERWATCH: The group will search for a good overwatch position for the given marker poistion.

In the past I used the garrison script that Zorilya made for GARRISON and PATROL_GARRISON. Thank you Zorilya for letting me use it in my scripts! But with Zeus I encountered some problems with waypoint creation for garrisoning groups, which would create so much waypoints that your zeus players game would slow down or even freeze in MP. So I created my own very simple garrisoning script to replace Zorilyas script.

In addition the group leaders can call for help if they are attacked. If there is a unit that can respond, a flanking waypoint is generated and a SAD waypoint. Also the group leaders will share their contacts with friendly units in a short range. If the helping unit is to late to help, or all enemies are already dead, they will return to their origin task after some time.

DAC:
If you like using DAC in your missions, you can allow the group leaders to send a additional call for help to DAC. This will then result in whatever the DAC decides to do. :)

Headless Client:
I don't have a HC so this has not been tested, but there is a untested "switch" for HC in the main script files.

Other AI mods / scripts:
In the past I only used bCombat without any problems along with my script.



Download / Documentation:

( documentation not updated - 27.01.2017)

T8U - Inroduction - First Steps
PDF: First steps guide to the T8 Units script (pictures used maybe a bit outdated, they were made with a previous version of the script).
The mission you can create following the first steps guide.

T8U - CONFIG
PDF: Explenation of all the config settings.

T8U - FUNCTIONS
PDF: Explenation of the functions you can use to spawn units.

T8U - UNIT DEFINITIONS
PDF: Explenation of the different tasks you can spawn groups with.

SavageCDN prepared some group compilations to copy-paste on his GitHub (Thank you):
Group Configs @ GitHub


T8 Units Showcase Mission (V.070)

T8 Units Script V.070

T8 Units x DAC - Demo Mission (V.061)


or download as bundle @armaholic.com:

news_download_a3_3.png
T8 Units - a less dynamic AI creator V.061



GitHub
T8_Units - current V.070
T8_Units - development


Special Thanks:
Silola - because he is awesome!
MCPXXL, Lester, MemphisBelle, Darcy, SKH|Flip, SKH|Cyborg, SKH|Hydra and the 1PARA for playing and testing my stuff
KillzoneKid - for the debug console extension which helped me a lot in the past
fabrizio_T - for helping me finding cover positions
Zorilya - for the garriosn script that was a great inspiration in the past
and BIS who made me waste so much time in my text editor
Big thanks to the great arma community and have fun with my script. If you find any bugs, have a great idea to further enhance this script let me know. I don't know how or even if I will update this on a regular basis, but when I find my self in a scripting mood it is possible that I will further improve this script.



Disclaimer and License:

This script is provided as is, without warranty of any kind. The author is not responsible for any direct, indirect, incidental or consequential damage of any kind, without limitation.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to 
Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

 

Greetings from Germany
T-800a

  • Like 3

Share this post


Link to post
Share on other sites

Hi m8 :)

Thank you for this great script package. It is an asset to any dynamic mission.

Greeting

Silola

Share this post


Link to post
Share on other sites

This looks impressive, can't wait to give it a go. Thanks for all the documentation. Can't wait to see this in action T8U_var_OvSuperiority! It's something I know will be very helpful.

Share this post


Link to post
Share on other sites

This looks very interesting and of couse DAC compatibility makes it even better.

edit: had a chance to check it out.. great work!!

Edited by SavageCDN

Share this post


Link to post
Share on other sites

Thank you very much for informing us about the release :cool:

Release frontpaged on the Armaholic homepage.

** documentation, script and example mission bundled in one download!

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

What is the benefit of T8U_fnc_TriggerSpawn? I guess, that it can activate repeatedly? Can you give example of how you've used this?

I think the name is a little misleading, when reading through the pdf. Some might relate it to a editor trigger and spawning enemies. Which any of these function could be used in an editor trigger, right? (aslong as it's isServer && this, in condition)

Is there any variable that we can use when a zone is cleared? Something like T8_pubVarDataTask_laptop1 from your other script?

Edited by PlacidPaul

Share this post


Link to post
Share on other sites

Again, THX Foxhound.

Glad, you like it SavageCDN. The question you asked, befor your edited your posting: Units spawned with my script can't be called for help for DAC, this was never neccesary for me.When I use both scripts in combination, I use mine to "guard" fix positions and the DAC to cover areas. Maybe I can upload a older test/example mission later.

PlacidPaul, I created T8U_fnc_TriggerSpawn for me, to save some lines of code if I wanted a server side scripted trigger, that does some spawning. As you mentioned you could also use normal triggers created in the mission editor to do that trick. You wont even need to check for isServer in the condition. Because the functions, that you execute, are only loaded on the Server. So this should automatically be only executed on the server.

T8U_fnc_Zone: There is a variable that tells if the zone is active, but there is no one you could check if the Zone is cleared. I personally never needed that for a mission. You could check for the active varible in a additional trigger that checks for present units?!

You could check server side! for:

If the zone is activated:

missionNamespace getVariable [ "<MY UNIT CONTAINER>_active", false ];

Units in the Zone are created:

missionNamespace getVariable [ "<MY UNIT CONTAINER>_created", false ];

Or creation of units in the zone is in progress:

missionNamespace getVariable [ "<MY UNIT CONTAINER>_creating", false ];

and when a zone is cached, <MY UNIT CONTAINER> itself is set as bool (I think it is set to false) when the script could not find any cachable units.

Edited by t-800a

Share this post


Link to post
Share on other sites

Yes I figured that out once I actually took a look at the script :p In the past I would use UPSMON for guarding specific areas but of course your script will work much better!!

Share this post


Link to post
Share on other sites

Congrats on the Full Release - We use this & DAC all the time in our Missions and by far the Best AI we have played against a MUST have :)

Keep up the great work t-800a

Share this post


Link to post
Share on other sites

^ 1Para do you use any additional AI mods on your server like ASR_AI or bCombat?

Share this post


Link to post
Share on other sites

Yeah, I've had on ASR_Ai for a while now, I didn't have any problems when using it with T8U, but I didn't really see the need after looking through everything (might miss the frag grenade throws). I want to see everything working as intended first. There some really good reactions from the fn_onHitEvent.sqf, that makes for some fun gameplay. I love when AI don't follow orders constantly like the robots they are, makes them feel more human. Almost seems like morale. This shows up already in small playthroughs.

AI mods are great when the AI are off the leash, but seem to conflict with scripted orders of spawning systems, at least that's my opinion. :)

What do you guys put in the T8U_var_SuppressingUnits, just AR and MG or any others?

Also, I love the way I can build groups based around my needs with this script. This really fills a need that I was actively looking for. Great Work!

Edited by PlacidPaul

Share this post


Link to post
Share on other sites
^ 1Para do you use any additional AI mods on your server like ASR_AI or bCombat?

we have a tweaked cfgSkill in our COOP missions, but no other mods.

In my script I mostly want to issue basic orders by givem them waypoints, and not start micromanaging stuff. thats something others are way better, then me - like fabrizio_t with bcombat. :cool:

The fn_onHitEvent.sqf is just some gimmicky addition that doesnt really hurt, i think. Just something that would be a cool additon.

Share this post


Link to post
Share on other sites

This is a cool script but on dedicated servers at least it ran for every client when use HC was disabled, leading to like 400 AI and about 4 fps

I believe this was because if (isServer) is under the useHC if statement and is exiting the if statement rather than the script.

Share this post


Link to post
Share on other sites
This is a cool script but on dedicated servers at least it ran for every client when use HC was disabled, leading to like 400 AI and about 4 fps

I believe this was because if (isServer) is under the useHC if statement and is exiting the if statement rather than the script.

Thanks, this one slipped through, that's what happens when you dont test your stuff properly. -.-

In my coop missions on dedicated servers I do not execute this from the init directly, but from a file which is only executed on the server. So this never was a problem. -.-

Could you replace this:

if ( T8U_var_useHC ) then 
{
if ( isDedicated ) exitWith {};
waitUntil { !isNull player };
if ( hasInterface ) exitWith {};	
} else {
if ( !isServer ) exitwith {};
};

with this:

private [ "_exit" ]; _exit = false;
if ( T8U_var_useHC ) then { if ( isDedicated ) then { _exit = true; } else { waitUntil { !isNull player };	if ( hasInterface ) then { _exit = true; }; }; } else { if ( !isServer ) then { _exit = true; }; };
if ( _exit ) exitWith {};

and tell me if this works for you?

Edited by t-800a

Share this post


Link to post
Share on other sites

updated script to version V051:

  • (hopefully) fixed the error Kerc Kasha mentioned
  • small changes for (civillian) garrison task
  • added demo mission for a possible combination of T8U with DAC

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

** documentation, script and example mission bundled in one download!

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

All the effort swapping out spawn code to T8 has definitely been worth it! The easy caching alone is a huge help.

I'm running into a problem with the zeus integration. I'm unable to get the T8 spawned units to show up in Zeus without the use of ADV_Zeus. Am I misunderstanding the integration option in the config or missing a function (didn't see anything zeus related in a quick skim)?

Player - zeus1

GameMaster Module - gm1

gm1 is synchronized to zeus1

Share this post


Link to post
Share on other sites
I'm running into a problem with the zeus integration. I'm unable to get the T8 spawned units to show up in Zeus without the use of ADV_Zeus. Am I misunderstanding the integration option in the config or missing a function (didn't see anything zeus related in a quick skim)?

Glad you like it Daishiknyte!

Have a look at the T8_UnitsCONFIG.sqf and find: T8U_var_AllowZEUS

for your case you should set this to:

// Options to register units with ZEUS
// this may slow down spawning
T8U_var_AllowZEUS		= true;	// Register spawned units with ZEUS
T8U_var_ZeusModul		= gm1;	// name of the Zeusmodul to sync all units to (Gamemaster Modul) // comment out if T8U_var_AllowZEUS is false

Share this post


Link to post
Share on other sites

Just triple checked. The gamemodule and the zeusmodul parameter match. Let me pop open y'alls demo mission again to see if I laid everything down correctly.

Any thoughts to allowing "GARRISON" to teleport units directly to their final destination? Considering how long it takes the AI to get to their chosen destination at times, the instant move really cuts down on the extra time/distance that needs to be factored into the spawn trigger.

Thanks!

Edit: Tried clearing the zeus module and replacing it. Still no luck.

Edit Edit: Just tried the mission y'all packaged with the latest update. Units are not being added to Zeus menu.

Edit Edit Edit: But units do add to zeus if I login to MCC first?

Edited by Daishiknyte

Share this post


Link to post
Share on other sites

Does it work for you if try my showcase mission without any addons?

Share this post


Link to post
Share on other sites

Well, that's frustrating. A3Sync was reporting all mods disabled. The whole damn pack was still loading up.

AI sync with Zeus perfectly fine without mods on.

Edit: Confirmed MCC being the problem. With MCC enabled, zeus must log into MCC before being able to synch. Once logged into MCC, the sync is immediate and operates as expected.

Edited by Daishiknyte

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

×