bot "survival mode"

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6301 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2011-04-22 23:55:11 +00:00
parent 1c2b0c8519
commit fe205a2e23
6 changed files with 177 additions and 18 deletions
+10 -16
View File
@@ -9,14 +9,6 @@ skin 0 // Change your look.
autoreload 1 // Reload the guns automatically by default.
setfont default // Choose your font
// scopesens = [ *f $sensitivity $scopesensscale ] // scopesens is now hardcoded // Bukz
// bind MOUSE2 [ zoom 1; onrelease [ zoom 0 ] ]
// alternative zoom toggle
// ztoggle = 0
// bind MOUSE2 [ alias ztoggle (= ztoggle 0); zoom $ztoggle ]
// alternative weapon switching (more economic), no more 1-2-3-4 /wheel cycling no finger ever leaving WASD
// uncomment lines (remove the //) below to activate
@@ -24,18 +16,20 @@ setfont default // Choose your font
// bind lshift [ grenades ]
// bind lalt [ melee ]
ofc_gamma_list = ""
loop ogl (listlen $defaultmaps) [ add2list ofc_gamma_list $gamma ]
askquit = 1
gfxqualityalias = 3 // Default GFX is medium.
soundqualityalias = 3 // Default sound is best.
poniesmodeon = 0 // Reduced violence mode.
__gibsgore = 1 // Default value for gibs slider.
// Aliases that should be stored in saved.cfg are defined below
ofc_gamma_list = ""
loop ogl (listlen $defaultmaps) [
add2list ofc_gamma_list $gamma
]
dyngamma = 0
old_editbinds = 1
nickhighlight = 5
nickhighlight = 5
survMap = (rnd (listlen $defaultmaps))
survDifficulty = 0
survNumBots = 12
survBotsToAdd = 1
timeBetChkPts = 60000
survMaxBots = 32
+3
View File
@@ -622,6 +622,9 @@ docident [whois] [get the IP address of a given clientnumber - only admins get s
docargument [C] [clientnum] [] [0];
docident [xhairwpsel] [Determines if bot waypoints should be selected/placed using the crosshair or by the nearest location to your player.];
docargument [V] [Note: This is turned on by default.] [min 0/max 1/default 1];
docident [survival] [Prepares a round of bot survival mode on the specified map.];
docargument [M] [the map to use] [] [0];
docremark [All official maps are compatible with survival, if you want to play survival on a custom map, prior edits/additions to the script are necessary, such as adding a zone for that specific map.];
docsection [Editing]
docident [addpath1way1] [];
docident [addpath1way2] [];
+20
View File
@@ -68,6 +68,8 @@ newmenu singleplayer
menuitem "Bot Team Deathmatch" [ tmp_mode = 7; showmenu botskill ]
menuitem "Bot Deathmatch" [ tmp_mode = 8; showmenu botskill ]
menuitem "Bot One Shot, One Kill" [ alias tmp_mode 12; showmenu botskill ]
menuitem [] -1
menuitem "Bot Survival" [ showmenu "Survival Mode" ]
menuitem "Empty Map" emptymap
newmenu botskill
@@ -99,6 +101,24 @@ genenemyitems "2 4 8 12 16 24 32" 0
newmenu "team enemies"
genenemyitems "4 8 12 16 24 32" 1
survSetsList = "survNumBots survBotsToAdd timeBetChkPts survMaxBots"
survDifList = [ "10 1 60000 20" "12 1 45000 30" "14 2 30000 50" "16 5 10000 50" ]
newmenu "Survival Mode"
menuitemslider "Map: " 0 28 "$survMap" 1 [ "ac_aqueous" "ac_arabian" "ac_arctic" "ac_arid" "ac_complex" "ac_depot" "ac_desert" "ac_desert2" "ac_desert3" "ac_douze" "ac_edifice" "ac_elevation" "ac_gothic" "ac_iceroad" "ac_industrial" "ac_ingress" "ac_keller" "ac_mines" "ac_outpost" "ac_power" "ac_rattrap" "ac_scaffold" "ac_shine" "ac_snow" "ac_stellar" "ac_sunset" "ac_toxic" "ac_urban" "ac_werk" ] [ survMap = $arg1 ]
menuitemslider "Difficulty: " 0 3 "$survDifficulty" 1 [ "easy" "intermediate" "hard" "impossible" ] [ survDifficulty = $arg1; tmpSurvCtr = 0; loop sdl 4 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $tmpSurvCtr); += tmpSurvCtr 1 ] ]
menuitem [] -1
menuitem " Customize" [ showmenu "Survival Mode - Customize" ]
menuitem " Start!" [ survival (at $defaultmaps $survMap) ]
newmenu "Survival Mode - Customize"
menuitemslider "# of bots to spawn on start: " 6 20 "$survNumBots" 1 [] [ survNumBots = $arg1 ]
menuitemslider "# of bots to spawn at checkpoints: " 1 5 "$survBotsToAdd" 1 [] [ survBotsToAdd = $arg1 ]
menuitemslider "# of milliseconds between checkpoints: " 10000 120000 "$timeBetChkPts" 10000 [] [ timeBetChkPts = $arg1 ]
menuitemslider "Maximum # of bots in survival mode: " 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1 ]
menuitem [] -1
menuitem " Back" [ closemenu "Survival Mode - Customize" ]
newmenu "Creating bot waypoints"
menuitem "Waypoints..." [ showmenu "Waypoints" ]
+4 -2
View File
@@ -448,8 +448,10 @@ customclaimadminscript = [
]
]
run on_quit
run dyngamma
run tutorial
run survival
run on_quit
run tutorial
+130
View File
@@ -0,0 +1,130 @@
// CubeScript survival mode in a nutshell:
//
// * All official maps support it.
// * Each map has a unique "zone" that the player must stay in, to continue playing.
// * Every "zone" is located somewhere other than the usual two bases.
// * When the player first enters the "zone", the timers/counters start.
// * If the player dies, or leaves the "zone" for too long of a duration, the game ends.
// * Total seconds survived, and total number of enemies killed during, are reported as stats when the game ends.
checkSurvAliases = [ loop csa (listlen $arg1) [ if (! (checkalias (at $arg1 $csa))) [ (at $arg1 $csa) = $arg2 ] ] ]
survResetAliases = "gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount survKills"
resetSurvAliases = [
loop rsa (listlen $survResetAliases) [ (at $survResetAliases $rsa) = 0 ]
checkSurvAliases survMap (rnd (listlen $defaultmaps))
checkSurvAliases survBotsToAdd 1; checkSurvAliases survDifficulty 0; checkSurvAliases survNumBots 12; checkSurvAliases survMaxBots 32; checkSurvAliases timeBetChkPts 60000
]
resetSurvAliases
survival = [
positiontype 1; kickallbots; resetSurvAliases
if (! (strstr $onKill survKills)) [ add2alias onKill [ += survKills 1 ] ]
add2alias mapstartonce [
echo (c 2)Bot survival mode prepared...load up on items and find the arena to start!
if (strstr $defaultmaps (curmap 1)) [ survMap = (findlist $defaultmaps (curmap 1)) ]
setOfcZones; checkzone
]
if (! (curteam)) [ team RVSF ]; mode 7; map $arg1
]
startSurvival = [
tmpSurvNumBots = $survNumBots; curSurvDifficulty = 0; startedSurvival = 1; startSurvMillis = (millis)
addnbot $survNumBots CLA bad
sleep 2500 [ echo (c 3)Starting survival mode, good luck! ]
sleep $timeBetChkPts [ gotCheckPoint = 1; increaseDifficulty ]
]
setzone = [ if (> (listlen $arg1) 3) [ zone = ""; loop szl 4 [ add2list zone (at $arg1 $szl) ] ] ]
// Zones consist of two points on a grid. Any area within these points are considered "inner zone".
// The order of the arguments given to setzone are important: setzone "minX maxX minY maxY"
// Hint: Use /whereami to find the two points.
survOfcZones = [
ac_aqueous 159.10 198.90 128.10 142.90
ac_arabian 128.10 196.90 93.10 146.90
ac_arctic 81.10 120.90 137.10 176.90
ac_arid 135.10 155.90 97.10 138.90
ac_complex 105.10 150.90 129.10 181.90
ac_depot 137.10 166.90 205.10 262.90
ac_desert 89.10 102.90 129.10 174.90
ac_desert2 65.10 98.90 149.10 190.90
ac_desert3 67.10 94.90 145.10 184.90
ac_douze 137.10 186.90 121.10 150.90
ac_edifice 33.10 80.90 82.10 120.90
ac_elevation 66.10 93.90 92.90 121.90
ac_gothic 47.10 83.90 41.10 83.90
ac_iceroad 325.10 374.90 244.10 274.90
ac_industrial 319.10 357.90 180.10 244.90
ac_ingress 92.10 119.90 68.10 98.90
ac_keller 66.10 100.90 222.10 244.90
ac_mines 83.10 110.90 117.10 131.90
ac_outpost 61.10 99.90 73.10 98.90
ac_power 155.10 216.90 211.10 244.90
ac_rattrap 145.10 185.90 57.10 102.90
ac_scaffold 62.10 91.90 49.10 63.90
ac_shine 99.10 124.90 79.10 106.90
ac_snow 17.10 54.90 102.10 127.90
ac_stellar 158.90 184.90 49.10 102.90
ac_sunset 148.10 183.90 102.10 127.90
ac_toxic 72.10 114.90 120.10 147.90
ac_urban 135.10 200.90 45.10 90.90
ac_werk 121.10 147.90 110.10 150.90
]
setOfcZones = [
survMapIndex = (findlist $survOfcZones (curmap 1))
if (>= $survMapIndex 0) [
tmpSurvZone = ""; tmpSurvCtr = 0
loop soz 4 [ += tmpSurvCtr 1; add2list tmpSurvZone (at $survOfcZones (+ $survMapIndex $tmpSurvCtr)) ]
setzone $tmpSurvZone
]
]
isInZone = [
if (&& (&& (>= (getposition 0) (at $zone 0)) (>= (getposition 1) (at $zone 2))) (&& (<= (getposition 0) (at $zone 1)) (<= (getposition 1) (at $zone 3)))) [
result 1
] [
result 0
]
]
checkzone = [
if (! $survIsFinished) [
if (&& (&& $startedSurvival $gotCheckPoint) (>= (- (millis) $lastCheckPoint) $timeBetChkPts)) [ increaseDifficulty ]
if (&& (isInZone) (! $startedSurvival)) [ startSurvival ]
if (&& (! (alive)) $startedSurvival) [ finalSurvMillis = (- (millis) $startSurvMillis); endSurvival (concatword (c 3) "You survived for " (c 5) (divf $finalSurvMillis 1000) (c 3) " seconds, and killed " (c 5) $survKills (c 3) " enemies.") ]
if (&& (&& (! (isInZone)) $startedSurvival) (! $startedOBCount)) [ startOBCount ]
sleep 0 [ checkzone ]
]
]
startOBCount = [
startedOBCount = 1; startOBMillis = (millis); backInZone = 0
echo (c 3)Get back into the arena! (c 9)You only have (c 5)5 (c 9)seconds to return.; echo (c 0)5...
if (isInZone) [ backInZone = 1 ]
sleep 1000 [ if (&& (! (isInZone)) (! $backInZone)) [ echo (c 0)4... ] [ backInZone = 1 ] ]
sleep 2000 [ if (&& (! (isInZone)) (! $backInZone)) [ echo (c 3)3... ] [ backInZone = 1 ] ]
sleep 3000 [ if (&& (! (isInZone)) (! $backInZone)) [ echo (c 3)2... ] [ backInZone = 1 ] ]
sleep 4000 [ if (&& (! (isInZone)) (! $backInZone)) [ echo (c 6)1... ] [ backInZone = 1 ] ]
sleep 5000 [ if (&& (! (isInZone)) (! $backInZone)) [ if (>= (- (millis) $startOBMillis) 5000) [ endSurvival (concatword (c 3) "You took too long to return to the arena!") ] ] [ startedOBCount = 0 ] ]
]
increaseDifficulty = [
lastCheckPoint = (millis)
if (<= (+ $survNumBots $survBotsToAdd) $survMaxBots) [ += survNumBots $survBotsToAdd; addnbot $survBotsToAdd CLA best ] [ tmpSurvInt = (- $survMaxBots $survNumBots); += survNumBots $tmpSurvInt; addnbot $tmpSurvInt CLA best ]
if (< $curSurvDifficulty 4) [ += curSurvDifficulty 1; botskillall (at "bad worse medium good best" $curSurvDifficulty) ]
]
endSurvival = [
tmp_survstr = $arg1; startedSurvival = 0; survIsFinished = 1
add2alias mapstartonce [ survNumBots = $tmpSurvNumBots; echo $tmp_survstr ]
tdm (at $defaultmaps (rnd (listlen $defaultmaps)))
]
// List of aliases that need to be cleared from saved.cfg on quit:
survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones tmpSurvCtr tmpSurvInt tmpSurvNumBots tmp_survstr tmpSurvZone zone checkSurvAliases survResetAliases survAliases"
addListOnQuit $survAliases
+10
View File
@@ -2574,6 +2574,16 @@ Output:
<argument valueNotes="2 (switch to grenades, else switch to primary)"/>
</arguments>
</variable>
<command name="survival">
<description>Prepares a round of bot survival mode on the specified map.</description>
<remarks>
<remark>All official maps are compatible with survival, if you want to play survival on a custom map, prior edits/additions to the script are necessary, such as adding a zone for that specific map.</remark>
</remarks>
<arguments>
<argument description="the map to use"/>
</arguments>
</command>
</identifiers>
</section>