frankiie 10 Posted May 20, 2013 Any easy way to set a simple kills limit which makes game end once reached? Share this post Link to post Share on other sites
frankiie 10 Posted May 27, 2013 Still looking for this... anyone ? Share this post Link to post Share on other sites
LoonyWarrior 10 Posted May 27, 2013 let me try... :) init.sqf enableSaving [false, false]; sGameOver = nil; pLimitScore = 30; pLimitTime = 600; if (isServer) then { #include "initServer.sqf" }; if (!isDedicated) then { #include "initClient.sqf" }; initServer.sqf if (isServer) then { if (pLimitScore > 0 || pLimitTime > 0) then { _sLimitScript = [pLimitScore, pLimitTime] execVM "Server\_server.sqf"; }; }; initClient.sqf if (!isDedicated) then { #include "Client\functions.sqf" cTaskMain = nil; if (!isServer) then { "sGameOver" addPublicVariableEventHandler { call SetMissionEnd; }; }; waitUntil { !isNull player }; ["objMarkerMain"] spawn SetMissionTask; }; Client\functions.sqf if (!isDedicated) then { SetMissionEnd = { if (!isNil "sGameOver") then { if (!isNull player) then { _taskState = "Failed"; _victory = false; if (side player == east and sGameOver == "END1") then { _taskState = "Succeeded"; _victory = true; }; if (side player == west and sGameOver == "END2") then { _taskState = "Succeeded"; _victory = true; }; if (!isNil "cTaskMain") then { cTaskMain setTaskState _taskState; }; [sGameOver, _victory, 2] call BIS_fnc_endMission; } else { endMission sGameOver; }; }; }; SetMissionTask = { if (!isNull player && isNil "cTaskMain") then { _taskMarker = _this select 0; if (!isNil "_taskMarker") then { cTaskMain = player createSimpleTask ["objMainTask"]; cTaskMain setSimpleTaskDestination (getMarkerPos _taskMarker); cTaskMain setSimpleTaskDescription [Localize "MissionTaskDescription", Localize "MissionTaskTitle", Localize "MissionTaskWaypoint"]; player setCurrentTask cTaskMain; }; }; }; }; Server\_server.sqf if (isServer) then { _end = nil; _limitScore = _this select 0; _limitTime = (_this select 1) - 2; _processScore = false; _processTime = false; if (!isNil "_limitScore" && !isNil "_limitTime") then { if (_limitScore > 0) then { _processScore = true; }; if (_limitTime > 0) then { _processTime = true; }; while { isNil "_end" } do { _scoreEast = scoreSide east; _scoreWest = scoreSide west; if (_processScore) then { if (_scoreEast >= _limitScore || _scoreWest >= _limitScore) then { if (_scoreEast > _scoreWest) then { _end = "END1"; }; if (_scoreEast < _scoreWest) then { _end = "END2"; }; }; }; if (_processTime) then { _timeLeft = _limitTime - time; if (_timeLeft <= 0) then { if (_scoreEast > _scoreWest) then { _end = "END1"; }; if (_scoreEast < _scoreWest) then { _end = "END2"; }; if (_scoreEast == _scoreWest) then { _end = "END3"; }; }; }; if (!isNil "_end") then { sGameOver = _end; publicVariable "sGameOver"; if (!isDedicated && !isNil "SetMissionEnd") then { call SetMissionEnd; } else { endMission _end; }; } else { sleep 2; }; }; }; }; description.ext debriefing = 1; class CfgDebriefing { class End1 { title = "end1 title"; subtitle = "end1 subtitle"; description = "end1 description"; picture = "b_inf"; pictureColor[] = {0.0,0.3,0.6,1}; }; class End2: End1 { title = "end2 title"; description = "end2 description"; }; class End3: End1 { title = "end3 title"; description = "end3 description"; }; }; Share this post Link to post Share on other sites
D1Z4STR 1 Posted June 28, 2013 Is this for single player or multiplayer? I have just implemented this into my multiplayer mission and only I am seeing the win condition title and picture stuff, no one else sees anything. Not sure what im doing wrong Share this post Link to post Share on other sites
LoonyWarrior 10 Posted June 29, 2013 Is this for single player or multiplayer? I have just implemented this into my multiplayer mission and only I am seeing the win condition title and picture stuff, no one else sees anything. Not sure what im doing wrong it was for MP and it worked... anyway i already made better method but i have to finish it... i will post it later... today.. Share this post Link to post Share on other sites
D1Z4STR 1 Posted June 29, 2013 Ok thanks! look forward to it Share this post Link to post Share on other sites
LoonyWarrior 10 Posted June 29, 2013 Limit Score & Time function LW_fnc_teamDeathmatch_serverLimitScoreAndTime takes 4 arguments.... [score limit, time limit, overtime, check delay] time limit is in seconds overtime is in seconds too, mission is extended for overtime if the end is draw... check delay between 0.5 and 5, default 2 if u want execute some function on the end use LW_event_teamDeathmatch_server_MissionEnd Share this post Link to post Share on other sites
D1Z4STR 1 Posted June 29, 2013 Cool going to check this out now for my TDM map, cool for releasing Share this post Link to post Share on other sites
2rgt oberst 14 Posted November 14, 2013 Limit Score & Timefunction LW_fnc_teamDeathmatch_serverLimitScoreAndTime takes 4 arguments.... [score limit, time limit, overtime, check delay] time limit is in seconds overtime is in seconds too, mission is extended for overtime if the end is draw... check delay between 0.5 and 5, default 2 if u want execute some function on the end use LW_event_teamDeathmatch_server_MissionEnd hello, I tried to follow the link posted does not work ... you can restore the file? I was also interested in the scores. hello and thanks Share this post Link to post Share on other sites