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
This commit is contained in:
Bukz
2011-04-26 06:47:53 +00:00
parent 0cb4896a1c
commit ddd5f7b68f
4 changed files with 27 additions and 16 deletions
+1
View File
@@ -33,4 +33,5 @@ survDifficulty = 0
survNumBots = 12
survBotsToAdd = 1
timeBetChkPts = 60000
timeUntilTele = 120000
survMaxBots = 32
+4 -3
View File
@@ -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" ]
+1 -3
View File
@@ -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
addListOnQuit $on_quit_aliases; addOnQuit [ delalias alias_list ]
+21 -10
View File
@@ -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