Advertisement
Guest User

DedicatedServer.bat

a guest
Jul 20th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. set Options=Depot_All?Game=TH?LightingScenario=Day?TerroristCount=40?RoundTime=3600
  4.  
  5. :: MapList
  6. :: ----------------------------------------------------
  7. :: To use a map list, make sure it is located under /GroundBranch/MapLists
  8. :: and then use the command line "MapList=<NameOfMapList>".
  9. :: e.g. Options=MapList=TerroristHunt
  10. ::
  11. :: To create a map list, run a non-dedicated server build of Ground Branch.
  12. :: Bring up the console.
  13. :: Type 'ShowServerManagementTools' and select MapListEditor.
  14. :: Once created, export your map list.
  15. :: If you are using a dedicated server build, make sure you move your newly
  16. :: created map list to the a dedicated server install location.
  17.  
  18. :: Maps                     Lighting Scenarios          Game Modes
  19. :: -------------------------------------------------------------------------------
  20. :: Depot_All                Day, Night                  TE, TH
  21. :: Depot_Compound           Day, Night                  DM, TDM, TE
  22. :: NatureArea               Day, Night                  DM, TDM
  23. :: TankerShip_All           Day, Night                  DM, TDM, TE, TH
  24. :: TankerShip_RearOnly      Day, Night                  DM, TDM, TE
  25. :: SmallTown                Day, Night                  DM, TDM, TE, TH
  26. :: StorageFacility          Day                         TE
  27. :: PowerStation             Day, Night                  DM, TDM, TE, TH
  28.  
  29. :: Game Modes
  30. :: i.e. ?Game=<game mode name or alias>)
  31. :: ----------------------------------------------------
  32. :: TeamElimination or TE
  33. :: TerroristHunt or TH
  34. :: DeathMatch or DM
  35. :: TeamDeathMatch or TDM
  36.  
  37. :: Other options (after map, separated using "?")
  38. :: e.g. Running Depot All Team Elimination with 5 minute round time & 60 second warmup.
  39. ::      Options=Depot_All?Game=?TE?RoundTime=300?WarmupTime=60
  40. :: --------------------------------
  41. :: LightingScenario         What daytime to load.
  42. ::                          Day or Night.
  43. :: TimeLimit                End the game and change map after this many minutes has passed.
  44. ::                          0+ min.
  45. :: ReadyCountdownTime       Delay before sending everyone that is ready to the gameplay area.
  46. ::                          5+ sec.
  47. :: PreRoundFreezeTime       How long keep people frozen before the round begins.
  48. ::                          5+ sec.
  49. :: RoundTime                How long each round should go for.
  50. ::                          20+ sec.
  51. :: PostRoundDelayTime       End of round delay before sneding everyone back to the ready room.
  52. ::                          5+ sec.
  53. :: TerroristCount           How many terrorists to load when Terrorist Hunt gametpe is selected.
  54. ::                          0+
  55.  
  56. :: There is no need to modify anything below this point.
  57. :: It is a script to find the correct executable file and restart the server if it goes down.
  58.  
  59. set "BinPath=.\GroundBranch\Binaries\Win64\"
  60. set "EngineBinPath=..\GBEngine\Engine\Binaries\Win64\"
  61. set "ProjectPath=%cd%\GroundBranch.uproject"
  62. set "ServerCommand=-server -log"
  63.  
  64. :Find_Exec
  65. if exist %BinPath%GroundBranchServer-Win64-Shipping.exe (
  66.     @echo GroundBranchServer-Win64-Shipping.exe is valid.
  67.     set "Exec=%BinPath%GroundBranchServer-Win64-Shipping.exe"
  68. ) else if exist %BinPath%GroundBranch-Win64-Shipping.exe (
  69.     @echo GroundBranch-Win64-Shipping.exe is valid.
  70.     set "Exec=%BinPath%GroundBranch-Win64-Shipping.exe"
  71. else if exist %BinPath%GroundBranchServer.exe (
  72.     @echo GroundBranchServer.exe is valid.
  73.     set "Exec=%BinPath%GroundBranchServer.exe"
  74. ) else if exist %BinPath%GroundBranch.exe (
  75.     @echo GroundBranch.exe is valid.
  76.     set "Exec=%BinPath%GroundBranch.exe"
  77. ) else if exist %EngineBinPath%UE4Editor.exe (
  78.     @echo UE4Editor.exe is valid.
  79.     set "Exec=%EngineBinPath%UE4Editor.exe %ProjectPath%"
  80.     set NoLoop=True
  81. ) else (
  82.     @echo Couldn't find .exe to use!
  83.     goto Exit
  84. )
  85.  
  86. :Start_Server
  87.  
  88. start "Dedicated Server" /max %Exec% %Options% %ServerCommand%
  89.  
  90. :: Skip the loop if asked too.
  91. if defined NoLoop goto Exit
  92.  
  93. :Check_Task_Loop
  94.  
  95. @echo Waiting for server executable to no longer exist in task list.
  96.  
  97. :: Waits 30 seconds, then checks for executable in task list.
  98. :: If it isn't found, the server will be restarted using the existing options.
  99. >NUL timeout /nobreak /t 5
  100.  
  101. tasklist | findstr /i "Dedicated Server"
  102.  
  103. if %errorlevel% neq 0 goto Restart
  104.  
  105. cls
  106.  
  107. goto Check_Task_Loop
  108.  
  109. :Restart
  110.  
  111. @echo Server executable no longer in task list.
  112. >NUL timeout /nobreak /t 5
  113.  
  114. for /l %%# in (5,-1,1) do (
  115.     cls
  116.     set/p "=Restarting dedicated server in %%#..."<NUL:
  117.     >NUL timeout /nobreak /t 1
  118.     )
  119. cls
  120.  
  121. goto Start_Server
  122.  
  123. :Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement