* no more need to delete aliases "onQuit" * removed on_quit.cfg * moved faq.cfg, parsestrings.cfg and survival.cfg to config/opt * run faq.cfg and survival.cfg when needed DOCREF addListOnQuit
168 lines
5.6 KiB
INI
168 lines
5.6 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 (concatword (c 2) [ ] (_ Apply!)) [ if $delallwps wpclear [ showmenu [] ] ]
|
|
|
|
persistidents 1
|