From ddd5f7b68f14e2d820f239fca8e70d78dadec664 Mon Sep 17 00:00:00 2001 From: Bukz Date: Tue, 26 Apr 2011 06:47:53 +0000 Subject: [PATCH] survival mode updates/fixes - teleport to zone after x millis git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6354 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/defaults.cfg | 1 + config/menus_bot.cfg | 7 ++++--- config/on_quit.cfg | 4 +--- config/survival.cfg | 31 +++++++++++++++++++++---------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/config/defaults.cfg b/config/defaults.cfg index 295f2bad..c52e84cc 100644 --- a/config/defaults.cfg +++ b/config/defaults.cfg @@ -33,4 +33,5 @@ survDifficulty = 0 survNumBots = 12 survBotsToAdd = 1 timeBetChkPts = 60000 +timeUntilTele = 120000 survMaxBots = 32 \ No newline at end of file diff --git a/config/menus_bot.cfg b/config/menus_bot.cfg index d3dc6d3b..d360e3c4 100644 --- a/config/menus_bot.cfg +++ b/config/menus_bot.cfg @@ -101,12 +101,12 @@ 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" ] +survSetsList = "survNumBots survBotsToAdd timeBetChkPts timeUntilTele survMaxBots" +survDifList = [ "10 1 60000 120000 20" "12 1 45000 90000 30" "14 2 30000 45000 50" "16 5 10000 30000 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 ] ] +menuitemslider "Difficulty: " 0 3 "$survDifficulty" 1 [ "easy" "intermediate" "hard" "impossible" ] [ survDifficulty = $arg1; tmpSurvCtr = 0; loop sdl 5 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $tmpSurvCtr); += tmpSurvCtr 1 ] ] menuitem [] -1 menuitem " Customize" [ showmenu "Survival Mode - Customize" ] menuitem " Start!" [ survival (at $defaultmaps $survMap) ] @@ -115,6 +115,7 @@ 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 "# of milliseconds before teleporting: " 10000 180000 "$timeUntilTele" 10000 [] [ timeUntilTele = $arg1 ] menuitemslider "Maximum # of bots in survival mode: " 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1 ] menuitem [] -1 menuitem " Back" [ closemenu "Survival Mode - Customize" ] diff --git a/config/on_quit.cfg b/config/on_quit.cfg index 91acbfa4..085090d9 100644 --- a/config/on_quit.cfg +++ b/config/on_quit.cfg @@ -3,7 +3,6 @@ addListOnQuit = [ alias_list = $arg1; loop al (listlen $alias_list) [ addOnQuit (concat "delalias" (at $alias_list $al)) ] ] -// alias_list is last for a reason! on_quit_aliases = [ _demofile badargs @@ -39,7 +38,6 @@ on_quit_aliases = [ watchingtutorial addListOnQuit on_quit_aliases - alias_list ] -addListOnQuit $on_quit_aliases \ No newline at end of file +addListOnQuit $on_quit_aliases; addOnQuit [ delalias alias_list ] \ No newline at end of file diff --git a/config/survival.cfg b/config/survival.cfg index 8915f609..1168af2c 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -4,12 +4,13 @@ // * 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 has not found the zone within the set timeframe, they are automatically teleported there. // * 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" +survResetAliases = "gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount startPreSurvMillis startSurvMillis survKills survTeleported" resetSurvAliases = [ loop rsa (listlen $survResetAliases) [ (at $survResetAliases $rsa) = 0 ] @@ -23,7 +24,8 @@ survival = [ storesets "positiontype" tmpSurvSets; add2list tmpSurvSets $survNumBots; curSurvDifficulty = 0; positiontype 1; 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! + startPreSurvMillis = (millis) + echo (c 2)Bot survival mode prepared, gather items and find the arena to start! (c 9)You have (c 5) (div $timeUntilTele 1000) (c 9)seconds to prepare! if (strstr $defaultmaps (curmap 1)) [ survMap = (findlist $defaultmaps (curmap 1)) ] setOfcZones; checkzone ] @@ -33,7 +35,7 @@ survival = [ startSurvival = [ startedSurvival = 1; startSurvMillis = (millis) addnbot $survNumBots CLA bad - sleep 2500 [ echo (c 3)Starting survival mode, good luck! ] + sleep 2500 [ if $survTeleported [ echo (c 9)You were teleported to the zone. ]; echo (c 3)Starting survival mode, good luck! ] sleep $timeBetChkPts [ gotCheckPoint = 1; increaseDifficulty ] ] @@ -83,6 +85,14 @@ setOfcZones = [ ] ] +findCenter = [ + midZoneX = (+f (divf (-f (at $tmpSurvZone 1) (at $tmpSurvZone 0)) 2.00) (at $tmpSurvZone 0)) + midZoneY = (+f (divf (-f (at $tmpSurvZone 3) (at $tmpSurvZone 2)) 2.00) (at $tmpSurvZone 2)) + tmpZoneCenter = (concat $midZoneX $midZoneY) +] + +teleportPlayer = [ if (! (alive)) [ attack ]; if (!= $gamespeed 100) [ gamespeed 100 ]; survTeleported = 1; findCenter; if (! $editing) [ edittoggle ]; go_to (at $tmpZoneCenter 0) (at $tmpZoneCenter 1); sleep 50 [ edittoggle ] ] + isInZone = [ if (&& (&& (>= (getposition 0) (at $zone 0)) (>= (getposition 1) (at $zone 2))) (&& (<= (getposition 0) (at $zone 1)) (<= (getposition 1) (at $zone 3)))) [ result 1 @@ -93,11 +103,12 @@ isInZone = [ checkzone = [ if (! $survIsFinished) [ - if (|| $editing (! (= $gamespeed 100))) [ endSurvival (concatword (c 3) "Error: " (c 1) editmode (c 5) " and " (c 1) gamespeed (c 5) " are not allowed in Survival Mode.") ] + if (&& $startedSurvival (&& (>= (- (millis) $startSurvMillis) 500) (|| $editing (!= $gamespeed 100)))) [ endSurvival (concatword (c 3) "Error: " (c 1) editmode (c 5) " and " (c 1) gamespeed (c 5) " are not allowed in Survival Mode.") ] if (&& (isInZone) (! $startedSurvival)) [ startSurvival ] - if (&& (&& $startedSurvival $gotCheckPoint) (>= (- (millis) $lastCheckPoint) $timeBetChkPts)) [ increaseDifficulty ] - if (&& (&& (! (isInZone)) $startedSurvival) (! $startedOBCount)) [ startOBCount ] - 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 (&& (! $startedSurvival) (>= (- (millis) $startPreSurvMillis) $timeUntilTele)) [ teleportPlayer ] + if (&& (>= (- (millis) $lastCheckPoint) $timeBetChkPts) (&& $startedSurvival $gotCheckPoint)) [ increaseDifficulty ] + if (&& (! $startedOBCount) (&& (! (isInZone)) $startedSurvival)) [ startOBCount ] + if (&& $startedSurvival (&& (! (alive)) (>= (- (millis) $startSurvMillis) 500))) [ 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.") ] sleep 0 [ checkzone ] ] ] @@ -120,12 +131,12 @@ increaseDifficulty = [ ] endSurvival = [ - tmp_survstr = $arg1; startedSurvival = 0; survIsFinished = 1; positiontype (at $tmpSurvSets 0) - add2alias mapstartonce [ survNumBots = (at $tmpSurvSets 1); echo $tmp_survstr ] + tmp_survstr = $arg1; startedSurvival = 0; survIsFinished = 1; positiontype (at $tmpSurvSets 0); survNumBots = (at $tmpSurvSets 1) + add2alias mapstartonce [ 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 tmpSurvSets tmp_survstr tmpSurvZone zone checkSurvAliases survResetAliases survAliases" +survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startPreSurvMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones survTeleported tmpSurvCtr tmpSurvInt tmpSurvSets tmp_survstr tmpSurvZone tmpZoneCenter zone checkSurvAliases survResetAliases survAliases" addListOnQuit $survAliases \ No newline at end of file