Author: elec
Author Website:

Requirements: No addons required

Version: 1.0b

Short description: This script check if you have a headlessclient connected to your mission and switch automatically between server or HC execution of your scripts.

Date: 2013-05-20 17:16

Comments: (0)


HeadLessClient Auto Detection Switch


I wrote a script to auto-detect a headlessclient and let the mission be able to choose it to spawn units or do script stuff on it.
Basically it's just a "auto" switch that ask if a HC is connected. If so, your scripts - like upsmon or whatever - will execute on it. If not the scripts will run on the server like normal.

The thing is, you don't have to be change your "if (!isServer) exitWith{};" every time you build a headlessclient mission local to test it.
Also if you want to build a mission that should be able to spawn your units on a headless client but it should be also run if no headless client is available or something like that.

Installation / Usage:
Read the notes in elec_HC_detect.sqf!

I have build a example mission to test out the proper working of the script. You can spawn units whit a radio trigger and check in the sidechat where they running.
Also I have implemented a switch that you can force HC or Server execution if you need.

Copy "elec_HC_detect.sqf" into your mission folder and add this code in the !! FIRST !! line of your init.sqf:
elec_HC_detect = ["auto"] execVM "elec_HC_detect.sqf"; waitUntil {scriptDone elec_HC_detect};
//    ========SWITCH========
//     Use "auto" to autodetect if a headless client is connected and force execution on it.
//     Use "on" to force the execution of your scripts on the HC, even he is not connected to the server. 
//    (so your scripts won't execute if no HC is connected to the server)
//     Use "off" to force server execution.

//    Replace your 
//     line with 
        if(elec_stop_exec == 1) exitWith{};
//    in your scripts, that you want to execute over the switch.

If you have any question just use this thread to ask.

- initial release

Forum topic:
- BI forums

- Arma 2: Operation Arrowhead Beta patch 101032 or higher
- HeadLessClient-Server setup (optional)

Enable javascript to be able to download from Armaholic please!

Tags: Client,   Headless,   Server