Jump to content
Sign in to follow this  
lordprimate

Help with Headless client Please

Recommended Posts

Hello all,

I am trying to implement a headless client and I cannot get the units to spawn.. using info found all over this site i have started with this..

in my descritpion.ext: so that I can choose HeadlessClient usage or not.

class Params

{

class HeadlessClient

{

title = "Headless Client";

values[] = {0,1};

texts[] = {"OFF","ON"};

default = 0 ;

};

};

then in my Init.sqf : to set the variables for the HC usage or not.

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";

};

};

and finally in my spawn script: a .sqf that spawns a team or a squad on a marker then moves them into positions in buildings via shkBuildingpos.sqf.

//execute DAC on HC if present, otherwise on Server

if(HCPresent) then{

if(!hasInterface && !isServer) then{

_spawnPos = markerPos (_this select 0);

_grp= _this select 1;

_grp = [getMarkerPos "spawn_in", East, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad"),[],[],[(0.1+(random 0.4)),(0.4+(random 0.4))]] call BIS_fnc_spawnGroup;

sleep 0.1;

0=[_spawnPos,units _grp,35,0,[0,4],true] execvm "scripts\shk_buildingpos.sqf";

};

} else{

if(isServer) then{

_spawnPos = markerPos (_this select 0);

_grp= _this select 1;

_grp = [getMarkerPos "spawn_in", East, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad"),[],[],[(0.1+(random 0.4)),(0.4+(random 0.4))]] call BIS_fnc_spawnGroup;

sleep 0.1;

0=[_spawnPos,units _grp,35,0,[0,4],true] execvm "scripts\shk_buildingpos.sqf";

};

};

when testing the mission on my server, Units spawn when the HC option in the params is turned off...

However, when i enable the HC in the params. and return to the area where the AI should spawn.. Nothing happens... its a real drag and I am clueless as to why its not working! Any help would greatly be appreciated!!

And just to be completely clear about the HC, the headless client is connected and running.. in its proper slot

Edited by Lordprimate

Share this post


Link to post
Share on other sites
Did you setup an unit which represents the HC in game?

yes, just read the last sentence. (.....in its proper slot)

I have also tried making a mission that doens't have the option to choose whether HC is enabled or not.. With the headless client hard coded as the only option.. I still cannot get the units to spawn.

The code pasted in the OP is copied and pasted from another source that was said to work.. so Im a bit confused as to why its not working.

Share this post


Link to post
Share on other sites
Is variable hasInterface equal to false ?

Is marker nameed spawn_in present ?

Alse read and use debugging techniques.

1. I think that is checked in the statement "if(!hasInterface && !isServer) then{"...... so as far as i know the HC would be ID'd at that check..?

2. Yes

about debugging, I almost always run -showscripterrors, and I see no script error popups. I will download Troopmon3 for Arma 3 now and see if that can do anything to find out the issue. I have sifted threw the code to make sure that I have no missing ; { } , etc. I also have notepad++ to check stuff out and I just dont get it( the not spawning issue)..

Edited by Lordprimate

Share this post


Link to post
Share on other sites

Well that means your code works. You just have bad logic in it. Most likely conditions in 'ifs' are not met.

Iam unsure about if(!hasInterface && !isServer) , in your code snippets i didn't find anything that would set hasInterface to false, also did you run your HC as client (not a server) ?

Also use hint 'something'; player globalChat 'something'; or diag_log 'something'; to find out whether your desired code is executed. Iam guessing that the HC spawn code is not even executed.

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  

×