Jump to content
Sign in to follow this  
o5_

DISCUSSION/QUESTION: most efficient way to register headless clients?

Recommended Posts

Here is what I currently use....

 

Init.sqf:

    if ((not (hasInterface)) and (not (isDedicated))) then {
        [] spawn {
            waitUntil {!isNull player};
            HC_init = (vehicle player);
            publicVariableServer "HC_init";
        };
    };

initServer.sqf:

missionNamespace setVariable ["HCs",[]];

"HC_init" addPublicVariableEventHandler {
    _hc_name = (_this select 1);
    _hc_id   = (owner _hc_name);
    _hcs = (missionNamespace getVariable "HCs");
    _hcs set [(count _hcs), [_hc_name,_hc_id]];
    missionNamespace setVariable ["HCs",_hcs];
};

 

 

as the title says, is there a more efficient way to accomplish this? Thanks.

Share this post


Link to post
Share on other sites

I don't understand the waitUntil {!isNull player} on !hasInterface PC . are HCs players?

Share this post


Link to post
Share on other sites

Yes they are. And I like to make my missions with AI enabled so my scripts don't fail when looking for variables (entities). With that said I wait for the player or headless client to initialize to avoid errors.

Share this post


Link to post
Share on other sites

The other way I was using was...

{
	if (_x isKindOf VRENTITYCLASSNAME) then {
		...
	};
} forEach allEntities;

the only issue with this is with AI enabled if on of the virtual entities is controlled by AI and not a player (or PC) it will still show up in the list and break scripts

Share this post


Link to post
Share on other sites

Why don't you register the HCs only on server?

You could wait for HCs becoming remote:

waituntil {! local HC1};

_owner = owner HC1;

I'm not familiar with that, but your post is interesting. I hope to learn for this "dark" side of server. I wonder wether a hosted server could benefit of some remote HC on a second PC...

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  

×