Jump to content

Recommended Posts

I am pretty new to scripting and Arma 3 mission editing in general.
I want to create a template mission that I can copy code from and such for future missions, I am currently trying to figure out spawning AI with triggers and have made a separate post on that topic.

I want to implement a headless client into this mission to improve performance, I want to avoid using mods if possible and would rather keep everything vanilla. I have looked into the Headless Client

wiki page and many videos and guides, however I am still pretty much at square one trying to figure this out.

Essentially what I want is for AI spawned via triggers, throughout the mission to be automatically transferred to the headless client if one is available, otherwise to continue normally if there is no headless client available.
I would also like to know how to setup the headless client in general, my smooth brain does not understand the explanations given on the wiki page for the Headless Client, a step by step explanation would be very useful to me.

Thanks any help is appreciated. ❤️

  • Like 1

Share this post


Link to post
Share on other sites

Gmate, I'm kind of in the same boat as you. I've been making and hosting missions for years now and know that when things get busy in a mission, triggers don't fire, ai won't act as they should etc.

The one thing I've always wondered is, does HC only work on dedicated servers or can they work in a hosted session?

Share this post


Link to post
Share on other sites
10 minutes ago, fawlty said:

Gmate, I'm kind of in the same boat as you. I've been making and hosting missions for years now and know that when things get busy in a mission, triggers don't fire, ai won't act as they should etc.

The one thing I've always wondered is, does HC only work on dedicated servers or can they work in a hosted session?

 

There is no reason HC can't be client of an hosted MP mission. The question is just a little bit weird because, if you can have a Headless Client, why don't you give it the status of server, so dedicated?

  • Like 2

Share this post


Link to post
Share on other sites

No what I meant was, does HC only work on dedicated servers?

 

There's probably more to HC than what I understand but if HC only works on a dedicated server then that's not the route I'm interested in.

 

Sorry for the diversion Gmate

Share this post


Link to post
Share on other sites

HC is a client with no player. It works from where you want, as any other client: on a remote internet PC, a local LAN PC or even another session of a same PC (any). In the last case, you just have to think about PC resource sharing: does it worth it? Only tests could answer that.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I think in your mission, you can just add the headclient module from 3den, F5, modules, set your mission to MP and let the headclient connect to your host or server. The headclient needs to be named to match whatever you had set it as in the module, as well. It should simply take over any AI that is server side offloaded from main server. 

Share this post


Link to post
Share on other sites
3 hours ago, Valken said:

It should simply take over any AI that is server side offloaded from main server. 

I doubt that simply placing the module will take the AI over automatically. I guess you have to ensure that the mission spawns the AI on the HC. But Im not entirely sure bout it ... but nearly sure.

  • Like 2

Share this post


Link to post
Share on other sites
32 minutes ago, sarogahtyp said:

I doubt that simply placing the module will take the AI over automatically. I guess you have to ensure that the mission spawns the AI on the HC. But Im not entirely sure bout it ... but nearly sure.

 

Right. That's explained in the BIKI link I wrote above (you can even choose running or not the HC as mission parameter).

Share this post


Link to post
Share on other sites

You guys are correct in needing to "assign" the AI to the HC via a script. When I did my testing, I actually used Werthles Headless Kit v2.3 with scripts he already made:

 

https://steamcommunity.com/sharedfiles/filedetails/?id=459317544

 

Just drop these into your mission folder where the mission.sqm is, edit the files as instructed, add the headclient modules from 3den and walla...

 

It works 99% of the time.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Do not screw your mission performance with overcomplicated scripts. Here is how to use the vanilla HC system, tasted on dedicated:
 

//SPAWN UNITS  ON HEADLESS CLIENT
//make headless client entity, variable name HC1, playable, role name "HC1"
//init.sqf

HC1Present = if (isNil "HC1") then {false} else {true};

if (HC1Present && isMultiplayer) then {
if (!isServer && !hasInterface && triggerActivated patrol_trg) then {
[]execVM "ai_patrol.sqf";
 } else {};
} else {hint "Headless not initiated!"};

//ai_patrol.sqf

infgrpJ = [[3490.51,993.939,0], independent,   
(configfile >> "CfgGroups" >> "Indep" >> "UK3CB_TKM_I" >> "Infantry" >> "UK3CB_TKM_I_MG_Squad")] call BIS_fnc_spawnGroup;  
infgrpJ deleteGroupWhenEmpty true;   
infgrpJ setCombatMode "RED";  
[infgrpJ, [3490.51,993.939,0], 50] call BIS_fnc_taskPatrol;

//you can add as many ai groups you want and they will spawn according to the triggers you want
//here is the init.sqf of one of my mission with all ai that will spawn during the mission 

HC1Present = if (isNil "HC1") then {false} else {true};

if (HC1Present && isMultiplayer) then {

if (!isServer && !hasInterface) then {
[]execVM "ai_patrols.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated town_trg) then {
[]execVM "ai_towns.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated tower_trg) then {
[]execVM "ai_tower.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated sufahan_trg) then {
[]execVM "ai_sufahan.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated succ1) then {
[]execVM "ai_nasul.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated succ2) then {
[]execVM "ai_base.sqf";
 } else {};

if (!isServer && !hasInterface && triggerActivated exfil_trg) then {
[]execVM "ai_exfil.sqf";
 } else {};
 
} else {hint "Headless not initiated!"};

Yes, its rough and kinda dumb but is working as Kalashnikov. 🤟

 

  • Like 1

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

×