menus_bot.cfg 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // bot menus and tools
  2. newmenu botmaps
  3. const genbotmaps [
  4. looplist $arg1 listmapname [
  5. menuitemmapload $listmapname (concat "tmp_botmap =" $listmapname "; startbotmap")
  6. ]
  7. ]
  8. // problems with quite a number of maps when playing against bots (waypoints simply flooded) have lead to generating lists to avoid these
  9. //known issues on: (BTDM) ac_alcove ac_aqueous ac_avenue ac_coal ac_depot ac_kazemat ac_keller ac_outpost ac_power ac_shine ac_terros ac_urban
  10. const __bot_maps_all [ac_africa ac_arabian ac_arctic ac_arctic2 ac_arid ac_complex ac_desert ac_desert2 ac_desert3 ac_douze ac_dusk ac_edifice ac_elevation ac_gothic ac_industrial ac_ingress ac_lainio ac_lotus ac_mines ac_nocturne ac_origin ac_rampart ac_rattrap ac_scaffold ac_snow ac_stellar ac_sunset ac_swamp ac_toxic ac_venison ac_wasteland ac_werk]
  11. genbotmaps $__bot_maps_all
  12. tempalias tmp_botskill good
  13. tempalias tmp_numbots 1
  14. tempalias tmp_mode ""
  15. tempalias tmp_botmap ""
  16. tempalias tmp_isbotteammode 0
  17. // add bots
  18. const startbotmatch [
  19. if ($tmp_isbotteammode) [ // team botmode
  20. tempalias numrvsf (div $tmp_numbots 2)
  21. tempalias numcla (div $tmp_numbots 2)
  22. if (= (player1 team) 0) [ -= numcla 1 ] [
  23. if (= (player1 team) 1) [ -= numrvsf 1 ]
  24. ]
  25. if (&& (= $numrvsf $numcla) $needsswitch) [ -= numrvsf 1 ]
  26. addnbot $numrvsf RVSF $tmp_botskill
  27. addnbot $numcla CLA $tmp_botskill
  28. ] [ // bot FFA
  29. addnbot $tmp_numbots random $tmp_botskill
  30. ]
  31. ]
  32. const preparebotmatch [
  33. echo starting botmatch..
  34. tempalias needsswitch 0
  35. if (&& (!= (player1 team) 0) (!= (player1 team) 1)) [ needsswitch = 1; team RVSF ]
  36. // register event that is fired during mapload
  37. addOnLoadOnce [
  38. kickallbots
  39. startbotmatch // add bots
  40. mode 0 // reset mode for next maps
  41. ]
  42. mode $tmp_mode
  43. map $tmp_botmap $menuBotGameLength
  44. ]
  45. const afterdisconnect [
  46. if $connected [
  47. addOnLoadOnce $arg1
  48. disconnect
  49. ] [
  50. if (watchingdemo) [
  51. addOnLoadOnce $arg1
  52. stopdemo
  53. ] $arg1
  54. ]
  55. ]
  56. // register events and change map
  57. const startbotmap [ afterdisconnect preparebotmatch ]
  58. const emptymap [
  59. afterdisconnect [
  60. mode 0
  61. showmenu maps
  62. ]
  63. ]
  64. //// Main > Singleplayer ////
  65. newmenu singleplayer
  66. // teamplay not mature yet
  67. menuitem "Bot Team Deathmatch" [ tmp_mode = 7; tmp_isbotteammode = 1; showmenu botskill ]
  68. menuitem "Bot Deathmatch" [ tmp_mode = 8; tmp_isbotteammode = 0; showmenu botskill ]
  69. menuitem "Bot One Shot, One Kill" [ tmp_mode = 12; tmp_isbotteammode = 0; showmenu botskill ]
  70. menuitem "Bot Pistol Frenzy" [ tmp_mode = 18; tmp_isbotteammode = 0; showmenu botskill ]
  71. menuitem "Bot Last Swiss Standing" [ tmp_mode = 19; tmp_isbotteammode = 0; showmenu botskill ]
  72. menuitem "Bot Team Survivor" [ tmp_mode = 20; tmp_isbotteammode = 1; showmenu botskill ]
  73. menuitem "Bot Team One Shot, One Kill" [ tmp_mode = 21; tmp_isbotteammode = 1; showmenu botskill ]
  74. menuitem "Bot Survival" [ load_survival ; showmenu [Survival Mode] ]
  75. menuitem "" -1
  76. menuitem "Bot settings..." [ showmenu [Bot settings] ]
  77. menuitem "" -1
  78. menuitem "Empty map" emptymap
  79. menuitem "Search map..." [ showmenu [search map] ]
  80. searchmap = ""
  81. newmenu [search official map]
  82. menudirlist "packages/maps/official" cgz [map $arg1] 0 searchmap
  83. newmenu [search custom map]
  84. menurenderoffset -20 0
  85. menudirlist "packages/maps" cgz [map $arg1] 0 searchmap
  86. newmenu [search map]
  87. menuitemtextinput "Part of map name or description: " "result $searchmap" [ searchmap = $arg1 ]
  88. menuitem "\f2\t [ Search in official maps ]" [ showmenu [search official map] ]
  89. menuitem "\f2\t [ Search in custom maps ]" [ showmenu [search custom map] ]
  90. const showmenu_enemies [ if ($tmp_isbotteammode) [ showmenu [team enemies] ] [ showmenu enemies ] ]
  91. newmenu botskill
  92. menuitem Best [ tmp_botskill = best; showmenu_enemies ]
  93. menuitem "Good (default)" [ tmp_botskill = good; showmenu_enemies ]
  94. menuitem Medium [ tmp_botskill = medium; showmenu_enemies ]
  95. menuitem Worse [ tmp_botskill = worse; showmenu_enemies ]
  96. menuitem Bad [ tmp_botskill = bad; showmenu_enemies ]
  97. const genenemyitems [
  98. loop i (listlen $arg1) [
  99. numplayers = (at $arg1 $i)
  100. if (= $arg2 0) [ // DM
  101. -= numplayers 1 // don't count yourself as enemy
  102. menutext = (concat (+ $numplayers 1) players)
  103. ] [ // TDM
  104. teamsize = (div $numplayers 2)
  105. menutext = (concatword $teamsize vs $teamsize)
  106. ]
  107. menuitem $menutext (concat [tmp_numbots =] $numplayers [; showmenu botmaps])
  108. ]
  109. ]
  110. newmenu enemies
  111. genenemyitems [2 4 8 12 16 24 32] 0
  112. newmenu [team enemies]
  113. genenemyitems [4 8 12 16 24 32] 1
  114. newmenu [Bot settings]
  115. menuitemslider "Bot match length in minutes: " 1 60 "$menuBotGameLength" 1 [ menuBotGameLength = $arg1 ]
  116. menuitemcheckbox "Idle bots?" "(idlebots 2)" [ idlebots $arg1 ]
  117. menuitemcheckbox "Bots attack?" "(botsshoot 2)" [ botsshoot $arg1 ]
  118. newmenu [Creating bot waypoints]
  119. menuitem "Waypoints..." [ showmenu Waypoints ]
  120. menuitem "Paths..." [ showmenu Paths ]
  121. menuitem "Other operations..." [ showmenu [Other bot operations] ]
  122. menuitem "" -1
  123. menuitem "Flood map with waypoints" wpflood
  124. menuitem "Save bot waypoints" wpsave
  125. newmenu Waypoints
  126. menuitem "Add a waypoint" [ addwp 0 ]
  127. menuitem "Add auto-connecting waypoint" [ addwp 1 ]
  128. menuitem "" -1
  129. menuitem "Delete nearest waypoint" delwp
  130. menuitem "Delete all waypoints" [ showmenu [Delete all waypoints] ]
  131. newmenu Paths
  132. menuitem "Create Start of 2-way path" addpath2way1
  133. menuitem "Create End of 2-way path" addpath2way2
  134. menuitem "Delete Start of 2-way path" delpath2way1
  135. menuitem "Delete End of 2-way path" delpath2way2
  136. menuitem "" -1
  137. menuitem "Create Start of 1-way path" addpath1way1
  138. menuitem "Create End of 1-way path" addpath1way2
  139. menuitem "Delete Start of 1-way path" delpath1way1
  140. menuitem "Delete End of 1-way path" delpath1way2
  141. newmenu [Other bot operations]
  142. menuitem "Set waypoint as jumpable" setjumpwp
  143. menuitem "Unset waypoint as jumpable" unsetjumpwp
  144. menuitem "Set waypoint direction (yaw)" setwpyaw
  145. menuitem "" -1
  146. menuitemslider "Waypoint visibility: " 0 1 [ ] ["Hide waypoints" "Show waypoints"] [ wpvisible $arg1 ]
  147. menuitemslider "Select/place waypoints by: " 0 1 "($xhairwpsel)" ["Your current location" "Clicking a point on the grid"] [ xhairwpsel $arg1 ]
  148. newmenu [Delete all waypoints]
  149. menuinit [ delallwps = 0 ] // Ensures this menu works correctly.
  150. menuitemcheckbox "Yes, delete all waypoints: " [delallwps = 1] [delallwps = $arg1]
  151. menuitem "\f2\t\t Apply!" [ if $delallwps wpclear [ showmenu [] ] ]