_Clockwerk 12 Posted December 29, 2024 Happy Holidays! I am having an issue with BIS_fnc_respawnTickets. I set up a mission to give the BLUFOR team 3 respawn tickets per player at the start of the match, and when testing in the editor it works fine. However, when I run the mission on my dedicated server, the code behaves as if TWO players are connected rather than just me. So I end up with 6 respawn tickets for just myself. I figured if the code was just picking up the headless client, I could just use ((3 * _numPlayers) - 3) and everything would be fine, but no. This apparently sets the respawn Tickets to -1 (which is essentially infinite respawns). So I'm completely lost as to what is happening with this code. I have these lines in my init.sqf _numPlayers = playersNumber west; _startTickets = [west, (3 * _numPlayers)] call BIS_fnc_respawnTickets; _respawnTickets = [west, 0] call BIS_fnc_respawnTickets; while {isServer} do { // End Conditions private _playersAlive = {alive _x} count playableUnits; private _respawnTickets = [west, 0] call BIS_fnc_respawnTickets; private _numLocationsCaptured = missionNamespace getVariable "_numLocationsCaptured"; private _numLocationsGenerated = missionNamespace getVariable "_numLocationsGenerated"; if ((_respawnTickets == 0) && (_playersAlive == 0)) exitWith { "EveryoneLost" remoteExec ["BIS_fnc_endMissionServer", 0, true]; }; if (_numLocationsCaptured == _numLocationsGenerated) exitWith { "EveryoneWon" remoteExec ["BIS_fnc_endMissionServer", 0, true]; }; sleep 20; }; I tried broadcasting _respawnTickets with setVariable and referencing it in inner scopes with getVariable under the missionNamespace, but then it wouldn't update the tickets at all. If anyone has any ideas of what I'm doing wrong, please let me know. EDIT: So I've quickly realized that this is a headless client issue, but like I said above even subtracting 3 tickets after the fact leaves me with -1 tickets. So I'm still lost EDIT 2: Even this code returns 6 tickets when I am the only player connected. I was hoping that since the headless client spawns in the corner of the map that it wouldn't be counted, but maybe I'm wrong. Doesn't help that I can't seem to access the debug console on my dedicated server for some reason, even when I log in using the admin password. _nearPlayers = zCurator nearObjects ["Man", 150]; _numPlayers = {isPlayer _x} count _nearPlayers; _startTickets = [west, (3 * _numPlayers)] call BIS_fnc_respawnTickets; EDIT 3: So come to find out, this was not a matter of incorrectly counting players, but running the script an incorrect number of times. The dedicated server was running the code once on the client and once on the server (from what I understand) so I added { if {!isServer} exitWith {}; } and everything is A-Ok. 3 Respawns per player as I intended. Share this post Link to post Share on other sites