gist/rand-q3

146 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
# Due to the parameter expansion used this script
# requires bash. If you do manage to convert this
# to a proper POSIX shell compatible script
# don't hesitate to send it to me!
# <marco@icculus.org>
if [ -z $TIMELIMIT ]
then
TIMELIMIT=5
fi
if [ -z $FRAGLIMIT ]
then
FRAGLIMIT=0
fi
if [ -z $CAPTURELIMIT ]
then
CAPTURELIMIT=0
fi
if [ -z $MODE ]
then
# 0 = tourney, 1 = ffa, 2 = ctf, 3 = tdm
MODE=$(( $RANDOM % 4 ))
fi
if [ -z $SKILL ]
then
# 1 = i can win, 2 = bring it on, 3 = hurt me plenty, 4 = hardcore, 5 = nightmare
SKILL=3
fi
# Map choices for the various modes in Q3A
# Only maps that have been officially approved for a given mode
MAP_TEAM_N=$(( $RANDOM % 8 + 1 ))
MAP_TEAM1=q3dm6
MAP_TEAM2=q3dm7
MAP_TEAM3=q3dm8
MAP_TEAM4=q3dm9
MAP_TEAM5=q3dm12
MAP_TEAM6=q3dm14
MAP_TEAM7=q3dm15
MAP_TEAM8=q3tourney4
TEAMMAP=MAP_TEAM${MAP_TEAM_N}
MAP_TOURNEY_N=$(( $RANDOM % 7 + 1 ))
MAP_TOURNEY1=q3dm2
MAP_TOURNEY2=q3tourney1
MAP_TOURNEY3=q3tourney2
MAP_TOURNEY4=q3tourney3
MAP_TOURNEY5=q3tourney4
MAP_TOURNEY6=q3tourney5
MAP_TOURNEY7=q3tourney6
TOURNEYMAP=MAP_TOURNEY${MAP_TOURNEY_N}
MAP_FFA_N=$(( $RANDOM % 18 + 1 ))
MAP_FFA1=q3dm2
MAP_FFA2=q3dm3
MAP_FFA3=q3dm4
MAP_FFA4=q3dm5
MAP_FFA5=q3dm6
MAP_FFA6=q3dm7
MAP_FFA7=q3dm8
MAP_FFA8=q3dm9
MAP_FFA9=q3dm10
MAP_FFA10=q3dm11
MAP_FFA11=q3dm12
MAP_FFA12=q3dm13
MAP_FFA13=q3dm14
MAP_FFA14=q3dm15
MAP_FFA15=q3dm16
MAP_FFA16=q3dm17
MAP_FFA17=q3dm18
MAP_FFA18=q3dm19
FFAMAP=MAP_FFA${MAP_FFA_N}
MAP_CTF_N=$(( $RANDOM % 4 + 1 ))
MAP_CTF1=q3ctf1
MAP_CTF2=q3ctf2
MAP_CTF3=q3ctf3
MAP_CTF4=q3ctf4
CTFMAP=MAP_CTF${MAP_CTF_N}
LORD_N=$(( $RANDOM % 6 + 1 ))
LORD1=xaero
LORD2=uriel
LORD3=anarki
LORD4=klesk
LORD5=hunter
LORD6=sarge
ARENALORD=LORD${LORD_N}
TEAM_N=$(( $RANDOM % 2 + 1 ))
TEAM1=Red
TEAM2=Blue
TEAM=TEAM${TEAM_N}
if [ $MODE = "1" ]
then
quake3 \
+set bot_minplayers 7 \
+set capturelimit $CAPTURELIMIT \
+set fraglimit $FRAGLIMIT \
+set timelimit $TIMELIMIT \
+set g_gametype 0 \
+set g_spSkill $SKILL \
+set sv_maxclients "8" \
+map ${!FFAMAP}
elif [ $MODE = "2" ]
then
quake3 \
+set bot_minplayers 7 \
+set capturelimit $CAPTURELIMIT \
+set fraglimit $FRAGLIMIT \
+set timelimit $TIMELIMIT \
+set g_gametype 4 \
+set g_spSkill $SKILL \
+set sv_maxclients "8" \
+map ${!CTFMAP} \
+wait 5 +team ${!TEAM}
elif [ $MODE = "3" ]
then
quake3 \
+set bot_minplayers 7 \
+set capturelimit $CAPTURELIMIT \
+set fraglimit $FRAGLIMIT \
+set timelimit $TIMELIMIT \
+set g_gametype 3 \
+set g_spSkill $SKILL \
+set sv_maxclients "8" \
+map ${!TEAMMAP} \
+wait 5 +team ${!TEAM}
else
quake3 \
+set capturelimit $CAPTURELIMIT \
+set fraglimit $FRAGLIMIT \
+set timelimit $TIMELIMIT \
+set g_gametype 1 \
+set g_spSkill $SKILL \
+set sv_maxclients "2" \
+map ${!TOURNEYMAP} \
+addbot ${!ARENALORD}
fi