o5_ 7 Posted December 18, 2017 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
pierremgi 4694 Posted December 18, 2017 I don't understand the waitUntil {!isNull player} on !hasInterface PC . are HCs players? Share this post Link to post Share on other sites
o5_ 7 Posted December 18, 2017 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
o5_ 7 Posted December 19, 2017 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
pierremgi 4694 Posted December 19, 2017 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