total 1 Posted April 1, 2014 (edited) Good evening, I must admit that I get really confused when I read about headless clients and I hope one can put me on the right track again. I want to make UPSMON missions with many AI's, which should only be used with a headless client. What changes should I make to my mission/UPSMON config, so all the AI calculations are transferred to my headless client? No matter what I do, all the AI calculations run on the server and one person said it was a quick way to get all the units that spawn via UPSMON to be connected directly to the headless client. How? I hope someone can help me! :jail: SOLVED Edited April 9, 2014 by Total Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 (edited) I use UPSMON, and I see that all UPSMON configuration files has this: / / SERVER OR HEADLESS CLIENT CHECK if (! isServer && hasInterface) exit with {}; Is it possible to connect the HC to the units added with the editor? Or must all be done via scripts, after the mission start? If someone could tell me what I'm doing wrong or maybe make me a small spawn script, which show how I can get my headless client to work, I will be eternally grateful! description.ext class Params { class HeadlessClient { title = "Headless Client"; values[] = {0,1}; texts[] = {"OFF","ON"}; default = 0 ; }; }; init.sqf if(isNil "paramsArray") then{ paramsArray=[0,0,0]}; //get mission parameter to see if //HeadlessClient is present and assign its name if(paramsArray select 0 == 1) then{ if(isServer) then{ HCPresent = true; publicVariable "HCPresent"; }; if (!hasInterface && !isServer) then{ HCName = name player; publicVariable "HCName"; }; } else{ if(isServer) then{ HCPresent = false; HCName = "NOONE"; publicVariable "HCPresent"; publicVariable "HCName"; }; }; Edited April 2, 2014 by Total Share this post Link to post Share on other sites
Magirot 14 Posted April 2, 2014 You probably already know this, but: nothing happens automatically after you've set up the HC itself. Locality reminder: The player's unit is always local to its client AI units are always local to the client of their leader A vehicle is always local to the client of its driver AI leaders are always local to the server, if placed in the mission editor AI units created after mission start via scripting will be local to the computer that issued the command Empty vehicles/objects placed in the mission editor are local to the server Empty vehicles/objects created after mission start via scripting (with createVehicle for example) are local to the machine that issued the command And HC makes use of the bolded points, which is why in my knowledge the normal (or most basic?) procedure for HC setup is to Check if the client is a HC in init.sqf. If it is, spawn everything through that client by script, to ensure that they will be local to the HC. I guess the reason for saying UPSMON is easy to use with a HC is that it'll handle the waypoints? Especially since there's a command called setOwner for transferring the locality of a unit, and I heard WP's aren't part of that transfer. So, I have zero experience of HC's, but it should be something like this? if isServer then { HCServerSetup = FALSE; publicVariable "HCServerSetup"; _hc_clientID = owner that_immortal_bunny; _playerIDpool = []; { _playerIDpool = _playerIDpool + [owner _x]; } forEach playableUnits; _playerIDpool = _playerIDpool - [0]; // 'owner' returns 0 if it's not a client { if ( !((owner _x) in _playerIDpool) ) then { _x setOwner _hc_clientID; }; } forEach allUnits; // probably should be for vehicles as well? HCServerSetup = TRUE; publicVariable "HCServerSetup"; }; // no interface and not a dedicated server = HC if (!hasInterface && !isDedicated) then { waitUntil { HCServerSetup }; { if (!isPlayer && leader group _x == _x) then { [_x, "upsmonareamarker"] execVM "UPS.sqf"; // UPSMON script here }; } forEach allUnits; }; I'd be really surprised if that worked as-it-is, but that should be the general idea? The information is scattered but it's there, on Google and the Server Admin forum. Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 (edited) Thank you, Magirot, for your post. I still have problems though :( But should't this work? if(isNil "paramsArray") then{ paramsArray=[0,0,0]}; //get mission parameter to see if //HeadlessClient is present and assign its name if(paramsArray select 0 == 1) then{ if(isServer) then{ HCPresent = true; publicVariable "HCPresent"; }; if (!hasInterface && !isServer) then{ HCName = name player; publicVariable "HCName"; }; } else{ if(isServer) then{ HCPresent = false; HCName = "NOONE"; publicVariable "HCPresent"; publicVariable "HCName"; }; }; if(!isServer) then {waitUntil{!isNull player}}; //Init UPSMON script call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; //execute spawnscripts on HC if present, otherwise on Server if(HCPresent) then{ if(!hasInterface && !isServer) then{ execVM "spawnscript1.sqf"; execVM "spawnscript2.sqf"; execVM "spawnscript3.sqf"; }; } else{ if(isServer) then{ execVM "spawnscript1_small.sqf"; execVM "spawnscript2_small.sqf"; execVM "spawnscript3_small.sqf"; }; }; Maybe I need to put "setowner" in the spawn scripts? I think I only need this if I want to transfer existing units. if !(isServer) exitWith{}; _HC = _this select 0; _list = _this select 1; OC_pass = 0; OC_fail = 0; for "_i" from 0 to ((count _list)-1) do{ _unit = _list select _i; if(_unit setOwner (owner _HC)) then{ OC_pass = OC_pass + 1; } else{ OC_fail = OC_fail + 1; }; }; publicVariable "OC_pass"; publicVariable "OC_fail"; Edited April 9, 2014 by Total Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 (edited) Is there no one who can say if this is right / wrong? Something must be wrong since it doesn't work! Units Spawn, but on server side and not on my HC. :crazy: :crazy: HELP PLEASE! Edited April 2, 2014 by Total Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 (edited) :depressed: Can someone at least say that the script I'm using <<looks>> correct? I've tried everything I can think of. :( Will my dedicated client automatically connect to my rabbit called HC? Edited April 2, 2014 by Total Share this post Link to post Share on other sites
Magirot 14 Posted April 2, 2014 if(isNil "paramsArray") then{ paramsArray=[0,0,0]}; It's possible to assign a value to paramsArray? Will my dedicated client automatically connect to my rabbit called HC? On default no, you'll need to assign the HC into the slot as an admin, but you manually can put forceHeadlessClient=1; under the unit in mission.sqm, after which it'll pick that unit automatically. I can't tell what's wrong with your scripts (as said I have no experience of HC's), still you shouldn't need setOwner if the HC spawns the units on itself. Hopefully someone can help you, though maybe you'd have a better chance of getting answers in the headless client thread? Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 Okey, I have forceHeadlessClient=1; on my Headless rabbit :) Thank you, Magirot. I will try a little further. Share this post Link to post Share on other sites
total 1 Posted April 2, 2014 (edited) Right now I struggle with my HC gets kicked from the server. Steam ticked failed [null] The server is running standalone, HC has its own license and Battleye is disabled. Both on the same box. 22:19:27 Dedicated client created. 22:19:31 > Player HC connecting 22:21:01 > You were kicked off the game. 22:21:02 Client connected: 127.0.0.1:2382 22:21:03 > Player HC connecting EDIT: Restarted Steam and its working. :o Edited April 3, 2014 by Total Share this post Link to post Share on other sites