168 lines
5.4 KiB
INI
168 lines
5.4 KiB
INI
// bot menus and tools
|
|
|
|
persistidents 0
|
|
|
|
newmenu botmaps
|
|
|
|
const genbotmaps [
|
|
loop gbm (listlen $arg1) [
|
|
listmapname = (at $arg1 $gbm)
|
|
menutext = $listmapname (concat map $listmapname)
|
|
menuitemmapload $listmapname (concat "tmp_botmap =" $listmapname "; startbotmap")
|
|
]
|
|
]
|
|
genbotmaps $defaultmaps
|
|
|
|
tempalias tmp_botskill good
|
|
tempalias tmp_numbots 1
|
|
tempalias tmp_mode ""
|
|
tempalias tmp_botmap ""
|
|
tempalias tmp_isbotteammode 0
|
|
|
|
// add bots
|
|
const startbotmatch [
|
|
if ($tmp_isbotteammode) [ // team botmode
|
|
tempalias numrvsf (div $tmp_numbots 2)
|
|
tempalias numcla (div $tmp_numbots 2)
|
|
if (= (player1 team) 0) [ -- numcla ] [
|
|
if (= (player1 team) 1) [ -- numrvsf ]
|
|
]
|
|
if (&& (= $numrvsf $numcla) $needsswitch) [ -- numrvsf ]
|
|
addnbot $numrvsf RVSF $tmp_botskill
|
|
addnbot $numcla CLA $tmp_botskill
|
|
] [ // bot FFA
|
|
addnbot $tmp_numbots random $tmp_botskill
|
|
]
|
|
]
|
|
|
|
const preparebotmatch [
|
|
echo starting botmatch..
|
|
tempalias needsswitch 0
|
|
if (&& (!= (player1 team) 0) (!= (player1 team) 1)) [ needsswitch = 1; team RVSF ]
|
|
// register event that is fired during mapload
|
|
addOnLoadOnce [
|
|
kickallbots
|
|
startbotmatch // add bots
|
|
mode 0 // reset mode for next maps
|
|
]
|
|
mode $tmp_mode
|
|
map $tmp_botmap $menuBotGameLength
|
|
]
|
|
|
|
const afterdisconnect [
|
|
if $connected [
|
|
addOnLoadOnce $arg1
|
|
disconnect
|
|
] [
|
|
if (watchingdemo) [
|
|
addOnLoadOnce $arg1
|
|
stopdemo
|
|
] $arg1
|
|
]
|
|
]
|
|
|
|
// register events and change map
|
|
const startbotmap [ afterdisconnect preparebotmatch ]
|
|
|
|
const emptymap [
|
|
afterdisconnect [
|
|
mode 0
|
|
showmenu maps
|
|
]
|
|
]
|
|
|
|
newmenu singleplayer
|
|
|
|
// teamplay not mature yet
|
|
menuitem "Bot Team Deathmatch" [ tmp_mode = 7; tmp_isbotteammode = 1; showmenu botskill ]
|
|
menuitem "Bot Deathmatch" [ tmp_mode = 8; tmp_isbotteammode = 0; showmenu botskill ]
|
|
menuitem "Bot One Shot, One Kill" [ tmp_mode = 12; tmp_isbotteammode = 0; showmenu botskill ]
|
|
menuitem "Bot Pistol Frenzy" [ tmp_mode = 18; tmp_isbotteammode = 0; showmenu botskill ]
|
|
menuitem "Bot Last Swiss Standing" [ tmp_mode = 19; tmp_isbotteammode = 0; showmenu botskill ]
|
|
menuitem "Bot Team Survivor" [ tmp_mode = 20; tmp_isbotteammode = 1; showmenu botskill ]
|
|
menuitem "Bot Team One Shot, One Kill" [ tmp_mode = 21; tmp_isbotteammode = 1; showmenu botskill ]
|
|
menuitem "Bot Survival" [ load_survival ; showmenu [Survival Mode] ]
|
|
menuitem "" -1
|
|
menuitem "Bot settings..." [ showmenu [Bot settings] ]
|
|
menuitem "Empty Map" emptymap
|
|
|
|
const showmenu_enemies [ if ($tmp_isbotteammode) [ showmenu [team enemies] ] [ showmenu enemies ] ]
|
|
|
|
newmenu botskill
|
|
|
|
menuitem Best [ tmp_botskill = best; showmenu_enemies ]
|
|
menuitem "Good (default)" [ tmp_botskill = good; showmenu_enemies ]
|
|
menuitem Medium [ tmp_botskill = medium; showmenu_enemies ]
|
|
menuitem Worse [ tmp_botskill = worse; showmenu_enemies ]
|
|
menuitem Bad [ tmp_botskill = bad; showmenu_enemies ]
|
|
|
|
const genenemyitems [
|
|
loop i (listlen $arg1) [
|
|
numplayers = (at $arg1 $i)
|
|
if (= $arg2 0) [ // DM
|
|
-= numplayers 1 // don't count yourself as enemy
|
|
menutext = (concat (+ $numplayers 1) players)
|
|
] [ // TDM
|
|
teamsize = (div $numplayers 2)
|
|
menutext = (concatword $teamsize vs $teamsize)
|
|
]
|
|
menuitem $menutext (concat [tmp_numbots =] $numplayers [; showmenu botmaps])
|
|
]
|
|
]
|
|
|
|
newmenu enemies
|
|
genenemyitems [2 4 8 12 16 24 32] 0
|
|
|
|
newmenu [team enemies]
|
|
genenemyitems [4 8 12 16 24 32] 1
|
|
|
|
newmenu [Bot settings]
|
|
menuitemslider "Bot match length in minutes: " 1 60 "$menuBotGameLength" 1 [] [ menuBotGameLength = $arg1 ]
|
|
menuitemcheckbox "Idle bots?" "(idlebots 2)" [ idlebots $arg1 ]
|
|
menuitemcheckbox "Bots attack?" "(botsshoot 2)" [ botsshoot $arg1 ]
|
|
|
|
newmenu [Creating bot waypoints]
|
|
|
|
menuitem "Waypoints..." [ showmenu Waypoints ]
|
|
menuitem "Paths..." [ showmenu Paths ]
|
|
menuitem "Other operations..." [ showmenu [Other bot operations] ]
|
|
menuitem "" -1
|
|
menuitem "Flood map with waypoints" wpflood
|
|
menuitem "Save bot waypoints" wpsave
|
|
|
|
newmenu Waypoints
|
|
|
|
menuitem "Add a waypoint" [ addwp 0 ]
|
|
menuitem "Add auto-connecting waypoint" [ addwp 1 ]
|
|
menuitem "" -1
|
|
menuitem "Delete nearest waypoint" delwp
|
|
menuitem "Delete all waypoints" [ showmenu [Delete all waypoints] ]
|
|
|
|
newmenu Paths
|
|
|
|
menuitem "Create Start of 2-way path" addpath2way1
|
|
menuitem "Create End of 2-way path" addpath2way2
|
|
menuitem "Delete Start of 2-way path" delpath2way1
|
|
menuitem "Delete End of 2-way path" delpath2way2
|
|
menuitem "" -1
|
|
menuitem "Create Start of 1-way path" addpath1way1
|
|
menuitem "Create End of 1-way path" addpath1way2
|
|
menuitem "Delete Start of 1-way path" delpath1way1
|
|
menuitem "Delete End of 1-way path" delpath1way2
|
|
|
|
newmenu [Other bot operations]
|
|
|
|
menuitem "Set waypoint as jumpable" setjumpwp
|
|
menuitem "Unset waypoint as jumpable" unsetjumpwp
|
|
menuitem "Set waypoint direction (yaw)" setwpyaw
|
|
menuitem "" -1
|
|
menuitemslider "Waypoint visibility: " 0 1 [ ] 1 ["Hide waypoints" "Show waypoints"] [ wpvisible $arg1 ]
|
|
menuitemslider "Select/place waypoints by: " 0 1 "($xhairwpsel)" 1 ["Your current location" "Clicking a point on the grid"] [ xhairwpsel $arg1 ]
|
|
|
|
newmenu [Delete all waypoints]
|
|
menuinit [ delallwps = 0 ] // Ensures this menu works correctly.
|
|
menuitemcheckbox "Yes, delete all waypoints: " [delallwps = 1] [delallwps = $arg1]
|
|
menuitem "\f2\t\t Apply!" [ if $delallwps wpclear [ showmenu [] ] ]
|
|
|
|
persistidents 1
|