Initial commit

This commit is contained in:
squeek 2014-11-11 18:32:26 -08:00
commit b677cec1af
284 changed files with 56918 additions and 0 deletions

BIN
FortressForever.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

7
cfg/civilian.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any civilian specific commands below this line.

70
cfg/config_default.cfg Normal file
View file

@ -0,0 +1,70 @@
// YWB (mailto:yahn@valvesoftware.com) 10/10/03:
// If the user doesn't have a config.cfg when they run,
// this gets executed the first time they run the engine
// It doesn't execute if they have their own config.cfg saved out.
unbindall
bind "ESCAPE" "cancelselect"
bind "`" "toggleconsole"
bind "~" "toggleconsole"
bind "w" "+forward"
bind "s" "+back"
bind "a" "+moveleft"
bind "d" "+moveright"
bind "SPACE" "+jump"
bind "CTRL" "+duck"
bind "TAB" "+showscores"
bind "e" "+use"
bind "c" "dropitems"
bind "z" "+medengymenu"
bind "r" "+reload"
bind "x" "discard"
bind "h" "+hintcenter"
bind "m" "+mapshot"
bind "k" "+voicerecord"
bind "ALT" "+speed"
bind "y" "say"
bind "u" "say_team"
bind "t" "impulse 201"
bind "SHIFT" "+speed"
bind "MOUSE1" "+attack"
bind "MOUSE2" "+attack2"
bind "ENTER" "+attack"
bind "f" "+gren1"
bind "g" "+gren2"
bind "l" "impulse 100"
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
bind "9" "slot9"
bind "MWHEELUP" "invprev"
bind "MWHEELDOWN" "invnext"
bind "[" "invprev"
bind "]" "invnext"
bind "q" "lastinv"
bind "F5" "jpeg"
bind "F6" "save quick"
bind "F9" "load quick"
bind "PAUSE" "pause"
bind "b" "changeclass"
bind "n" "changeteam"
bind "." "changeteam"
bind "," "changeclass"
cl_autoreload "1"
cl_classautokill "1"
cl_dynamicblur "0"
cl_dynamicfov "0"
cl_teamcolourhud "1"
cl_cmdrate "66"
cl_updaterate "66"
con_enable 1
//cl_interp "0.03"
name "WhenFFwillOut"

7
cfg/demoman.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any demoman specific commands below this line.

View file

@ -0,0 +1,6 @@
cl_detaildist "1200"
cl_detailfade "400"
cl_effectsdetail "1"
lod_Enable "1"
lod_TransitionDist "800"
r_lod "-1"

View file

@ -0,0 +1,6 @@
cl_detaildist "65536"
cl_detailfade "-1"
cl_effectsdetail "2"
lod_Enable "0"
lod_TransitionDist "65536"
r_lod "0"

7
cfg/engineer.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any engineer specific commands below this line.

4
cfg/ff_dustbowl.cfg Normal file
View file

@ -0,0 +1,4 @@
echo FF_DUSTBOWL CFG LOADED
mat_autoexposure_max 2.5
mat_autoexposure_min .25
mat_bloomscale .5

2
cfg/ff_hunted.cfg Normal file
View file

@ -0,0 +1,2 @@
echo FF_HUNTED CFG LOADED
sv_alltalk 0

3
cfg/ff_training.cfg Normal file
View file

@ -0,0 +1,3 @@
echo FF_TRAINING CFG LOADED
mp_timelimit 0
sv_cheats 0

7
cfg/hwguy.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any hwguy specific commands below this line.

7
cfg/medic.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any medic specific commands below this line.

7
cfg/pyro.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any pryo specific commands below this line.

7
cfg/scout.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any scout specific commands below this line.

169
cfg/settings_default.scr Normal file
View file

@ -0,0 +1,169 @@
// NOTE: THIS FILE IS AUTOMATICALLY REGENERATED,
//DO NOT EDIT THIS HEADER, YOUR COMMENTS WILL BE LOST IF YOU DO
// Multiplayer options script
//
// Format:
// Version [float]
// Options description followed by
// Options defaults
//
// Option description syntax:
//
// "cvar" { "Prompt" { type [ type info ] } { default } }
//
// type =
// BOOL (a yes/no toggle)
// STRING
// NUMBER
// LIST
//
// type info:
// BOOL no type info
// NUMBER min max range, use -1 -1 for no limits
// STRING no type info
// LIST delimited list of options value pairs
//
//
// default depends on type
// BOOL is "0" or "1"
// NUMBER is "value"
// STRING is "value"
// LIST is "index", where index "0" is the first element of the list
// Half-Life Server Configuration Layout Script (stores last settings chosen, too)
// File generated: Mon Jul 12 05:28:33 PM
//
//
// Cvar - Setting
VERSION 1.0
DESCRIPTION SERVER_OPTIONS
{
"hostname"
{
"#Valve_Hostname"
{ STRING }
{ "Fortress Forever" }
}
"maxplayers"
{
"#Valve_Max_Players"
{ NUMBER 1 22 }
{ "16" }
}
"sv_password"
{
"#Valve_Server_Password"
{ STRING }
{ "" }
}
"mp_timelimit"
{
"#FF_Timelimit"
{ NUMBER 0 -1 }
{ "20" }
}
"mp_friendlyfire"
{
"#Valve_Friendly_Fire"
{ BOOL }
{ "0" }
}
"sv_lan"
{
"sv_lan"
{ BOOL }
{ "0" }
}
"sv_alltalk"
{
"sv_alltalk"
{ BOOL }
{ "0" }
}
"sv_cheats"
{
"sv_cheats"
{ BOOL }
{ "0" }
}
"cr_scout"
{
"cr_scout"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_sniper"
{
"cr_sniper"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_soldier"
{
"cr_soldier"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_demoman"
{
"cr_demoman"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_medic"
{
"cr_medic"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_hwguy"
{
"cr_hwguy"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_pyro"
{
"cr_pyro"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_spy"
{
"cr_spy"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_engineer"
{
"cr_engineer"
{ NUMBER -1 -1 }
{ "0" }
}
"cr_civilian"
{
"cr_civilian"
{ NUMBER -1 -1 }
{ "0" }
}
}

7
cfg/sniper.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any sniper specific commands below this line.

7
cfg/soldier.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any soldier specific commands below this line.

7
cfg/spy.cfg Normal file
View file

@ -0,0 +1,7 @@
exec userconfig.cfg
// Place any global binds/aliases/scripts into the userconfig.cfg file and specifics into each <classname>.cfg
// IMPORTANT: The userconfig.cfg file DOES NOT auto-execute.
// It can only be executed in console with "exec userconfig.cfg" or by the <classname>.cfg files using that command as above.
// If you are reading this line, then just leave this file in the cfg folder and the userconfig.cfg file will work fine.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place any spy specific commands below this line.

21
cfg/userconfig.cfg Normal file
View file

@ -0,0 +1,21 @@
// userconfig.cfg
// Place all general binds/aliases/scripts into this file.
// Create the following files and put class specific binds/aliases/scripts into them.
// "demoman.cfg"
// "engineer.cfg"
// "hwguy.cfg"
// "medic.cfg"
// "pyro.cfg"
// "scout.cfg"
// "sniper.cfg"
// "soldier.cfg"
// "spy.cfg"
// IMPORTANT: This file DOES NOT auto-execute.
// It must be executed in the developer console with "exec userconfig.cfg" OR in the <classname>.cfg files.
// The first line of each <classname>.cfg should be "exec userconfig.cfg".
// Remove any "echo" commands you may have at the start of that file.
// For more information, see our tutorials on the Fortress-Forever Wiki. http://www.fortress-forever.com/wiki/Main_Page
// Place all global commands below this line.

23
cfg/valve.rc Normal file
View file

@ -0,0 +1,23 @@
// load the base configuration
//exec default.cfg
// Setup custom controller
exec joystick.cfg
// run a user script file if present
exec autoexec.cfg
//
// stuff command line statements
//
stuffcmds
//disable this for now.
//startupmenu
hostname "Insert witty phrase here!"
sv_password "gazellenegation"
mp_prematch 0
mp_forcerespawn 0

79
cfg/waypoint.cfg Normal file
View file

@ -0,0 +1,79 @@
//This config is used for keybindings when waypointing
//It is best used with conjuction with the default.cfg
//which will reset your keybindings back to your standard binds
//Author: GoaT_RopeR
//Version: 0.1
//Date: 20070916
//Enable Waypoint and Developer Modes
sv_cheats 1
developer 1
mp_timelimit 999
bot waypoint_view 1
bot waypoint_viewfacing 1
//Waypoint Color Options
bot waypoint_color team1 0 0 255 //Set team1 waypoints Blue
bot waypoint_color team2 255 0 0 //Set team2 waypoints Red
bot waypoin`t_color waypoint_selected 226 132 20 //Set selected waypoints Orange
bot waypoint_color link_2way 0 0 0 //Set 2way connections Black
bot waypoint_color link_1way 255 255 0 //Set 1way connections Yellow
bot waypoint_color radius 0 255 25 //Set radii Green
//File Load Binds
bind "F1" "exec addbot_team1.cfg"
bind "F2" "exec addbot_team2.cfg"
bind "F3" "exec addbot_engi.cfg"
bind "F4" "exec addbot_scout1.cfg"
bind "F5" "exec addbot_scout2.cfg"
bind "F6" "exec addbot_sniper.cfg"
bind "F12" "exec default.cfg"
//Keyboard Binds
bind "=" "bot waypoint_changeradius +10"
bind "-" "bot waypoint_changeradius -10"
bind "kp_plus" "bot waypoint_changeradius +10"
bind "kp_minus" "bot waypoint_changeradius -10"
bind "del" "bot kickall"
bind "c" "bot waypoint_addflag cappoint"
bind "j" "bot waypoint_addflag jump"
bind "r" "bot waypoint_addflag rocketjump"
bind "t" "bot waypoint_addflag teleport"
bind "p" "bot waypoint_addflag pipetrap"
bind "l" "bot waypoint_load"
bind "v" "bot waypoint_save"
bind "shift" "bot waypoint_move"
bind "f" "bot waypoint_setfacing"
//Mouse Binds
bind "mouse1" "bot waypoint_add"
bind "mouse2" "bot waypoint_connect"
bind "mouse3" "middleclick"
bind "mouse4" "bot waypoint_del"
bind "mouse5" "bot waypoint_clearcon"
bind "mwheelup" "mup"
bind "mwheeldown" "mdown"
alias "middleclick" ""
alias "mup" "echo Mouse 3: Set Waypoint Red Team;alias middleclick bot waypoint_addflag team2;alias mup snipe;alias mdown blue"
alias "mdown" "echo Mouse 3: Set Waypoint Blue Team;alias middleclick bot waypoint_addflag team1;alias mup red;alias mdown ammo"
alias "red" "echo Mouse 3: Set Waypoint Red Team;alias middleclick bot waypoint_addflag team2;alias mup snipe;alias mdown blue"
alias "blue" "echo Mouse 3: Set Waypoint Blue Team;alias middleclick bot waypoint_addflag team1;alias mup red;alias mdown ammo"
alias "ammo" "echo Mouse 3: Set Waypoint Ammo;alias middleclick bot waypoint_addflag ammo;alias mup blue;alias mdown armor"
alias "armor" "echo Mouse 3: Set Waypoint Armor;alias middleclick bot waypoint_addflag armor;alias mup ammo;alias mdown climb"
alias "climb" "echo Mouse 3: Set Waypoint Climb, Note:Set both begining and ending CLIMB tags!;alias middleclick bot waypoint_addflag climb;alias mup armor;alias mdown crouch"
alias "crouch" "echo Mouse 3: Set Waypoint Crouch;alias middleclick bot waypoint_addflag crouch;alias mup climb;alias mdown detpack"
alias "detpack" "echo Mouse 3: Set Waypoint Detpack;alias middleclick bot waypoint_addflag detpack;alias mup crouch;alias mdown dispenser"
alias "dispenser" "echo Mouse 3: Set Waypoint Dispenser;alias middleclick bot waypoint_addflag dispenser;alias mup detpack;alias mdown grenades"
alias "grenades" "echo Mouse 3: Set Waypoint Grenades;alias middleclick bot waypoint_addflag grenades;alias mup crouch;alias mdown health"
alias "health" "echo Mouse 3: Set Waypoint Health;alias middleclick bot waypoint_addflag health;alias mup grenades;alias mdown sentry"
alias "sentry" "echo Mouse 3: Set Waypoint Sentry, Note:Set facing also!;alias middleclick bot waypoint_addflag sentry;alias mup health;alias mdown snipe"
alias "snipe" "echo Mouse 3: Set Waypoint Snipe, Note:Set facing also!;alias middleclick bot waypoint_addflag snipe;alias mup sentry;alias mdown red"

BIN
credits.wri Normal file

Binary file not shown.

1500
detail.vbsp Normal file

File diff suppressed because it is too large Load diff

5787
ff_base.fgd Normal file

File diff suppressed because it is too large Load diff

125
fortressforever.fgd Normal file
View file

@ -0,0 +1,125 @@
//-------------------------------------------------------------------------
//
// Game data file for Fortress Forever.
//
//-------------------------------------------------------------------------
@include "ff_base.fgd"
@SolidClass = func_ladder :
"Ladder. Players will be able to move freely along this brush, as if it was a ladder." +
"Apply the toolsinvisibleladder material to a func_ladder brush."
[
]
//-------------------------------------------------------------------------
//
// Camera/monitor entities
//
//-------------------------------------------------------------------------
@PointClass base(Parentname, Angles) studioprop("models/editor/camera.mdl") = point_camera : "Camera"
[
spawnflags(Flags) =
[
1 : "Start Off" : 0
]
targetname(target_source) : "Name" : : "The name that other entities refer to this entity by."
FOV(float) : "FOV" : 90 : "Field of view in degrees"
// resolution(float) : "resolution" : 256 : "width/height of the render target for the camera"
UseScreenAspectRatio(choices) : "Screen Aspect Ratio" : 0 =
[
0 : "No"
1 : "Yes"
]
fogEnable(choices) : "Fog Enable" : 0 =
[
0 : "No"
1 : "Yes"
]
fogColor(color255) : "Fog Color" : "0 0 0"
fogStart(float) : "Fog Start" : 2048 : "The near fog plane."
fogEnd(float) : "Fog End" : 4096 : "The far fog/clipping plane."
renderTarget(string) : "Render Target" : "_rt_Camera" : "The render target of the camera."
// Inputs
input ChangeFOV(string) : "Changes camera's FOV over time"
input SetOnAndTurnOthersOff(void) : "Turn the camera on, and turn all other cameras off."
input SetOn(void) : "Turn the camera on."
input SetOff(void) : "Turn the camera off."
]
@SolidClass base(func_brush) = func_monitor :
"A monitor that renders the view from a given point_camera entity."
[
target(target_destination) : "Camera name"
// Inputs
input Toggle(void) : "Toggle - If on, turn off, if off, turn on."
input Enable(void) : "Enable."
input Disable(void) : "Disable."
input SetCamera(string) : "Sets the camera to use for this monitor. Takes the name of a point_camera entity in the map."
]
// Do this w/ LUA exclusively
//@SolidClass base(Trigger) = trigger_ff_location :
// "Brush-based location displaying."
//[
// areaname(string) : "Area Name" : : "The name of the area this brush is describing e.g. flag room."
// team(choices) : "Team" : "The team this area belongs to." =
// [
// 1 : "No Team"
// 2 : "Blue Team"
// 3 : "Red Team"
// 4 : "Yellow Team"
// 5 : "Green Team"
// ]
//]
@SolidClass base(Trigger) = trigger_ff_script :
"Brush-based Fortress Forever goal. Interfaced from the lua scripting environment."
[
output OnOutput(void) : "Output to be fired when activated from the lua scripting environment."
]
@SolidClass base(Targetname, RenderFields, Global) = trigger_ff_clip :
"Lua clip brush."
[
]
@PointClass base(Targetname, Parentname, Angles) studio("models/editor/ff_script_helper.mdl") = info_ff_script :
"Point-based Fortress Forever goal. Interfaced from the lua scripting environment."
[
output OnOutput(void) : "Output to be fired when activated from the lua scripting environment."
]
@PointClass base(Targetname, Angles) studio("models/editor/playerstart.mdl") = info_ff_teamspawn :
"Team Spawn. This entity is placed where players will be spawned. The scripting environment in Fortress Forever " +
"controls which players will be able to spawn here. See the documentation for more details."
[
]
@PointClass base(Targetname, Angles) studio("models/buildable/respawn_turret/respawn_turret.mdl") = ff_miniturret :
"Respawn turret!"
[
]
@PointClass base(Targetname, Angles) studio("models/props/ff_dustbowl/minecart.mdl") = ff_minecart :
"VPhysics Mine Cart"
[
start_disabled(choices) : "Start Disabled" : "Start the object disabled (unable to move)." =
[
0 : "No"
1 : "Yes"
]
]
@PointClass base(Targetname, Parentname, Angles) cylinder(255 255 255, targetname, target, radius, targetname, targetname, radius) color(255 192 0) size(16 16 16) = path_mapguide :
"An entity used to build paths for map guides to follow. Each path_mapguide is a node on the path, each holding the name of the next path_mapguide in the path."
[
target(target_destination) : "Next MapGuide Target" : : "The next path_mapguide in the path."
wait(float) : "Wait" : 10 : "Seconds spent waiting at this point."
time(float) : "Time" : 10 : "Seconds spent travelling from this point to the next."
curvetowards(target_destination) : "Curve towards target" : : "Curve towards this point."
narration(string) : "Narration" : : "Narration file to play."
]

49
gameinfo.txt Normal file
View file

@ -0,0 +1,49 @@
"GameInfo"
{
game "Fortress Forever"
title "Fortress Forever"
name "Fortress Forever"
type multiplayer_only
developer "Fortress Forever Team"
developer_url "http://www.fortress-forever.com/"
icon "resource/icon_ff"
manual "http://www.fortress-forever.com/wiki/Main_Page"
hidden_maps
{
"test_speakers" 1
"test_hardware" 1
}
FileSystem
{
SteamAppId 253530 // This will mount all the GCFs we need (240=CS:S, 220=HL2).
ToolsAppId 211 // Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
//
// The code that loads this file automatically does a few things here:
//
// 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
// 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
// For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
// 3. For the first "Game" search path, it adds a search path called "MOD".
// 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
//
//
// Search paths are relative to the base directory, which is where hl2.exe is found.
//
// |gameinfo_path| points at the directory where gameinfo.txt is.
// We always want to mount that directory relative to gameinfo.txt, so
// people can mount stuff in c:\mymod, and the main game resources are in
// someplace like c:\program files\valve\steam\steamapps\<username>\half-life 2.
//
SearchPaths
{
Game |gameinfo_path|.
Game hl2
Game FortressForever
}
}
}

11
maplist.txt Normal file
View file

@ -0,0 +1,11 @@
ff_destroy
ff_openfire
ff_napoli
ff_ksour
ff_palermo
ff_monkey
ff_schtop
ff_shutdown2
ff_aardvark
ff_warpath
ff_dustbowl

18
maps/default.lua Normal file
View file

@ -0,0 +1,18 @@
-- if no lua scripts are found for the map (ff_xxx.bsp) then this file will be loaded
IncludeScript("base_ctf");
function startup()
enabled_teams = { Team.kBlue, Team.kRed }
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)
-- disable civilians
for index, iteam in ipairs( enabled_teams ) do
local team = GetTeam(iteam)
team:SetClassLimit(Player.kCivilian, -1)
end
ConsoleToAll("No map lua found! Loaded default")
end

181
maps/ff_2fort.lua Normal file
View file

@ -0,0 +1,181 @@
IncludeScript("base_ctf");
IncludeScript("base_location");
IncludeScript("base_respawnturret");
-----------------------------------------------------------------------------------------------------------------------------
-- LOCATIONS
-- Q: wow clover, there sure are alot of them!
-- A: hell yes there are.
-----------------------------------------------------------------------------------------------------------------------------
blue_location_ulobby = location_info:new({ text = "Upper Lobby", team = Team.kBlue })
blue_location_llobby = location_info:new({ text = "Lower Lobby", team = Team.kBlue })
blue_location_ch = location_info:new({ text = "Covered Hallway", team = Team.kBlue })
blue_location_bspawn = location_info:new({ text = "Battlements Spawn", team = Team.kBlue })
blue_location_lspawn = location_info:new({ text = "Lobby Spawn", team = Team.kBlue })
blue_location_rr = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kBlue })
blue_location_crates = location_info:new({ text = "Crate Tunnel", team = Team.kBlue })
blue_location_ulift = location_info:new({ text = "Upper Elevator Room", team = Team.kBlue })
blue_location_llift = location_info:new({ text = "Lower Elevator Room", team = Team.kBlue })
blue_location_cod = location_info:new({ text = "Corner of Eternal Despair", team = Team.kBlue })
blue_location_fd = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kBlue })
blue_location_grate = location_info:new({ text = "Grate Room", team = Team.kBlue })
blue_location_uspiral = location_info:new({ text = "Upper Spiral", team = Team.kBlue })
blue_location_mspiral = location_info:new({ text = "Mid Spiral", team = Team.kBlue })
blue_location_lspiral = location_info:new({ text = "Lower Spiral", team = Team.kBlue })
blue_location_waccess = location_info:new({ text = "Water Access", team = Team.kBlue })
blue_location_wtunnel = location_info:new({ text = "Water Tunnel", team = Team.kBlue })
blue_location_bfr = location_info:new({ text = "Basement - Flagroom", team = Team.kBlue })
blue_location_bsteam = location_info:new({ text = "Basement - Steam Corridor", team = Team.kBlue })
blue_location_bmf = location_info:new({ text = "Basement - Mainframe", team = Team.kBlue })
blue_location_blobby = location_info:new({ text = "Basement - Lobby", team = Team.kBlue })
blue_location_blift = location_info:new({ text = "Basement - Elevator Side", team = Team.kBlue })
blue_location_bresup = location_info:new({ text = "Basement - Resupply", team = Team.kBlue })
blue_location_batts = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kBlue })
neutral_location_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kUnassigned })
neutral_location_ywater = location_info:new({ text = "Yard - Water", team = Team.kUnassigned })
red_location_ulobby = location_info:new({ text = "Upper Lobby", team = Team.kRed })
red_location_llobby = location_info:new({ text = "Lower Lobby", team = Team.kRed })
red_location_ch = location_info:new({ text = "Covered Hallway", team = Team.kRed })
red_location_bspawn = location_info:new({ text = "Battlements Spawn", team = Team.kRed })
red_location_lspawn = location_info:new({ text = "Lobby Spawn", team = Team.kRed })
red_location_rr = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kRed })
red_location_crates = location_info:new({ text = "Crate Tunnel", team = Team.kRed })
red_location_ulift = location_info:new({ text = "Upper Elevator Room", team = Team.kRed })
red_location_llift = location_info:new({ text = "Lower Elevator Room", team = Team.kRed })
red_location_cod = location_info:new({ text = "Corner of Eternal Despair", team = Team.kRed })
red_location_fd = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kRed })
red_location_grate = location_info:new({ text = "Grate Room", team = Team.kRed })
red_location_uspiral = location_info:new({ text = "Upper Spiral", team = Team.kRed })
red_location_mspiral = location_info:new({ text = "Mid Spiral", team = Team.kRed })
red_location_lspiral = location_info:new({ text = "Lower Spiral", team = Team.kRed })
red_location_waccess = location_info:new({ text = "Water Access", team = Team.kRed })
red_location_wtunnel = location_info:new({ text = "Water Tunnel", team = Team.kRed })
red_location_bfr = location_info:new({ text = "Basement - Flagroom", team = Team.kRed })
red_location_bsteam = location_info:new({ text = "Basement - Steam Corridor", team = Team.kRed })
red_location_bmf = location_info:new({ text = "Basement - Mainframe", team = Team.kRed })
red_location_blobby = location_info:new({ text = "Basement - Lobby", team = Team.kRed })
red_location_blift = location_info:new({ text = "Basement - Elevator Side", team = Team.kRed })
red_location_bresup = location_info:new({ text = "Basement - Resupply", team = Team.kRed })
red_location_batts = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kRed })
-----------------------------------------------------------------------------------------------------------------------------
-- bag for respawns
-----------------------------------------------------------------------------------------------------------------------------
ff_2fort_genericpack = genericbackpack:new({
health = 400,
armor = 400,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 400,
gren1 = 0,
gren2 = 0,
respawntime = 2,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function ff_2fort_genericpack:dropatspawn() return false end
blue_2fort_genericpack = ff_2fort_genericpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue } })
red_2fort_genericpack = ff_2fort_genericpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed } })
-----------------------------------------------------------------------------------------------------------------------------
-- grenpack
-----------------------------------------------------------------------------------------------------------------------------
ff_2fort_grenpack = genericbackpack:new({
health = 0,
armor = 0,
grenades = 0,
nails = 0,
shells = 0,
rockets = 0,
cells = 0,
gren1 = 2,
gren2 = 2,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function ff_2fort_grenpack:dropatspawn() return false end
blue_2fort_grenpack = ff_2fort_grenpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue } })
red_2fort_grenpack = ff_2fort_grenpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed } })
-----------------------------------------------------------------------------------------------------------------------------
-- bag by water exit that anyone can use
-----------------------------------------------------------------------------------------------------------------------------
ff_2fort_waterpack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 80,
gren1 = 0,
gren2 = 0,
respawntime = 30,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function ff_2fort_waterpack:dropatspawn() return false end
blue_2fort_waterpack = ff_2fort_waterpack:new({})
red_2fort_waterpack = ff_2fort_waterpack:new({})
-----------------------------------------------------------------------------------------------------------------------------
-- bag used in mid spiral and bottom lift resupply to stagger resources
-- tweak the respawntime of this bag to control offence/defence balance
-----------------------------------------------------------------------------------------------------------------------------
ff_2fort_spiralpack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 130,
gren1 = 0,
gren2 = 0,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function ff_2fort_spiralpack:dropatspawn() return false end
blue_2fort_spiralpack = ff_2fort_spiralpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue } })
red_2fort_spiralpack = ff_2fort_spiralpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed } })
-----------------------------------------------------------------------------
-- SPAWNS
-----------------------------------------------------------------------------
red_spiral = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSniper) or (player:GetClass() == Player.kSpy))) end
red_balc = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSniper) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSoldier) or (player:GetClass() == Player.kHwguy) or (player:GetClass() == Player.kDemoman) or (player:GetClass() == Player.kPyro) or (player:GetClass() == Player.kEngineer))) end
red_spiralspawn = { validspawn = red_spiral }
red_balcspawn = { validspawn = red_balc }
blue_spiral = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSniper) or (player:GetClass() == Player.kSpy))) end
blue_balc = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSniper) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSoldier) or (player:GetClass() == Player.kHwguy) or (player:GetClass() == Player.kDemoman) or (player:GetClass() == Player.kPyro) or (player:GetClass() == Player.kEngineer))) end
blue_spiralspawn = { validspawn = blue_spiral }
blue_balcspawn = { validspawn = blue_balc }

9
maps/ff_2fort.txt Normal file
View file

@ -0,0 +1,9 @@
ff_2fort
Industrial sector CTF (capture the flag).
Use stealth or sheer force to reach basement of the enemy base.
Once inside, steal their precious flag and capture it at your battlements.
Make them pay for their insolence!
Each capture nets your team 10 points.
The team with the most points at the end of the round wins.

View file

@ -0,0 +1,267 @@
////////////////////////////////////////////////
// FF_2FORT SOUNDSCAPES
//
// INDOORS
// OUTDOORS
// INDOORS_OUTDOORSAUDIBLE
// BASEMENT
// WATER
//
////////////////////////////////////////////////
////////////////////////////////////////////////
// INDOORS
// Basic ambience with metal scratching sounds.
////////////////////////////////////////////////
"ff_2fort.indoors"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/atmosphere/ambience5.wav"
"volume" "1.0"
"pitch" "100"
}
"playrandom"
{
"time" "3, 10"
"volume" "0.05,0.15"
"pitch" "95,105"
"position" "random"
"rndwave"
{
"wave" "ambient/materials/metal_rattle1.wav"
"wave" "ambient/materials/metal_rattle2.wav"
"wave" "ambient/materials/metal_rattle3.wav"
}
}
}
////////////////////////////////////////////////
// OUTDOORS
// Outdoor wind ambience with random gusts.
// Also has random low-volume train sounds and
// some slightly louder wildlife sound effects.
////////////////////////////////////////////////
"ff_2fort.outdoors"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.8"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "1.0"
}
"playrandom"
{
"time" "45, 90"
"volume" "0.1, 0.3"
"pitch" "50, 120"
"position" "random"
"rndwave"
{
"wave" "ambient/machines/train_rumble.wav"
"wave" "ambient/alarms/train_horn_distant1.wav"
}
}
"playrandom"
{
"time" "10, 30"
"volume" "0.3, 0.6"
"pitch" "80, 120"
"position" "random"
"rndwave"
{
"wave" "ambient/levels/coast/coastbird1.wav"
"wave" "ambient/levels/coast/coastbird2.wav"
"wave" "ambient/levels/coast/coastbird3.wav"
"wave" "ambient/levels/coast/coastbird4.wav"
"wave" "ambient/levels/coast/coastbird5.wav"
"wave" "ambient/levels/coast/coastbird6.wav"
"wave" "ambient/levels/canals/critter2.wav"
"wave" "ambient/levels/canals/critter6.wav"
"wave" "ambient/levels/canals/critter7.wav"
}
}
}
////////////////////////////////////////////////
// INDOORS OUTDOORSAUDIBLE
// Indoor soundscape with a quieter outdoor
// soundscape playing in the background.
////////////////////////////////////////////////
"ff_2fort.indoors_outdoorsaudible"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/atmosphere/ambience5.wav"
"volume" "0.9"
"pitch" "100"
}
"playrandom"
{
"time" "3, 10"
"volume" "0.05,0.15"
"pitch" "95,105"
"position" "random"
"rndwave"
{
"wave" "ambient/materials/metal_rattle1.wav"
"wave" "ambient/materials/metal_rattle2.wav"
"wave" "ambient/materials/metal_rattle3.wav"
}
}
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.5"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "0.4"
}
"playrandom"
{
"time" "45, 90"
"volume" "0.1, 0.3"
"pitch" "50, 120"
"position" "random"
"rndwave"
{
"wave" "ambient/machines/train_rumble.wav"
"wave" "ambient/alarms/train_horn_distant1.wav"
}
}
"playrandom"
{
"time" "10, 30"
"volume" "0.1, 0.4"
"pitch" "80, 120"
"position" "random"
"rndwave"
{
"wave" "ambient/levels/coast/coastbird1.wav"
"wave" "ambient/levels/coast/coastbird2.wav"
"wave" "ambient/levels/coast/coastbird3.wav"
"wave" "ambient/levels/coast/coastbird4.wav"
"wave" "ambient/levels/coast/coastbird5.wav"
"wave" "ambient/levels/coast/coastbird6.wav"
"wave" "ambient/levels/canals/critter2.wav"
"wave" "ambient/levels/canals/critter6.wav"
"wave" "ambient/levels/canals/critter7.wav"
}
}
}
////////////////////////////////////////////////
// BASEMENT
// Underground background sounds and metal stresses.
////////////////////////////////////////////////
"ff_2fort.basement"
{
"dsp" "1"
"playlooping"
{
"volume" "0.6"
"pitch" "100"
"wave" "ambient/atmosphere/corridor.wav"
}
"playlooping"
{
"volume" "0.4"
"pitch" "100"
"wave" "ambient/atmosphere/drone2lp.wav"
"position" "0"
}
"playsoundscape"
{
"name" "coast.util_metalstress"
"volume" "0.4"
}
"playsoundscape"
{
"name" "coast.util_shackmetal"
"volume" "0.3"
}
"playrandom"
{
"time" "30, 60"
"volume" "0.25, 0.50"
"pitch" "50, 120"
"position" "random"
"rndwave"
{
"wave" "ambient/materials/rustypipes1.wav"
"wave" "ambient/materials/rustypipes2.wav"
"wave" "ambient/materials/rustypipes3.wav"
"wave" "ambient/materials/shuffle1.wav"
}
}
}
////////////////////////////////////////////////
// WATER
// Some runnign water sounds and random dripping.
////////////////////////////////////////////////
"ff_2fort.water"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/water/corridor_water.wav"
"volume" "0.8"
"pitch" "100"
}
"playlooping"
{
"wave" "ambient/levels/canals/waterleak_loop1.wav"
"volume" "0.3"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_drip"
"volume" "1.0"
}
"playsoundscape"
{
"name" "d1_canals.util_fardrips"
"volume" "1.0"
}
}

301
maps/ff_aardvark.lua Normal file
View file

@ -0,0 +1,301 @@
-- ff_aardvark.lua
-----------------------------------------------------------------------------
-- number of snipers allowed per team
-----------------------------------------------------------------------------
SNIPER_LIMIT = 1;
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base");
IncludeScript("base_ctf");
IncludeScript("base_location");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10;
FLAG_RETURN_TIME = 60;
-----------------------------------------------------------------------------
-- unique aardvark locations
-----------------------------------------------------------------------------
location_redspawn = location_info:new({ text = "Respawn", team = Team.kRed })
location_redsec = location_info:new({ text = "Laser Control", team = Team.kRed })
location_redfr = location_info:new({ text = "Flag Room", team = Team.kRed })
location_redgen = location_info:new({ text = "Generator Room", team = Team.kRed })
location_redbasement = location_info:new({ text = "Basement", team = Team.kRed })
location_redwater = location_info:new({ text = "Perilous Passage", team = Team.kRed })
location_redcor = location_info:new({ text = "Utility Corridors", team = Team.kRed })
location_redlift = location_info:new({ text = "Lift", team = Team.kRed })
location_redfd = location_info:new({ text = "Front Door", team = Team.kRed })
location_redramp = location_info:new({ text = "Top Main Ramp", team = Team.kRed })
location_redrampon = location_info:new({ text = "Main Ramp", team = Team.kRed })
location_redhallspawn = location_info:new({ text = "Respawn-Side Hallway", team = Team.kRed })
location_redhallwater = location_info:new({ text = "Lift-Side Hallway", team = Team.kRed })
location_redtoilet = location_info:new({ text = "Toilet", team = Team.kRed })
location_redshame = location_info:new({ text = "Tunnel of Shame", team = Team.kRed })
location_redoven = location_info:new({ text = "OVEN", team = Team.kRed })
location_bluespawn = location_info:new({ text = "Respawn", team = Team.kBlue })
location_bluesec = location_info:new({ text = "Laser Control", team = Team.kBlue })
location_bluefr = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_bluegen = location_info:new({ text = "Generator Room", team = Team.kBlue })
location_bluebasement = location_info:new({ text = "Basement", team = Team.kBlue })
location_bluewater = location_info:new({ text = "Perilous Passage", team = Team.kBlue })
location_bluecor = location_info:new({ text = "Utility Corridors", team = Team.kBlue })
location_bluelift = location_info:new({ text = "Lift", team = Team.kBlue })
location_bluefd = location_info:new({ text = "Front Door", team = Team.kBlue })
location_blueramp = location_info:new({ text = "Top Main Ramp", team = Team.kBlue })
location_bluerampon = location_info:new({ text = "Main Ramp", team = Team.kBlue })
location_bluehallspawn = location_info:new({ text = "Respawn-Side Hallway", team = Team.kBlue })
location_bluehallwater = location_info:new({ text = "Lift-Side Hallway", team = Team.kBlue })
location_bluetoilet = location_info:new({ text = "Toilet", team = Team.kBlue })
location_blueshame = location_info:new({ text = "Tunnel of Shame", team = Team.kBlue })
location_blueoven = location_info:new({ text = "OVEN", team = Team.kBlue })
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
-----------------------------------------------------------------------------
-- set class limits
-----------------------------------------------------------------------------
function startup()
SetGameDescription("Capture the Flag")
-- set up team limits on each team
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
end
-----------------------------------------------------------------------------
-- custom aardvark packs
-----------------------------------------------------------------------------
aardvarkpack = genericbackpack:new({
health = 60,
armor = 60,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 0,
gren1 = 1,
gren2 = 1,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
aardvarkpack_metal = genericbackpack:new({
health = 0,
armor = 0,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 130,
respawntime = 6,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function aardvarkpack:dropatspawn() return false end
function aardvarkpack_metal:dropatspawn() return false end
-----------------------------------------------------------------------------
-- backpack entity setup (modified for aardvarkpack)
-----------------------------------------------------------------------------
function build_backpacks(tf)
return healthkit:new({touchflags = tf}),
armorkit:new({touchflags = tf}),
ammobackpack:new({touchflags = tf}),
bigpack:new({touchflags = tf}),
grenadebackpack:new({touchflags = tf}),
aardvarkpack:new({touchflags = tf}),
aardvarkpack_metal:new({touchflags = tf})
end
blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack, blue_aardvarkpack_metal = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack ,red_grenadebackpack, red_aardvarkpack, red_aardvarkpack_metal = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack, yellow_aardvarkpack_metal = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack, green_aardvarkpack_metal = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})
-----------------------------------------------------------------------------
-- aardvark resupply (bagless)
-----------------------------------------------------------------------------
aardvarkresup = trigger_ff_script:new({ team = Team.kUnassigned })
function aardvarkresup:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == self.team then
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
end
end
blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
-----------------------------------------------------------------------------
-- aardvark security
-----------------------------------------------------------------------------
red_aardvarksec = trigger_ff_script:new()
blue_aardvarksec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1
sec_iconx = 60
sec_icony = 30
sec_iconw = 16
sec_iconh = 16
function red_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
if redsecstatus == 1 then
redsecstatus = 0
AddSchedule("aardvarksecup10red",20,aardvarksecup10red)
AddSchedule("aardvarksecupred",30,aardvarksecupred)
OpenDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
end
end
function blue_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kRed then
if bluesecstatus == 1 then
bluesecstatus = 0
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
OpenDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_BLUEDOWN" )
RemoveHudItemFromAll( "blue-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
end
end
end
function aardvarksecupred()
redsecstatus = 1
CloseDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_ON")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
function aardvarksecupblue()
bluesecstatus = 1
CloseDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_ON")
SpeakAll( "SD_BLUEUP" )
RemoveHudItemFromAll( "blue-sec-down" )
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
function aardvarksecup10red()
BroadCastMessage("#FF_RED_SEC_10")
end
function aardvarksecup10blue()
BroadCastMessage("#FF_BLUE_SEC_10")
end
-----------------------------------------------------------------------------
-- aardvark lasers and respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function lasers_KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
if self.team == Team.kBlue then
if redsecstatus == 1 then
return EVENT_ALLOWED
end
end
if self.team == Team.kRed then
if bluesecstatus == 1 then
return EVENT_ALLOWED
end
end
end
end
return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
-------------------------
-- flaginfo
-------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
flaginfo_base(player_entity) --basic CTF HUD items
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if bluesecstatus == 1 then
AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
else
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
if redsecstatus == 1 then
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
else
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end

6
maps/ff_aardvark.txt Normal file
View file

@ -0,0 +1,6 @@
Steal the enemy flag while protecting your own
[1] Take enemy flag
[2] Bring to capture point in your base
Deactivate enemy security to open up additional routes to the enemy flag
SCORING: 10 points per flag capture
Team with most points at end of round wins

View file

@ -0,0 +1,38 @@
"aardvark_inside"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"volume" "1"
"pitch" "100"
"wave" "ambient/push/inside_amb1.wav"
}
}
"aardvark_basement"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"volume" "1"
"pitch" "100"
"wave" "ambient/water/drip_loop1.wav"
}
}
"aardvark_outside"
{
"dsp" "1"
"dsp_volume" "0.4"
"playlooping"
{
"volume" "1"
"pitch" "100"
"wave" "ff_aardvark/exo_birds.wav"
}
}

276
maps/ff_bases.lua Normal file
View file

@ -0,0 +1,276 @@
-- ff_bases.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base")
IncludeScript("base_ctf")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
function precache()
PrecacheSound( "Backpack.Touch" )
PrecacheSound( "misc.thunder" )
end
-----------------------------------------------------------------------------
-- Doors
-----------------------------------------------------------------------------
blue_only = bluerespawndoor
red_only = redrespawndoor
-----------------------------------------------------------------------------
-- Computer Explodeded
-----------------------------------------------------------------------------
fr_computer = trigger_ff_script:new({ team = Team.kUnassigned })
function fr_computer:onexplode( explosion_entity )
if IsDetpack( explosion_entity ) then
local detpack = CastToDetpack(explosion_entity)
if detpack:GetTeamId() ~= self.team then
local points = 5
local team = detpack:GetTeam()
team:AddScore(points)
local player = detpack:GetOwner()
player:AddFortPoints(points * 100, "Destroyed Computer" )
SmartSound(player, "misc.thunder", "misc.thunder", "misc.thunder")
SmartMessage(player, "You Destroyed the Enemy Command Centre!", "Your Team Destroyed the Enemy Command Centre!", "Your Command Centre has been Destroyed!")
if team:GetTeamId() == Team.kBlue then
SpeakAll( "CZ_RCC_DET" )
elseif team:GetTeamId() == Team.kRed then
SpeakAll( "CZ_BCC_DET" )
end
end
end
return EVENT_ALLOWED
end
blue_computer = fr_computer:new({ team = Team.kBlue })
red_computer = fr_computer:new({ team = Team.kRed })
-----------------------------------------------------------------------------
-- Backpacks
-----------------------------------------------------------------------------
blue_gen_pack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 1,
gren2 = 0,
cells = 130,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue}})
blue_fr_gen_pack = genericbackpack:new({
health = 30,
armor = 30,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 0,
gren2 = 0,
cells = 130,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue}})
red_gen_pack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 1,
gren2 = 0,
cells = 130,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kRed}})
red_fr_gen_pack = genericbackpack:new({
health = 30,
armor = 30,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 0,
gren2 = 0,
cells = 130,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kRed}})
-----------------------------------------------------------------------------
-- Locations
-- Switched all "Left"/"Right" so that it's from defenders pov so it makes sense to say "INCOMING RIGHT RAMP"/etc (caesium)
-----------------------------------------------------------------------------
location_midmap = location_info:new({ text = "Midmap", team = Team.kUnassigned })
location_water = location_info:new({ text = "Water", team = Team.kUnassigned })
location_blue_bments = location_info:new({ text = "Battlements", team = Team.kBlue })
location_red_bments = location_info:new({ text = "Battlements", team = Team.kRed })
location_blue_balcony = location_info:new({ text = "Balcony", team = Team.kBlue })
location_red_balcony = location_info:new({ text = "Balcony", team = Team.kRed })
location_blue_frontdoor = location_info:new({ text = "Front Door", team = Team.kBlue })
location_red_frontdoor = location_info:new({ text = "Front Door", team = Team.kRed })
location_blue_frontdoor_ramp = location_info:new({ text = "Front Door Ramp", team = Team.kBlue })
location_red_frontdoor_ramp = location_info:new({ text = "Front Door Ramp", team = Team.kRed })
location_blue_midramps = location_info:new({ text = "Mid Ramps", team = Team.kBlue })
location_red_midramps = location_info:new({ text = "Mid Ramps", team = Team.kRed })
location_blue_midramps_left = location_info:new({ text = "Right Ramp", team = Team.kBlue })
location_red_midramps_left = location_info:new({ text = "Right Ramp", team = Team.kRed })
location_blue_midramps_right = location_info:new({ text = "Left Ramp", team = Team.kBlue })
location_red_midramps_right = location_info:new({ text = "Left Ramp", team = Team.kRed })
location_blue_flagroom = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_red_flagroom = location_info:new({ text = "Flag Room", team = Team.kRed })
location_blue_sniperdeck = location_info:new({ text = "Sniper Deck", team = Team.kBlue })
location_red_sniperdeck = location_info:new({ text = "Sniper Deck", team = Team.kRed })
location_blue_ramproom = location_info:new({ text = "Main Room", team = Team.kBlue })
location_red_ramproom = location_info:new({ text = "Main Room", team = Team.kRed })
location_blue_lower = location_info:new({ text = "Lower Level", team = Team.kBlue })
location_red_lower = location_info:new({ text = "Lower Level", team = Team.kRed })
location_blue_upper = location_info:new({ text = "Upper Level", team = Team.kBlue })
location_red_upper = location_info:new({ text = "Upper Level", team = Team.kRed })
location_blue_airlift = location_info:new({ text = "Air Lift", team = Team.kBlue })
location_red_airlift = location_info:new({ text = "Air Lift", team = Team.kRed })
location_blue_lowerladder = location_info:new({ text = "Lower Ladder to Ramp Room", team = Team.kBlue })
location_red_lowerladder = location_info:new({ text = "Lower Ladder to Ramp Room", team = Team.kRed })
location_blue_rightcorridoor = location_info:new({ text = "Left Corridor", team = Team.kBlue })
location_red_rightcorridoor = location_info:new({ text = "Left Corridor", team = Team.kRed })
location_blue_leftcorridoor = location_info:new({ text = "Right Corridor", team = Team.kBlue })
location_red_leftcorridoor = location_info:new({ text = "Right Corridor", team = Team.kRed })
location_blue_rightresupply = location_info:new({ text = "Left Respawn", team = Team.kBlue })
location_red_rightresupply = location_info:new({ text = "Left Respawn", team = Team.kRed })
location_blue_leftresupply = location_info:new({ text = "Right Respawn", team = Team.kBlue })
location_red_leftresupply = location_info:new({ text = "Right Respawn", team = Team.kRed })
location_blue_leftspawn = location_info:new({ text = "Left Respawn", team = Team.kBlue })
location_red_leftspawn = location_info:new({ text = "Left Respawn", team = Team.kRed })
location_blue_secret = location_info:new({ text = "Secret Passage", team = Team.kBlue })
location_red_secret = location_info:new({ text = "Secret Passage", team = Team.kRed })
location_blue_flagroom_passage = location_info:new({ text = "Flagroom Hole Access Passage", team = Team.kBlue })
location_red_flagroom_passage = location_info:new({ text = "Flagroom Hole Access Passage", team = Team.kRed })
location_blue_flagroom_ramp = location_info:new({ text = "Flag Room Ramp", team = Team.kBlue })
location_red_flagroom_ramp = location_info:new({ text = "Flag Room Ramp", team = Team.kRed })
location_blue_water_entry = location_info:new({ text = "Water Entrance", team = Team.kBlue })
location_red_water_entry = location_info:new({ text = "Water Entrance", team = Team.kRed })
location_blue_water_exit = location_info:new({ text = "Water Exit", team = Team.kBlue })
location_red_water_exit = location_info:new({ text = "Water Exit", team = Team.kRed })
location_blue_water_access = location_info:new({ text = "Water Access", team = Team.kBlue })
location_red_water_access = location_info:new({ text = "Water Access", team = Team.kRed })
-----------------------------------------------------------------------------
-- spawn
-----------------------------------------------------------------------------
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
-- end of default player_spawn
player:RemoveAmmo( Ammo.kManCannon, 1 )
end
-----------------------------------------------------------------------------
-- Respawns
-----------------------------------------------------------------------------
spawn_red_offence = function(self,player)
return ((player:GetTeamId() == Team.kRed)
and ((player:GetClass() == Player.kScout)
or (player:GetClass() == Player.kMedic)
or (player:GetClass() == Player.kSpy)))
end
spawn_red_defence = function(self,player)
return ((player:GetTeamId() == Team.kRed)
and (((player:GetClass() == Player.kScout) == false)
and ((player:GetClass() == Player.kMedic) == false)
and ((player:GetClass() == Player.kSpy) == false)))
end
spawn_blue_offence = function(self,player)
return ((player:GetTeamId() == Team.kBlue)
and ((player:GetClass() == Player.kScout)
or (player:GetClass() == Player.kMedic)
or (player:GetClass() == Player.kSpy)))
end
spawn_blue_defence = function(self,player)
return ((player:GetTeamId() == Team.kBlue)
and (((player:GetClass() == Player.kScout) == false)
and ((player:GetClass() == Player.kMedic) == false)
and ((player:GetClass() == Player.kSpy) == false)))
end
bluespawn_offence = { validspawn = spawn_blue_offence }
bluespawn_defence = { validspawn = spawn_blue_defence }
redspawn_offence = { validspawn = spawn_red_offence }
redspawn_defence = { validspawn = spawn_red_defence }
-----------------------------------------------------------------------------
-- Basecap (no mancannon)
-----------------------------------------------------------------------------
bases_cap = basecap:new({
mancannons = 0,
})
-- red cap point
red_cap = bases_cap:new({team = Team.kRed,
item = {"blue_flag","yellow_flag","green_flag"}})
-- blue cap point
blue_cap = bases_cap:new({team = Team.kBlue,
item = {"red_flag","yellow_flag","green_flag"}})

7
maps/ff_bases.txt Normal file
View file

@ -0,0 +1,7 @@
CAPTURE THE FLAG
Get the enemy flag and take it back to your capture point to score.
Alternately: Detpack the enemy computer to score.
Visit http://www.fortress-forever.com for more information.

View file

@ -0,0 +1,229 @@
--------------------------------------------------------------
FF_BASES SOUNDSCAPES
--------------------------------------------------------------
"ff_bases.midmap"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.5"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "1.0"
}
}
"ff_bases.water"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/atmosphere/ambience5.wav"
"volume" "0.1"
"pitch" "100"
}
"playlooping"
{
"wave" "ambient/water/drip_loop1.wav"
"volume" "0.3"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_drip"
"volume" "1.0"
}
"playsoundscape"
{
"name" "d1_canals.util_fardrips"
"volume" "1.0"
}
}
"ff_bases.ramproom"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"name" "ambient/atmosphere/ambience_base.wav"
"volume" "0.3"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.5"
"pitch" "100"
}
}
"ff_bases.corridor1"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"name" "ambient/atmosphere/ambience_base.wav"
"volume" "0.5"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.5"
"pitch" "100"
}
}
"ff_bases.bments"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"name" "ambient/levels/canals/tunnel_wind_loop1.wav"
"volume" "0.7"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.4"
"pitch" "100"
}
}
"ff_bases.out"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"name" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.7"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "1.0"
}
}
"ff_bases.secret"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"name" "ambient/atmosphere/ambience_base.wav"
"volume" "0.6"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.3"
"pitch" "100"
}
}
"ff_bases.computer"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.3"
"pitch" "100"
}
"playlooping"
{
"wave" "ambient/machines/lab_loop1.wav"
"volume" "0.4"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "0.3"
}
}
"ff_bases.flagroom"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.4"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "0.3"
}
}
"ff_bases.lower"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/atmosphere/ambience_base.wav"
"volume" "0.3"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.6"
"pitch" "100"
}
}
"ff_bases.water2"
{
"dsp" "1"
"dsp_volume" "0.5"
"playlooping"
{
"wave" "ambient/atmosphere/ambience_base.wav"
"volume" "0.1"
"pitch" "100"
}
"playlooping"
{
"name" "ambient/push/inside_amb1.wav"
"volume" "0.6"
"pitch" "100"
}
}

21
maps/ff_cz2.lua Normal file
View file

@ -0,0 +1,21 @@
-- ff_cz2.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_cp_default")
IncludeScript("base_cp")
-----------------------------------------------------------------------------
-- overrides
-----------------------------------------------------------------------------
function healthkit:dropatspawn() return false end
-----------------------------------------------------------------------------
-- locations
-----------------------------------------------------------------------------

22
maps/ff_cz2.txt Normal file
View file

@ -0,0 +1,22 @@
ff_cz2
GAME MODE: Command Point (CP)
Capture and control each command point.
TEAMS: Red vs Blue
OBJECTIVES:
- Capture command points by standing on them.
- Defend points from enemy captures.
SCORING:
- Command points farthest from your
base are worth more points, which
are rewarded every 15-30 seconds.
- All Cap: 100 points are given for
capturing all command points, which
also resets players, flags, and CPs.
Visit www.fortress-forever.com for
additional information.

316
maps/ff_destroy.lua Normal file
View file

@ -0,0 +1,316 @@
-- ff_destroy.lua
-- caesium 01/2009
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base");
IncludeScript("base_ctf");
IncludeScript("base_location");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10;
FLAG_RETURN_TIME = 60;
-----------------------------------------------------------------------------
-- locations
-----------------------------------------------------------------------------
location_redfd = location_info:new({ text = "Foyer", team = Team.kRed })
location_redramp = location_info:new({ text = "Main Ramps", team = Team.kRed })
location_redspawn = location_info:new({ text = "Respawn", team = Team.kRed })
location_redtopramp = location_info:new({ text = "Top Main Ramps", team = Team.kRed })
location_redbalc = location_info:new({ text = "Balcony", team = Team.kRed })
location_redsec = location_info:new({ text = "Security Control", team = Team.kRed })
location_redfr = location_info:new({ text = "Flag Room", team = Team.kRed })
location_redresup = location_info:new({ text = "Resupply", team = Team.kRed })
location_bluefd = location_info:new({ text = "Foyer", team = Team.kBlue })
location_blueramp = location_info:new({ text = "Main Ramps", team = Team.kBlue })
location_bluespawn = location_info:new({ text = "Respawn", team = Team.kBlue })
location_bluetopramp = location_info:new({ text = "Top Main Ramps", team = Team.kBlue })
location_bluebalc = location_info:new({ text = "Balcony", team = Team.kBlue })
location_bluesec = location_info:new({ text = "Security Control", team = Team.kBlue })
location_bluefr = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_blueresup = location_info:new({ text = "Resupply", team = Team.kBlue })
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
-----------------------------------------------------------------------------
-- remove mirvs (?) and give full resup on spawn
-----------------------------------------------------------------------------
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
-- if player:GetClass() == Player.kHwguy then
-- player:RemoveAmmo(Ammo.kGren2, 4)
-- end
-- if player:GetClass() == Player.kDemoman then
-- player:RemoveAmmo(Ammo.kGren2, 4)
-- end
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
-----------------------------------------------------------------------------
-- bagless resupply
-----------------------------------------------------------------------------
aardvarkresup = trigger_ff_script:new({ team = Team.kUnassigned })
function aardvarkresup:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == self.team then
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
end
end
blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
-----------------------------------------------------------------------------
-- aardvark security
-----------------------------------------------------------------------------
red_aardvarksec = trigger_ff_script:new()
blue_aardvarksec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1
sec_iconx = 60
sec_icony = 30
sec_iconw = 16
sec_iconh = 16
function red_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
if redsecstatus == 1 then
redsecstatus = 0
AddSchedule("aardvarksecup10red",20,aardvarksecup10red)
AddSchedule("aardvarksecupred",30,aardvarksecupred)
OpenDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
end
end
function blue_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kRed then
if bluesecstatus == 1 then
bluesecstatus = 0
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
OpenDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_BLUEDOWN" )
RemoveHudItemFromAll( "blue-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
end
end
end
function aardvarksecupred()
redsecstatus = 1
CloseDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_ON")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
function aardvarksecupblue()
bluesecstatus = 1
CloseDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_ON")
SpeakAll( "SD_BLUEUP" )
RemoveHudItemFromAll( "blue-sec-down" )
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
function aardvarksecup10red()
BroadCastMessage("#FF_RED_SEC_10")
end
function aardvarksecup10blue()
BroadCastMessage("#FF_BLUE_SEC_10")
end
-----------------------------------------------------------------------------
-- aardvark lasers and respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function lasers_KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
if self.team == Team.kBlue then
if redsecstatus == 1 then
return EVENT_ALLOWED
end
end
if self.team == Team.kRed then
if bluesecstatus == 1 then
return EVENT_ALLOWED
end
end
end
end
return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
-------------------------
-- flaginfo
-------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
flaginfo_base(player_entity) --basic CTF HUD items
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if bluesecstatus == 1 then
AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
else
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
if redsecstatus == 1 then
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
else
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
-----------------------------------------------------------------------------
-- custom packs
-----------------------------------------------------------------------------
aardvarkpack_fr = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 130,
gren1 = 0,
gren2 = 0,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
aardvarkpack_ramp = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 0,
gren1 = 0,
gren2 = 0,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
aardvarkpack_sec = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 0,
gren1 = 1,
gren2 = 1,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function aardvarkpack_fr:dropatspawn() return false end
function aardvarkpack_ramp:dropatspawn() return false end
function aardvarkpack_sec:dropatspawn() return false end
-----------------------------------------------------------------------------
-- backpack entity setup (modified for aardvarkpacks)
-----------------------------------------------------------------------------
function build_backpacks(tf)
return healthkit:new({touchflags = tf}),
armorkit:new({touchflags = tf}),
ammobackpack:new({touchflags = tf}),
bigpack:new({touchflags = tf}),
grenadebackpack:new({touchflags = tf}),
aardvarkpack_fr:new({touchflags = tf}),
aardvarkpack_ramp:new({touchflags = tf}),
aardvarkpack_sec:new({touchflags = tf})
end
blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack_fr, blue_aardvarkpack_ramp, blue_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack, red_grenadebackpack, red_aardvarkpack_fr, red_aardvarkpack_ramp, red_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack_fr, yellow_aardvarkpack_ramp, yellow_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack_fr, green_aardvarkpack_ramp, green_aardvarkpack_sec = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})
-----------------------------------------------------------------------------
-- bouncepads for lifts
-----------------------------------------------------------------------------
base_jump = trigger_ff_script:new({ pushz = 0 })
function base_jump:ontouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
local playerVel = player:GetVelocity()
playerVel.z = self.pushz
player:SetVelocity( playerVel )
end
end
lift_red = base_jump:new({ pushz = 600 })
lift_blue = base_jump:new({ pushz = 600 })

6
maps/ff_destroy.txt Normal file
View file

@ -0,0 +1,6 @@
Steal the enemy flag while protecting your own:
[1] Deactivate enemy security system
[2] Take enemy flag
[3] Bring to capture point in your base
SCORING: 10 points per flag capture
Based on original TFC map by Koochy ;D

172
maps/ff_dm.lua Normal file
View file

@ -0,0 +1,172 @@
-- ff_dm.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
-- IncludeScript("base_soldierarena");
IncludeScript("base_teamplay");
function startup()
-- set up team limits (only red & blue)
SetPlayerLimit( Team.kBlue, 0 )
SetPlayerLimit( Team.kRed, 0 )
SetPlayerLimit( Team.kYellow, -1 )
SetPlayerLimit( Team.kGreen, -1 )
SetTeamName( Team.kRed, "Destroyers" )
end
function precache()
PrecacheSound( "Backpack.Touch" )
end
--function player_onconc( player_entity, concer_entity )
-- -- player_entity is always a player
-- local player = CastToPlayer( player_entity )
-- local concer = CastToPlayer( concer_entity )
--
-- ConsoleToAll( "Running player_onconc! Player: " .. player:GetName() .. " Concer: " .. concer:GetName() )
-- ConsoleToAll( "conc_duration = " .. conc_duration .. " conc_iconduration = " .. conc_iconduration )
--
-- if player:GetTeamId() == Team.kRed then
-- return EVENT_DISALLOWED
-- end
--
-- conc_duration = -1
-- conc_iconduration = -1
--
-- ConsoleToAll( "conc_duration = " .. conc_duration .. " conc_iconduration = " .. conc_iconduration )
--
-- return EVENT_ALLOWED
--end
--function player_ontranq( player_entity, tranqer_entity )
-- local player = CastToPlayer( player_entity )
-- local tranqer = CastToPlayer( tranqer_entity )
--
-- ConsoleToAll( "Running player_ontranq! Player: " .. player:GetName() .. " Tranqer: " .. tranqer:GetName() )
-- ConsoleToAll( "tranq_duration = " .. tranq_duration .. " tranq_iconduration = " .. tranq_iconduration .. " tranq_speed = " .. tranq_speed )
--
-- if player:GetTeamId() == Team.kRed then
-- return EVENT_DISALLOWED
-- end
--
-- tranq_duration = -1
-- tranq_iconduration = -1
-- tranq_speed = 0.2
--
-- return EVENT_ALLOWED
--end
-- Everyone to spawns with everything
function player_spawn( player_entity )
-- 400 for overkill. of course the values
-- get clamped in game code
--local player = GetPlayer(player_id)
local player = CastToPlayer( player_entity )
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )
player:AddAmmo( Ammo.kGren1, 4 )
player:AddAmmo( Ammo.kGren2, 4 )
end
function player_onkill( player )
-- Test, Don't let blue team suicide.
-- if player:GetTeamId() == Team.kBlue then
-- return false
-- end
return true
end
-- Get team points for killing a player
function player_killed( player_entity, damageinfo )
-- suicides have no damageinfo
if damageinfo ~= nil then
local killer = damageinfo:GetAttacker()
local player = CastToPlayer( player_entity )
if IsPlayer(killer) then
killer = CastToPlayer(killer)
--local victim = GetPlayer(player_id)
if not (player:GetTeamId() == killer:GetTeamId()) then
local killersTeam = killer:GetTeam()
killersTeam:AddScore(1)
end
end
end
end
-- Just here because
function player_ondamage( player_entity, damageinfo )
end
-- Infinite bag
infini_bag = trigger_ff_script:new({ touchsound = "Backpack.Touch" })
-- Infinite bag :: ontouch
function infini_bag:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
-- 400 for overkill. of course the values
-- get clamped in game code
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )
player:AddAmmo( Ammo.kGren1, 4 )
player:AddAmmo( Ammo.kGren2, 4 )
-- Play the touch sound
player:EmitSound( self.touchsound )
end
end
function infini_bag:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == self.team then
return true
end
end
return false
end
-- Red infinite bag
red_infini_bag = infini_bag:new({ team = Team.kRed })
-- Blue infinite bag
blue_infini_bag = infini_bag:new({ team = Team.kBlue })
-- Spawn doors
spawn_door_trigger = trigger_ff_script:new({ team = Team.kUnassigned, doorname = "" })
function spawn_door_trigger:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == self.team then
if self.doorname then
OpenDoor( self.doorname )
end
end
end
end
red_spawn_door1_trigger = spawn_door_trigger:new({ team = Team.kRed, doorname = "red_spawn_door1" })
red_spawn_door2_trigger = spawn_door_trigger:new({ team = Team.kRed, doorname = "red_spawn_door2" })
blue_spawn_door1_trigger = spawn_door_trigger:new({ team = Team.kBlue, doorname = "blue_spawn_door1" })
blue_spawn_door2_trigger = spawn_door_trigger:new({ team = Team.kBlue, doorname = "blue_spawn_door2" })

295
maps/ff_dustbowl.lua Normal file
View file

@ -0,0 +1,295 @@
-- ff_dustbowl.lua
-- includes
IncludeScript("base_ad");
IncludeScript("base_location");
-- set teams
ATTACKERS = Team.kBlue
DEFENDERS = Team.kRed
dbhealthkit = genericbackpack:new({
health = 50,
model = "models/items/healthkit.mdl",
materializesound = "Item.Materialize",
touchsound = "HealthKit.Touch"
})
dbarmorkit = genericbackpack:new({
armor = 200,
model = "models/items/armour/armour.mdl",
materializesound = "Item.Materialize",
touchsound = "ArmorKit.Touch"
})
dbammopack = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 100,
rockets = 15,
cells = 130,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammopack:dropatspawn() return false end
dbgrenadepackone = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
mancannons = 1,
gren1 = 2,
gren2 = 2,
armor = 100,
health = 300,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbgrenadepackone:dropatspawn() return false end
dbgrenadepacktwo = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
mancannons = 1,
gren1 = 2,
gren2 = 2,
armor = 100,
health = 100,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbgrenadepacktwo:dropatspawn() return false end
dbammotypeone = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 130,
armor = 50,
health = 40,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypeone:dropatspawn() return false end
dbammotypetwo = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 25,
health = 50,
respawntime = 6,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypetwo:dropatspawn() return false end
dbammotypethree = genericbackpack:new({
grenades = 30,
nails = 150,
shells = 50,
rockets = 30,
cells = 200,
armor = 100,
health = 75,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypethree:dropatspawn() return false end
dbammotypefour = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 100,
health = 100,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypefour:dropatspawn() return false end
dbammotypefive = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 100,
health = 100,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypefive:dropatspawn() return false end
dbammotypesix = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 130,
armor = 50,
health = 50,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypesix:dropatspawn() return false end
dbammotypeseven = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 75,
health = 75,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypeseven:dropatspawn() return false end
dbammotypeeight = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 300,
health = 100,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypeeight:dropatspawn() return false end
dbammotypenine = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 30,
health = 30,
respawntime = 6,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypenine:dropatspawn() return false end
dbammotypeten = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 150,
armor = 10,
health = 20,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypeten:dropatspawn() return false end
dbammotypeeleven = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 0,
health = 20,
respawntime = 4,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypeeleven:dropatspawn() return false end
dbammotypetwelve = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 100,
rockets = 20,
cells = 130,
armor = 100,
health = 0,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypetwelve:dropatspawn() return false end
dbammotypethirteen = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 100,
armor = 25,
health = 25,
respawntime = 5,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypethirteen:dropatspawn() return false end
dbammotypefourteen = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 200,
armor = 0,
health = 0,
respawntime = 4,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function dbammotypefourteen:dropatspawn() return false end

10
maps/ff_dustbowl.txt Normal file
View file

@ -0,0 +1,10 @@
ATTACK OR DEFEND
Objective: Blue team must take their flag to
Red team's Headquarters to win the game.
There are two command points on the way
which must be secured in order.
Other Notes: When a capture point is secured,
spawn points are revised and a new flag
appears. Rounds last 25 minutes.

377
maps/ff_fusion.lua Normal file
View file

@ -0,0 +1,377 @@
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_idzone")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- global overrides that you can do what you want with
-----------------------------------------------------------------------------
FORT_POINTS_PER_INITIAL_TOUCH = 200
FORT_POINTS_PER_PERIOD = 50
FORT_POINTS_PER_DEFEND = 100
POINTS_PER_INITIAL_TOUCH = 1
POINTS_PER_PERIOD = 1
DELAY_BEFORE_PERIOD_POINTS = 2
PERIOD_TIME = 1
INITIAL_ROUND_PERIOD = 60
ROUND_SETUP_PERIOD = 17
DEFENSE_PERIOD_TIME = 60
POINTS_PER_DEFENSE_PERIOD = 1
DEFAULT_POINTS_TO_CAP = 10
NUMBER_OF_CAP_POINTS = 3
DELAY_BEFORE_TEAMSWITCH = 3
DELAY_AFTER_CAP = 3
ZONE_COLOR = "purple"
-----------------------------------------------------------------------------
-- Zone-controlling outputs
-----------------------------------------------------------------------------
function oncap_outputs()
OutputEvent( "shake"..phase, "StartShake" )
OutputEvent( "shakebreak"..phase, "Playsound" )
AddSchedule( "Partition_On", 4, OutputEvent,"cp"..phase.."_partition", "TurnOn")
AddSchedule( "Partition_Enabled", 4, OutputEvent,"cp"..phase.."_partition", "Enable")
AddSchedule( "Partition_Door_On", 4, OutputEvent, "cp"..phase.."_partition_door", "TurnOff")
AddSchedule( "Partition_Door_Enable", 4, OutputEvent, "cp"..phase.."_partition_door", "Disable")
AddSchedule( "Areaportal_On", 4, OutputEvent, "cp"..phase.."_areaportal_door", "Open")
AddSchedule( "Areaportal_Partition_On", 4, OutputEvent, "cp"..phase.."_areaportal", "Close")
AddSchedule( "alarm_voice", 2, OutputEvent, "voice1", "PlaySound")
AddSchedule( "alarm_text", 2, schedulemessagetoall, "Zone Captured!")
AddSchedule( "stop_voice", 2.5, OutputEvent, "voice1", "StopSound")
AddSchedule( "alarm_voices", 2.5, OutputEvent, "voice2", "PlaySound")
AddSchedule( "stop_voices", 2.975, OutputEvent, "voice2", "StopSound")
AddSchedule( "35 second warning", 7, schedulemessagetoall, "Gate Opens in 35 seconds!")
AddSchedule( "35 second warning_sound" , 7 , schedulesound, "misc.bloop" )
AddSchedule( "dooropen5sec_sound", 37, schedulecountdown, "5")
AddSchedule( "dooropen4sec_sound", 38, schedulecountdown, "4")
AddSchedule( "dooropen3sec_sound", 39, schedulecountdown, "3")
AddSchedule( "dooropen2sec_sound", 40, schedulecountdown, "2")
AddSchedule( "dooropen1sec_sound", 41, schedulecountdown, "1")
AddSchedule("alarm_events", 42, OutputEvent, "breakglass"..phase, "Break")
AddSchedule("alarm_sounds", 42, OutputEvent, "breakalarm"..phase, "PlaySound")
if phase == 1 then
defender_door_trigger1 = id_door:new({ team = attackers, door = "defender_door1" })
defender_door_trigger2 = id_door:new({ team = attackers, door = "defender_door2" })
end
if phase == 2 then
defender_door_trigger3 = id_door:new({ team = attackers, door = "defender_door3" })
defender_door_trigger4 = id_door:new({ team = attackers, door = "defender_door4" })
end
end
function oncap_outputs_nextphase()
RespawnAllPlayers()
end
function onreset_outputs()
OutputEvent( "breakalarm"..phase, "Playsound" )
OutputEvent( "shake"..phase, "StartShake" )
OutputEvent( "shakebreak"..phase, "Playsound" )
AddSchedule( "alarm_voice", 2, OutputEvent, "voice1", "PlaySound")
AddSchedule( "alarm_text", 2, schedulemessagetoall, "Zone Captured!")
AddSchedule( "stop_voice", 2.5, OutputEvent, "voice1", "StopSound")
AddSchedule( "alarm_voices", 2.5, OutputEvent, "voice2", "PlaySound")
AddSchedule( "stop_voices", 2.97, OutputEvent, "voice2", "StopSound")
end
function zone_on_outputs()
-- use for entities that have two copies per zone (e.g. rotate1 and rotate2)
two1 = phase * 2 - 1
two2 = phase * 2
-- use for entities that have three copies per zone (e.g. rotate1, rotate2, and rotate3)
three1 = phase * 3 - 2
three2 = phase * 3 - 1
three3 = phase * 3
-- use for entities that have three copies per zone (e.g. rotate1, rotate2, rotate3 and rotate4)
four1 = phase * 4 - 3
four2 = phase * 4 - 2
four3 = phase * 4 - 1
four4 = phase * 4
-- outputs
OutputEvent( "alarm"..phase, "PlaySound" )
OutputEvent( "light"..phase, "TurnOn" )
OutputEvent( "spot"..phase, "LightOn" )
OutputEvent( "rotate"..two1, "Start" )
OutputEvent( "rotate"..two2, "Start" )
OutputEvent( "Tesla"..phase, "DoSpark" )
end
function zone_off_outputs()
-- use for entities that have two copies per zone (e.g. rotate1 and rotate2)
two1 = phase * 2 - 1
two2 = phase * 2
-- use for entities that have three copies per zone (e.g. rotate1, rotate2, and rotate3)
three1 = phase * 3 - 2
three2 = phase * 3 - 1
three3 = phase * 3
-- use for entities that have three copies per zone (e.g. rotate1, rotate2, rotate3 and rotate4)
four1 = phase * 4 - 3
four2 = phase * 4 - 2
four3 = phase * 4 - 1
four4 = phase * 4
-- outputs
OutputEvent( "alarm"..phase, "StopSound" )
OutputEvent( "light"..phase, "TurnOff" )
OutputEvent( "spot"..phase, "LightOff" )
OutputEvent( "rotate"..two1, "Stop" )
OutputEvent( "rotate"..two2, "Stop" )
end
function openstartdoor()
-- unlock them doors
attacker_door_trigger1 = id_door:new({ team = attackers, door = "attacker_door1" })
attacker_door_trigger2 = id_door:new({ team = attackers, door = "attacker_door2" })
-- open the first door
OutputEvent( "attacker_door1", "Open" )
OutputEvent( "attacker_door2", "Open" )
end
function onswitch()
-- reset doors to open for the right team
defender_door_trigger1 = id_door:new({ team = defenders, door = "defender_door1" })
defender_door_trigger2 = id_door:new({ team = defenders, door = "defender_door2" })
defender_door_trigger3 = id_door:new({ team = defenders, door = "defender_door3" })
defender_door_trigger4 = id_door:new({ team = defenders, door = "defender_door4" })
defender_door_trigger5 = id_door:new({ team = defenders, door = "defender_door5" })
defender_door_trigger6 = id_door:new({ team = defenders, door = "defender_door6" })
defender_door_trigger7 = id_door:new({ team = defenders, door = "defender_door7" })
defender_door_trigger8 = id_door:new({ team = defenders, door = "defender_door8" })
-- lock them doors
attacker_door_trigger1 = id_door:new({ team = Team.kUnassigned, door = "attacker_door1" })
attacker_door_trigger2 = id_door:new({ team = Team.kUnassigned, door = "attacker_door2" })
OutputEvent( "point_template", "ForceSpawn" )
end
function onswitch_bluetodef()
-- switch the lights
OutputEvent( "defender_light1", "TurnOff" )
OutputEvent( "defender_spotlight1", "LightOff" )
OutputEvent( "defender_light2", "TurnOn" )
OutputEvent( "defender_spotlight2", "LightOn" )
OutputEvent( "cp1_partition", "TurnOff" )
OutputEvent( "cp1_partition", "Disable" )
OutputEvent( "cp2_partition", "TurnOff" )
OutputEvent( "cp2_partition", "Disable" )
OutputEvent( "cp1_areaportal", "Open" )
OutputEvent( "cp1_areaportal_door", "Close" )
OutputEvent( "cp2_areaportal", "Open" )
OutputEvent( "cp2_areaportal_door", "Close" )
OutputEvent( "cp1_partition_door", "TurnOn")
OutputEvent( "cp1_partition_door", "Enable")
OutputEvent( "cp2_partition_door", "TurnOn")
OutputEvent( "cp2_partition_door", "Enable")
-- switch them packs, for real this time; this is a workaround due to how the touchflags are set in base.lua
local num_packs = 9
for i=1,num_packs do
entity = GetEntityByName( "gen_pack_defender"..i )
local info = CastToInfoScript( entity )
info:SetTouchFlags({ AllowFlags.kBlue})
end
end
function onswitch_redtodef()
-- switch the lights
OutputEvent( "defender_light1", "TurnOn" )
OutputEvent( "defender_spotlight1", "LightOn" )
OutputEvent( "defender_light2", "TurnOff" )
OutputEvent( "defender_spotlight2", "LightOff" )
OutputEvent( "cp1_partition", "TurnOff" )
OutputEvent( "cp1_partition", "Disable" )
OutputEvent( "cp2_partition", "TurnOff" )
OutputEvent( "cp2_partition", "Disable" )
OutputEvent( "cp1_areaportal", "Open" )
OutputEvent( "cp1_areaportal_door", "Close" )
OutputEvent( "cp2_areaportal", "Open" )
OutputEvent( "cp2_areaportal_door", "Close" )
OutputEvent( "cp1_partition_door", "TurnOn")
OutputEvent( "cp1_partition_door", "Enable")
OutputEvent( "cp2_partition_door", "TurnOn")
OutputEvent( "cp2_partition_door", "Enable")
-- switch them packs, for real this time; this is a workaround due to how the touchflags are set in base.lua
local num_packs = 9
for i=1,num_packs do
entity = GetEntityByName( "gen_pack_defender"..i )
local info = CastToInfoScript( entity )
info:SetTouchFlags({ AllowFlags.kRed})
end
end
-----------------------------------------------------------------------------
-- backpacks, doors, etc. etc.
-----------------------------------------------------------------------------
gen_pack = genericbackpack:new({
health = 30,
armor = 25,
grenades = 20,
nails = 50,
shells = 300,
rockets = 15,
gren1 = 1,
gren2 = 0,
cells = 120,
respawntime = 10,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function gen_pack:dropatspawn() return false
end
gen_pack_defender1 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender2 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender3 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender4 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender5 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender6 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender7 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender8 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
gen_pack_defender9 = gen_pack:new({ touchflags = {AllowFlags.kRed} })
-----------------------------------------------------------------------------
-- No Fucking Annoyances
-----------------------------------------------------------------------------
noannoyances = trigger_ff_script:new({})
function noannoyances:onbuild( build_entity )
return EVENT_DISALLOWED
end
function noannoyances:onexplode( explode_entity )
if IsGrenade( explode_entity ) then
return EVENT_DISALLOWED
end
return EVENT_ALLOWED
end
function noannoyances:oninfect( infect_entity )
return EVENT_DISALLOWED
end
no_annoyances = noannoyances
spawn_protection = noannoyances
------------------------------------------------------------------
--Resup Doors
------------------------------------------------------------------
neutral_door_trigger1 = trigger_ff_script:new({})
function neutral_door_trigger1:ontouch( trigger_entity )
OutputEvent( "neutral_door1", "Open" )
end
id_door = trigger_ff_script:new({ team = Team.kUnassigned, door = nil })
function id_door:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function id_door:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent(self.door, "Open")
end
end
attacker_door_trigger1 = id_door:new({ team = Team.kUnassigned, door = "attacker_door1" })
attacker_door_trigger2 = id_door:new({ team = Team.kUnassigned, door = "attacker_door2" })
defender_door_trigger1 = id_door:new({ team = defenders, door = "defender_door1" })
defender_door_trigger2 = id_door:new({ team = defenders, door = "defender_door2" })
defender_door_trigger3 = id_door:new({ team = defenders, door = "defender_door3" })
defender_door_trigger4 = id_door:new({ team = defenders, door = "defender_door4" })
defender_door_trigger5 = id_door:new({ team = defenders, door = "defender_door5" })
defender_door_trigger6 = id_door:new({ team = defenders, door = "defender_door6" })
defender_spawn = base_defender_spawn:new({phase=1})
defender_spawn2 = base_defender_spawn:new({phase=2})
defender_spawn3 = base_defender_spawn:new({phase=3})
attacker_spawn = base_attacker_spawn:new({phase=1})
attacker_spawn2 = base_attacker_spawn:new({phase=2})
attacker_spawn3 = base_attacker_spawn:new({phase=3})
------------------------------------------------------------------
--Elevator
------------------------------------------------------------------
-- keeps track of elevator goings on
local elev_collection = Collection()
elev_trigger_add = trigger_ff_script:new({ })
-- registers attackers as they hit the top
function elev_trigger_add:ontouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
elev_collection:AddItem( player )
end
end
elev_trigger_remove = trigger_ff_script:new({ })
function elev_trigger_remove:onendtouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
elev_collection:RemoveItem( player )
end
end
function elev_trigger_remove:oninactive( trigger_entity )
elev_collection:RemoveAllItems()
end
elev_trigger = trigger_ff_script:new({ })
function elev_trigger:allowed( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
for playerx in elev_collection.items do
playerx = CastToPlayer(playerx)
if playerx:GetId() == player:GetId() then
return EVENT_DISALLOWED
end
end
end
return EVENT_ALLOWED
end
function elev_trigger:ontouch( trigger_entity )
if IsPlayer( trigger_entity ) then
--local player = CastToPlayer( trigger_entity )
OutputEvent( "elev2", "Open" )
end
end

141
maps/ff_genesis.lua Normal file
View file

@ -0,0 +1,141 @@
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_adzone")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- global overrides that you can do what you want with
-----------------------------------------------------------------------------
ZONE_COLOR = "green"
USE_ZONE_AREA = true
NUM_DEFENDER_ONLY_PACKS = 3
-----------------------------------------------------------------------------
-- Zone-controlling outputs
-----------------------------------------------------------------------------
function zone_on_outputs()
-- outputs
OutputEvent( "alarm1", "PlaySound" )
OutputEvent( "light1", "TurnOn" )
OutputEvent( "spot1", "LightOn" )
OutputEvent( "rotate1", "Start" )
OutputEvent( "rotate2", "Start" )
OutputEvent( "Tesla1", "DoSpark" )
end
function zone_off_outputs()
OutputEvent( "alarm1", "StopSound" )
OutputEvent( "light1", "TurnOff" )
OutputEvent( "spot1", "LightOff" )
OutputEvent( "rotate1", "Stop" )
OutputEvent( "rotate2", "Stop" )
end
function openstartdoor()
-- unlock them doors
attacker_door_trigger2 = id_door:new({ team = attackers, door = "attacker_door2" })
attacker_door_trigger3 = id_door:new({ team = attackers, door = "attacker_door3" })
-- open the first door
OutputEvent( "attacker_door2", "Open" )
OutputEvent( "attacker_door3", "Open" )
end
function onswitch()
-- reset doors to open for the right team
attacker_door_trigger1 = id_door:new({ team = attackers, door = "attacker_door1" })
attacker_door_trigger4 = id_door:new({ team = attackers, door = "attacker_door4" })
attacker_door_trigger5 = id_door:new({ team = attackers, door = "attacker_door5" })
attacker_door_trigger6 = id_door:new({ team = attackers, door = "attacker_door6" })
defender_door_trigger1 = id_door:new({ team = defenders, door = "defender_door1" })
defender_door_trigger2 = id_door:new({ team = defenders, door = "defender_door2" })
-- lock them doors
attacker_door_trigger2 = id_door:new({ team = Team.kUnassigned, door = "attacker_door2" })
attacker_door_trigger3 = id_door:new({ team = Team.kUnassigned, door = "attacker_door3" })
end
function onswitch_bluetodef()
-- switch the lights
OutputEvent( "defender_light1", "TurnOff" )
OutputEvent( "defender_spotlight1", "LightOff" )
OutputEvent( "defender_light2", "TurnOn" )
OutputEvent( "defender_spotlight2", "LightOn" )
end
function onswitch_redtodef()
-- switch the lights
OutputEvent( "defender_light1", "TurnOn" )
OutputEvent( "defender_spotlight1", "LightOn" )
OutputEvent( "defender_light2", "TurnOff" )
OutputEvent( "defender_spotlight2", "LightOff" )
end
------------------------------------------------------------------
--Resup Doors
------------------------------------------------------------------
neutral_door_trigger1 = trigger_ff_script:new({})
function neutral_door_trigger1:ontouch( trigger_entity )
OutputEvent( "neutral_door1", "Open" )
end
id_door = trigger_ff_script:new({ team = Team.kUnassigned, door = nil })
function id_door:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function id_door:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent(self.door, "Open")
end
end
attacker_door_trigger1 = id_door:new({ team = attackers, door = "attacker_door1" })
attacker_door_trigger2 = id_door:new({ team = Team.kUnassigned, door = "attacker_door2" })
attacker_door_trigger3 = id_door:new({ team = Team.kUnassigned, door = "attacker_door3" })
attacker_door_trigger4 = id_door:new({ team = attackers, door = "attacker_door4" })
attacker_door_trigger5 = id_door:new({ team = attackers, door = "attacker_door5" })
attacker_door_trigger6 = id_door:new({ team = attackers, door = "attacker_door6" })
defender_door_trigger1 = id_door:new({ team = defenders, door = "defender_door1" })
defender_door_trigger2 = id_door:new({ team = defenders, door = "defender_door2" })
-----------------------------------------------------------------------------
-- Locations
-----------------------------------------------------------------------------
location_a_spawn = location_info:new({ text = "Attacker's Spawn"})
location_a_spawn2 = location_info:new({ text = "Attacker's Spawn"})
location_a_spawn3 = location_info:new({ text = "Attacker's Gate Room"})
location_a_bottom = location_info:new({ text = "Secondary Attacker Route"})
location_a_bottom2 = location_info:new({ text = "Secondary Attacker Route"})
location_gate = location_info:new({ text = "Attacker's Gate"})
location_lower = location_info:new({ text = "Lower Hallway"})
location_gate_balcony = location_info:new({ text = "Overhanging Defensive Balcony"})
location_side_balcony = location_info:new({ text = "Side Defensive Balcony"})
location_elevator = location_info:new({ text = "Elevator Shaft"})
location_lab = location_info:new({ text = "Center Laboratory"})
location_building = location_info:new({ text = "Defense Building"})
location_main = location_info:new({ text = "Main Area"})
location_main_top = location_info:new({ text = "Top Balcony"})
location_cap = location_info:new({ text = "Capture Area"})
location_d_spawn = location_info:new({ text = "Defense Spawn"})

145
maps/ff_hunted.lua Normal file
View file

@ -0,0 +1,145 @@
-- ff_hunted.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_hunted")
-----------------------------------------------------------------------------
-- entities
-----------------------------------------------------------------------------
escape_door_top = base_escape_door
yellow_door = yellowrespawndoor
yellow_door_Sewers_1 = yellowrespawndoor
yellow_door_BuildingOneNook_2 = yellowrespawndoor
yellow_door_BuildingOneBreakRoom = yellowrespawndoor
yellow_door_Sewers_2 = yellowrespawndoor
yellow_door_BuildingOneNook_1 = yellowrespawndoor
yellow_door_Warehouse_1 = yellowrespawndoor
yellow_door_RuinsAttic = yellowrespawndoor
yellow_door_ShaftRoom = yellowrespawndoor
yellow_door_RuinsBathroom_1 = yellowrespawndoor
yellow_door_RuinsBathroom_2 = yellowrespawndoor
yellow_door_OrgyTower = yellowrespawndoor
yellow_door_MainRoadBuilding_1 = yellowrespawndoor
-----------------------------------------------------------------------------
-- locations
-----------------------------------------------------------------------------
location_green_hallway = location_info:new({ text = "Green Hallway", team = Team.kGreen })
location_main_tunnel_elevator = location_info:new({ text = "Main Tunnel Elevator", team = Team.kBlue })
location_main_tunnel_section1 = location_info:new({ text = "Main Tunnel Section 1", team = Team.kRed })
location_main_tunnel_section2 = location_info:new({ text = "Main Tunnel Section 2", team = Team.kRed })
location_main_tunnel_section3 = location_info:new({ text = "Main Tunnel Section 3", team = Team.kRed })
location_main_tunnel_sewer_ladder = location_info:new({ text = "Main Tunnel Sewer Ladder", team = Team.kRed })
location_main_tunnel_t = location_info:new({ text = "Main Tunnel T", team = Team.kRed })
location_main_tunnel_turn1 = location_info:new({ text = "Main Tunnel Turn 1", team = Team.kRed })
location_main_tunnel_turn2 = location_info:new({ text = "Main Tunnel Turn 2", team = Team.kRed })
location_beside_robotery = location_info:new({ text = "Beside Robotery", team = NO_TEAM })
location_behind_robotery = location_info:new({ text = "Behind Robotery", team = NO_TEAM })
location_main_ramp = location_info:new({ text = "Main Ramp", team = NO_TEAM })
location_main_ramp_opening = location_info:new({ text = "Main Ramp Opening", team = NO_TEAM })
location_main_ramp_overhang = location_info:new({ text = "Main Ramp Overhang", team = NO_TEAM })
location_main_road = location_info:new({ text = "Main Road", team = NO_TEAM })
location_main_road_hill = location_info:new({ text = "Main Road Hill", team = NO_TEAM })
location_main_road_lookout = location_info:new({ text = "Main Road Lookout", team = NO_TEAM })
location_main_road_stairs = location_info:new({ text = "Main Road Stairs", team = NO_TEAM })
location_mountain_tunnel = location_info:new({ text = "Mountain Tunnel", team = NO_TEAM })
location_robotery = location_info:new({ text = "Robotery", team = NO_TEAM })
location_robotery_crevice = location_info:new({ text = "Robotery Crevice", team = NO_TEAM })
location_robotery_front_roof = location_info:new({ text = "Robotery Front Roof", team = NO_TEAM })
location_robotery_loading_bay = location_info:new({ text = "Robotery Loading Bay", team = NO_TEAM })
location_robotery_side_doors = location_info:new({ text = "Robotery Side Doors", team = NO_TEAM })
location_lower_vent_room = location_info:new({ text = "Lower Vent Room", team = NO_TEAM })
location_upper_vent_room = location_info:new({ text = "Upper Vent Room", team = NO_TEAM })
location_vent = location_info:new({ text = "Vent", team = NO_TEAM })
location_vent_stairwell_room = location_info:new({ text = "Vent-Stairwell Room", team = NO_TEAM })
location_break_room = location_info:new({ text = "Break Room", team = Team.kYellow })
location_break_room_nook = location_info:new({ text = "Break Room Nook", team = Team.kYellow })
location_building_1_alley_lookout = location_info:new({ text = "Building 1 Alley Lookout", team = Team.kYellow })
location_building_1_entrance = location_info:new({ text = "Building 1 Entrance", team = NO_TEAM })
location_building_1_exit = location_info:new({ text = "Building 1 Exit", team = NO_TEAM })
location_building_1_lockers = location_info:new({ text = "Building 1 Lockers", team = NO_TEAM })
location_building_1_lockers_nook = location_info:new({ text = "Building 1 Lockers Nook", team = NO_TEAM })
location_building_1_lookout = location_info:new({ text = "Building 1 Lookout", team = Team.kYellow })
location_building_1_lookout_room = location_info:new({ text = "Building 1 Lookout Room", team = Team.kYellow })
location_building_1_lookout_room_exit = location_info:new({ text = "Building 1 Lookout Room Exit", team = Team.kYellow })
location_building_1_rooftop = location_info:new({ text = "Building 1 Rooftop", team = NO_TEAM })
location_utility_room = location_info:new({ text = "Utility Room", team = Team.kYellow })
location_utility_room_boxes = location_info:new({ text = "Utility Room Boxes", team = NO_TEAM })
location_utility_room_lower_stairs = location_info:new({ text = "Utility Room Lower Stairs", team = Team.kYellow })
location_utility_room_other_boxes = location_info:new({ text = "Utility Room Other Boxes", team = NO_TEAM })
location_utility_room_upper_nook = location_info:new({ text = "Utility Room Upper Nook", team = NO_TEAM })
location_utility_room_upper_stairs = location_info:new({ text = "Utility Room Upper Stairs", team = Team.kYellow })
location_sewers_alley = location_info:new({ text = "Sewer Alley Ladder", team = NO_TEAM })
location_sewers_dead_end = location_info:new({ text = "Sewer Dead End", team = NO_TEAM })
location_sewers_main_road = location_info:new({ text = "Sewer Main Road Ladder", team = NO_TEAM })
location_sewers_main_tunnel = location_info:new({ text = "Sewer Main Tunnel Ladder", team = NO_TEAM })
location_sewers_mountain_tunnel = location_info:new({ text = "Sewer Mountain Tunnel Ladder", team = NO_TEAM })
location_sewers_section1 = location_info:new({ text = "Sewer Section 1", team = NO_TEAM })
location_sewers_section2 = location_info:new({ text = "Sewer Section 2", team = NO_TEAM })
location_sewers_section3 = location_info:new({ text = "Sewer Section 3", team = NO_TEAM })
location_sewers_section4 = location_info:new({ text = "Sewer Section 4", team = NO_TEAM })
location_sewers_turn1 = location_info:new({ text = "Sewer Turn 1", team = NO_TEAM })
location_sewers_turn2 = location_info:new({ text = "Sewer Turn 2", team = NO_TEAM })
location_sewers_turn3 = location_info:new({ text = "Sewer Turn 3", team = NO_TEAM })
location_sewers_turn4 = location_info:new({ text = "Sewer Turn 4", team = NO_TEAM })
location_sewers_turn5 = location_info:new({ text = "Sewer Turn 5", team = NO_TEAM })
location_alley = location_info:new({ text = "Alley", team = NO_TEAM })
location_alley_entrance = location_info:new({ text = "Alley Entrance", team = NO_TEAM })
location_alley_lookouts = location_info:new({ text = "Alley Lookouts", team = Team.kYellow })
location_above_t_hallway = location_info:new({ text = "Above T Hallway", team = NO_TEAM })
location_t_hallway = location_info:new({ text = "T Hallway", team = NO_TEAM })
location_t_hallway_exit = location_info:new({ text = "T Hallway Exit", team = NO_TEAM })
location_stairwell_building_floor2 = location_info:new({ text = "Stairwell Building Floor 2", team = NO_TEAM })
location_stairwell_building_floor3 = location_info:new({ text = "Stairwell Building Floor 3", team = NO_TEAM })
location_stairwell_building_floor4 = location_info:new({ text = "Stairwell Building Floor 4", team = Team.kYellow })
location_stairwell_floor1 = location_info:new({ text = "Stairwell Floor 1", team = NO_TEAM })
location_stairwell_floor2 = location_info:new({ text = "Stairwell Floor 2", team = NO_TEAM })
location_stairwell_floor3 = location_info:new({ text = "Stairwell Floor 3", team = Team.kYellow })
location_stairwell_floor4 = location_info:new({ text = "Stairwell Floor 4", team = Team.kYellow })
location_ruins = location_info:new({ text = "Ruins", team = Team.kYellow })
location_ruins_attic = location_info:new({ text = "Ruins Attic", team = Team.kYellow })
location_ruins_attic_door = location_info:new({ text = "Ruins Attic Door", team = Team.kYellow })
location_ruins_bathroom = location_info:new({ text = "Ruins Bathroom", team = Team.kYellow })
location_ruins_crate_room = location_info:new({ text = "Ruins Crate Room", team = NO_TEAM })
location_ruins_crate_room_exit = location_info:new({ text = "Ruins Crate Room Exit", team = NO_TEAM })
location_ruins_dark_side = location_info:new({ text = "Ruins Dark Side", team = NO_TEAM })
location_ruins_exit = location_info:new({ text = "Ruins Exit", team = NO_TEAM })
location_ruins_field_holes = location_info:new({ text = "Ruins Field Holes", team = Team.kYellow })
location_ruins_lower_ladder_room = location_info:new({ text = "Ruins Lower Ladder Room", team = Team.kYellow })
location_ruins_middle_floor = location_info:new({ text = "Ruins Middle Floor", team = Team.kYellow })
location_ruins_storage = location_info:new({ text = "Ruins Storage", team = NO_TEAM })
location_ruins_tower_base = location_info:new({ text = "Ruins Tower Base", team = NO_TEAM })
location_ruins_tower_rooftop = location_info:new({ text = "Ruins Tower Rooftop", team = NO_TEAM })
location_ruins_tower_window = location_info:new({ text = "Ruins Tower Window", team = NO_TEAM })
location_ruins_upper_ladder_room = location_info:new({ text = "Ruins Upper Ladder Room", team = Team.kYellow })
location_warehouse = location_info:new({ text = "Warehouse", team = Team.kYellow })
location_warehouse_alley = location_info:new({ text = "Warehouse Alley", team = NO_TEAM })
location_warehouse_entrance = location_info:new({ text = "Warehouse Entrance", team = NO_TEAM })
location_warehouse_ramp = location_info:new({ text = "Warehouse Ramp", team = NO_TEAM })
location_warehouse_ramp_nook = location_info:new({ text = "Warehouse Ramp Nook", team = NO_TEAM })
location_between_towers = location_info:new({ text = "Between Towers", team = NO_TEAM })
location_billy_dons_property = location_info:new({ text = "Billy Don's Property", team = Team.kYellow })
location_escape_tunnel = location_info:new({ text = "Escape Tunnel", team = Team.kBlue })
location_field = location_info:new({ text = "Field", team = NO_TEAM })
location_field_bridge = location_info:new({ text = "Field Bridge", team = NO_TEAM })
location_fuel_room = location_info:new({ text = "Fuel Room", team = NO_TEAM })
location_fuel_room_rooftop = location_info:new({ text = "Fuel Room Rooftop", team = NO_TEAM })
location_tower1 = location_info:new({ text = "Tower 1", team = Team.kRed })
location_tower2 = location_info:new({ text = "Tower 2", team = Team.kRed })
location_under_the_bridge = location_info:new({ text = "Under Field Bridge", team = NO_TEAM })

17
maps/ff_hunted.txt Normal file
View file

@ -0,0 +1,17 @@
GAME MODE: Hunted
Teams:
Blue Civilian escorted by Red Bodyguards vs Yellow Assassins
Objectives:
Bodyguards open garage from the towers and escort civilian to the escape area
Scoring:
Bodyguard: 10 points per escape
Assassin: 5 points per assassination
Notes:
- The Hunted only takes damage
from sniper rifle, crowbar, knife,
tranq, and sabotaged SGs and
dispensers

View file

@ -0,0 +1,71 @@
-- ff_hunted__classic__.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("ff_hunted")
-----------------------------------------------------------------------------
-- Basic hunted-style gameplay. Respawns all players when the VIP is killed
-----------------------------------------------------------------------------
POINTS_PER_HUNTED_DEATH = 25
POINTS_PER_HUNTED_ESCAPE = 50
function startup()
SetGameDescription("Hunted Classic")
-- set up team names
SetTeamName( Team.kBlue, "The Hunted" )
SetTeamName( Team.kRed, "Bodyguards" )
SetTeamName( Team.kYellow, "Assassins" )
SetTeamName( Team.kGreen, "Green Kid Touchers" )
-- set up team limits
SetPlayerLimit( Team.kBlue, 1 ) -- There can be only one Highlander!
SetPlayerLimit( Team.kRed, 0 ) -- Unlimited bodyguards.
SetPlayerLimit( Team.kYellow, 5 ) -- Only 5 assassins, but can we dynamically change this based on maxplayers and/or the current playercount?
SetPlayerLimit( Team.kGreen, -1 ) -- Fuck green.
local team = GetTeam( Team.kBlue )
team:SetAllies( Team.kRed )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, 0 )
team = GetTeam( Team.kRed )
team:SetAllies( Team.kBlue )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, 0 )
team:SetClassLimit( Player.kHwguy, 0 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team = GetTeam( Team.kYellow )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, 0 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
RemoveSchedule( "hunted_location_timer" )
AddScheduleRepeating( "hunted_location_timer" , 1.0, hunted_location_timer )
end

View file

@ -0,0 +1,106 @@
//--------------------------------
// begin game sounds for ff_hunted
//--------------------------------
"ff_hunted.thunder"
{
"channel" "CHAN_STATIC"
"volume" "0.3"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ambient/levels/labs/teleport_postblast_thunder1.wav"
}
"ff_hunted.cheer"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted/CrowdCheer.wav"
}
"ff_hunted.dying_bird"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"rndwave"
{
"wave" "@ff_hunted\dying_bird_1.wav"
"wave" "@ff_hunted\dying_bird_2.wav"
"wave" "@ff_hunted\dying_bird_3.wav"
}
}
"ff_hunted.dying_bird_full"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\dying_bird_full.wav"
}
"ff_hunted.i_am_the_werewolf"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\i_am_the_werewolf.wav"
}
"ff_hunted.i_fight_vampires"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\i_fight_vampires.wav"
}
"ff_hunted.werewolf_howling"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\werewolf_howling.wav"
}
"ff_hunted.werewolf_movies"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\werewolf_movies.wav"
}
"ff_hunted.werewolves_howling"
{
"channel" "CHAN_STATIC"
"volume" "0.6"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@ff_hunted\werewolves_howling.wav"
}
//--------------------
// UNAGI POWER, UNAGI!
//--------------------
"ff_hunted.unagi"
{
"channel" "CHAN_STATIC"
"volume" "0.8"
"soundlevel" "SNDLVL_NONE"
"pitch" "95,105"
"wave" "@misc/unagi.wav"
}
//------------------------------
// end game sounds for ff_hunted
//------------------------------

View file

@ -0,0 +1,64 @@
"ff_hunted.FrontRoad"
{
"dsp" "1"
"playlooping"
{
"volume" "0.75"
"pitch" "100"
"wave" "ambient/atmosphere/town_ambience.wav"
}
"playrandom"
{
"time" "0.0,15.0"
"volume" "0.1"
"pitch" "50,100"
"rndwave"
{
"wave" "ambient/materials/metal4.wav"
"wave" "ambient/atmosphere/metallic1.wav"
}
}
}
"ff_hunted.BodyguardTunnelTop"
{
"dsp" "1"
"playlooping"
{
"volume" "0.05"
"pitch" "100"
"wave" "ambient/atmosphere/indoor2.wav"
}
"playlooping"
{
"volume" "0.1"
"pitch" "50"
"wave" "ambient/atmosphere/undercity_loop1.wav"
}
"playsoundscape"
{
"name" "ff_hunted.FrontRoad"
"volume" ".5"
}
}
"ff_hunted.BodyguardTunnel"
{
"dsp" "1"
"playlooping"
{
"volume" "0.1"
"pitch" "100"
"wave" "ambient/atmosphere/indoor2.wav"
}
"playlooping"
{
"volume" "0.2"
"pitch" "50"
"wave" "ambient/atmosphere/undercity_loop1.wav"
}
}

404
maps/ff_ksour.lua Normal file
View file

@ -0,0 +1,404 @@
IncludeScript("base_id");
IncludeScript("base_respawnturret");
-----------------------------------------------------------------------------
-- globals
FLAG_RETURN_TIME = 60;
INITIAL_ROUND_DELAY = 45;
TEAM_SWITCH_DELAY = 4
NUM_PHASES = 4
-----------------------------------------------------------------------------
-- sounds, right?
function precache()
PrecacheSound("otherteam.flagstolen")
PrecacheSound("misc.bloop")
end
-- startup
function startup()
SetGameDescription("Invade Defend")
-- set up team limits
local team = GetTeam( Team.kBlue )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kRed )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kYellow )
team:SetPlayerLimit( -1 )
team = GetTeam( Team.kGreen )
team:SetPlayerLimit( -1 )
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, 1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
team:SetClassLimit(Player.kSniper, 1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
-- set team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- start the timer for the points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_DELAY - 30 , schedulemessagetoall, "Gates open in 30 seconds!" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_DELAY - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5sec" , INITIAL_ROUND_DELAY - 5 , schedulemessagetoall, "5" ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4sec" , INITIAL_ROUND_DELAY - 4 , schedulemessagetoall, "4" ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3sec" , INITIAL_ROUND_DELAY - 3, schedulemessagetoall, "3" ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2sec" , INITIAL_ROUND_DELAY - 2, schedulemessagetoall, "2" ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1sec" , INITIAL_ROUND_DELAY - 1, schedulemessagetoall, "1" ) end
-- sounds
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_DELAY - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_DELAY - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_DELAY - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_DELAY - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_DELAY - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_DELAY - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_DELAY - 1 , schedulecountdown, 1 ) end
cp1_flag.enabled = true
for i,v in ipairs({"cp1_flag", "cp2_flag", "cp3_flag", "cp4_flag", "cp5_flag", "cp6_flag", "cp7_flag", "cp8_flag"}) do
local flag = GetInfoScriptByName(v)
if flag then
flag:SetModel(_G[v].model)
flag:SetSkin(teamskins[attackers])
if i == 1 then
flag:Restore()
else
flag:Remove()
end
end
end
flags_set_team( attackers )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
-- overwriting these functions so that there aren't repeat messages
function round_30secwarn() end
function round_10secwarn() end
function base_id_cap:oncapture(player, item)
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
--SmartSound(player, "vox.yourcap", "vox.yourcap", "vox.enemycap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
local flag_item = GetInfoScriptByName( item )
RemoveHudItem( player, flag_item:GetName() )
-- turn off this flag
for i,v in ipairs(self.item) do
_G[v].enabled = nil
local flag = GetInfoScriptByName(v)
if flag then
flag:Remove()
end
end
if phase == NUM_PHASES then
-- it's the last round. end and stuff
phase = 1
AddSchedule("switch_teams", TEAM_SWITCH_DELAY, switch_teams)
else
phase = phase + 1
-- enable the next flag after a time
AddSchedule("flag_start", ROUND_DELAY, flag_start, self.next)
if ROUND_DELAY > 30 then AddSchedule("flag_30secwarn", ROUND_DELAY-30, flag_30secwarn) end
if ROUND_DELAY > 10 then AddSchedule("flag_10secwarn", ROUND_DELAY-10, flag_10secwarn) end
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
if DEFENDERS_OBJECTIVE_ONFLAG or DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = nil
else DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_tobase_timer()
update_hud()
end
end
function switch_teams()
if attackers == Team.kBlue then
attackers = Team.kRed
defenders = Team.kBlue
else
attackers = Team.kBlue
defenders = Team.kRed
end
local team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kDemoman, 0)
team:SetClassLimit(Player.kEngineer, 0)
team:SetClassLimit(Player.kScout, 0)
team:SetClassLimit(Player.kMedic, 0)
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
-- set all flag teams to new attackers
flags_set_team( attackers )
-- switch them team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- enable the first flag
cp1_flag.enabled = true
cp1_flag.status = 0
local flag = GetInfoScriptByName("cp1_flag")
if flag then
flag:Restore()
flag:SetSkin(teamskins[attackers])
end
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
-- reset the timer on points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
-- respawn the players
RespawnAllPlayers()
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
-- run custom round reset stuff
onroundreset()
update_hud()
end
-- Give everyone a full resupply, but strip secondary grenades and defender detpacks
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:RemoveAmmo( Ammo.kGren2, 4 )
-- wtf, scout or med on d? are you mental?
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
local classt = "Scout"
if player:GetClass() == Player.kMedic then classt = "Medic" end
local id = player:GetId()
AddSchedule("force_changemessage"..id, 2, schedulechangemessage, player, "No "..classt.."s on defense. Autoswitching to Soldier." )
AddSchedule("force_change"..id, 2.5, forcechange, player)
end
if player:GetTeamId() == attackers then
UpdateObjectiveIcon( player, ATTACKERS_OBJECTIVE_ENTITY )
elseif player:GetTeamId() == defenders then
UpdateObjectiveIcon( player, DEFENDERS_OBJECTIVE_ENTITY )
player:RemoveAmmo( Ammo.kDetpack, 1 )
end
end
-----------------------------------------------------------------------------
-- Scheduled functions that do stuff
-----------------------------------------------------------------------------
-- Sends a message to all after the determined time
function schedulechangemessage( player, message )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
BroadCastMessageToPlayer( player, message )
end
end
-- force a scout/med to switch to soli if they haven't
function forcechange( player )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
ApplyToPlayer( player, { AT.kChangeClassSoldier, AT.kRespawnPlayers } )
end
end
---------------------------------------------------------------------------
--Turrets
------------------------------------------------------------
respawnturret_attackers = base_respawnturret:new({ team = attackers })
respawnturret_defenders = base_respawnturret:new({ team = defenders })
---------------------
--Backpacks
---------------------
genpack = genericbackpack:new({
health = 35,
armor = 50,
grenades = 20,
nails = 50,
shells = 300,
rockets = 15,
cells = 120,
mancannons = 1,
gren1 = 1,
gren2 = 0,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function genpack:dropatspawn() return false
end
genpack_grenpack = genericbackpack:new({
health = 35,
armor = 50,
grenades = 20,
nails = 50,
shells = 300,
rockets = 15,
cells = 120,
mancannons = 1,
gren1 = 2,
gren2 = 1,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function genpack_grenpack:dropatspawn() return false
end
----------------------------------------------------
--Toggle Cap points
---------------------------------------------------
function cp1_cap:ontouch( trigger_entity )
OutputEvent( "cp1_door", "Toggle" )
end
function cp2_cap:ontouch( trigger_entity )
OutputEvent( "cp2_door", "Toggle" )
end
function cp3_cap:ontouch( trigger_entity )
OutputEvent( "cp3_door", "Toggle" )
end
function cp4_cap:ontouch( trigger_entity )
OutputEvent( "cp4_door", "Toggle" )
end
----------------------------------------------------
--Random schedule functions
---------------------------------------------------
-- Sends a message to all after the determined time
function schedulemessagetoall( message )
BroadCastMessage( message )
end
-- Plays a sound to all after the determined time
function schedulesound( sound )
BroadCastSound( sound )
end
function schedulecountdown( time )
BroadCastMessage( ""..time.."" )
SpeakAll( "AD_" .. time .. "SEC" )
end
function round_start(doorname)
BroadCastMessage("Gates are now open!")
OpenDoor(doorname)
BroadCastSound( "otherteam.flagstolen" )
SpeakAll( "AD_GATESOPEN" )
end
---------------------------------------
--Resetting round
------------------------------------
detpack_wall_open = nil
function onroundreset()
-- close the door
if detpack_wall_open then
-- there's no "close".. wtf
OutputEvent("detpack_hole", "Toggle")
detpack_wall_open = nil
end
-- Reset The Turrets
respawnturret_attackers = base_respawnturret:new({ team = attackers })
respawnturret_defenders = base_respawnturret:new({ team = defenders })
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_DELAY - 30 , schedulemessagetoall, "Gates open in 30 seconds!" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_DELAY - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5sec" , INITIAL_ROUND_DELAY - 5 , schedulemessagetoall, "5" ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4sec" , INITIAL_ROUND_DELAY - 4 , schedulemessagetoall, "4" ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3sec" , INITIAL_ROUND_DELAY - 3, schedulemessagetoall, "3" ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2sec" , INITIAL_ROUND_DELAY - 2, schedulemessagetoall, "2" ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1sec" , INITIAL_ROUND_DELAY - 1, schedulemessagetoall, "1" ) end
-- sounds
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_DELAY - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_DELAY - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_DELAY - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_DELAY - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_DELAY - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_DELAY - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_DELAY - 1 , schedulecountdown, 1 ) end
end
detpack_trigger = trigger_ff_script:new({})
function detpack_trigger:onexplode( trigger_entity )
if IsDetpack( trigger_entity ) then
BroadCastMessage("The detpack wall has been blown open!")
BroadCastSound( "otherteam.flagstolen" )
OutputEvent("detpack_hole", "Toggle")
OutputEvent("break1", "PlaySound")
detpack_wall_open = true
end
return EVENT_ALLOWED
end
-- Don't want any body touching/triggering it except the detpack
function trigger_detpackable_door:allowed( trigger_entity ) return EVENT_DISALLOWED
end

233
maps/ff_monkey.lua Normal file
View file

@ -0,0 +1,233 @@
-- ff_monkey.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_ctf")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10
FLAG_RETURN_TIME = 60
function startup()
SetGameDescription("Capture the Flag")
-- set up team limits on each team
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
end
-----------------------------------------------------------------------------
-- Pickups
-----------------------------------------------------------------------------
monkeypackgeneric = genericbackpack:new({
health = 20,
armor = 15,
grenades = 60,
nails = 60,
shells = 60,
rockets = 60,
cells = 60,
mancannons = 1,
gren1 = 1,
gren2 = 1,
respawntime = 35,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function monkeypackgeneric:dropatspawn() return false end
redmonkeypack = genericbackpack:new({
health = 200,
armor = 200,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 200,
respawntime = 2,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kRed},
botgoaltype = Bot.kBackPack_Ammo
})
function redmonkeypack:dropatspawn() return false end
redmonkeypacktoo = genericbackpack:new({
health = 20,
armor = 15,
grenades = 10,
nails = 30,
shells = 30,
rockets = 10,
cells = 30,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kRed},
botgoaltype = Bot.kBackPack_Ammo
})
function redmonkeypacktoo:dropatspawn() return false end
bluemonkeypack = genericbackpack:new({
health = 200,
armor = 200,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 200,
respawntime = 2,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kBlue},
botgoaltype = Bot.kBackPack_Ammo
})
function bluemonkeypack:dropatspawn() return false end
bluemonkeypacktoo = genericbackpack:new({
health = 20,
armor = 15,
grenades = 10,
nails = 30,
shells = 30,
rockets = 10,
cells = 30,
respawntime = 20,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kBlue},
botgoaltype = Bot.kBackPack_Ammo
})
function bluemonkeypacktoo:dropatspawn() return false end
redmonkeygrenades = genericbackpack:new({
detpacks = 1,
mancannons = 1,
gren1 = 4,
gren2 = 4,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kRed},
respawntime = 15,
botgoaltype = Bot.kBackPack_Ammo
})
function redmonkeygrenades:dropatspawn() return false end
bluemonkeygrenades = genericbackpack:new({
detpacks = 1,
mancannons = 1,
gren1 = 4,
gren2 = 4,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kBlue},
respawntime = 15,
botgoaltype = Bot.kBackPack_Ammo
})
function bluemonkeygrenades:dropatspawn() return false end
-----------------------------------------------------------------------------
-- Locations
-----------------------------------------------------------------------------
location_blue_front_door = location_info:new({ text = "Front Door", team = Team.kBlue })
location_blue_right_front_door = location_info:new({ text = "Right Front Door", team = Team.kBlue })
location_blue_left_front_door = location_info:new({ text = "Left Front Door", team = Team.kBlue })
location_blue_ramp_room = location_info:new({ text = "Great Hall", team = Team.kBlue })
location_blue_T_route = location_info:new({ text = "'T' Route", team = Team.kBlue })
location_blue_upper_spawn = location_info:new({ text = "Upper Spawn", team = Team.kBlue })
location_blue_lower_spawn = location_info:new({ text = "Lower Spawn", team = Team.kBlue })
location_blue_lower_route = location_info:new({ text = "Lower Route", team = Team.kBlue })
location_blue_water_route = location_info:new({ text = "Water Route", team = Team.kBlue })
location_blue_flag_room = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_blue_pit = location_info:new({ text = "Flag Room Pit", team = Team.kBlue })
location_blue_flag_room_catwalk = location_info:new({ text = "Flag Room Catwalks", team = Team.kBlue })
location_blue_water_tunnel = location_info:new({ text = "Water Tunnel", team = Team.kBlue })
location_blue_yard = location_info:new({ text = "Yard", team = Team.kBlue })
location_red_front_door = location_info:new({ text = "Front Door", team = Team.kRed })
location_red_right_front_door = location_info:new({ text = "Right Front Door", team = Team.kRed })
location_red_left_front_door = location_info:new({ text = "Left Front Door", team = Team.kRed })
location_red_ramp_room = location_info:new({ text = "Great Hall", team = Team.kRed })
location_red_T_route = location_info:new({ text = "'T' Route", team = Team.kRed })
location_red_upper_spawn = location_info:new({ text = "Upper Spawn", team = Team.kRed })
location_red_lower_spawn = location_info:new({ text = "Lower Spawn", team = Team.kRed })
location_red_lower_route = location_info:new({ text = "Lower Route", team = Team.kRed })
location_red_water_route = location_info:new({ text = "Water Route", team = Team.kRed })
location_red_flag_room = location_info:new({ text = "Flag Room", team = Team.kRed })
location_red_pit = location_info:new({ text = "Flag Room Pit", team = Team.kRed })
location_red_flag_room_catwalk = location_info:new({ text = "Flag Room Catwalks", team = Team.kRed })
location_red_water_tunnel = location_info:new({ text = "Water Tunnel", team = Team.kRed })
location_red_yard = location_info:new({ text = "Yard", team = Team.kRed })
location_river = location_info:new({ text = "River", team = Team.kUnassigned })
location_midmap = location_info:new({ text = "Midmap", team = Team.kUnassigned })
location_bridge = location_info:new({ text = "Bridge", team = Team.kUnassigned })
-----------------------------------------------------------------------------
-- OFFENSIVE AND DEFENSIVE SPAWNS
-----------------------------------------------------------------------------
red_o_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kDemoman))) end
red_d_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false))) end
red_ospawn = { validspawn = red_o_only }
red_dspawn = { validspawn = red_d_only }
blue_o_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kDemoman))) end
blue_d_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false))) end
blue_ospawn = { validspawn = blue_o_only }
blue_dspawn = { validspawn = blue_d_only }
-----------------------------------------------------------------------------
-- respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })

7
maps/ff_monkey.txt Normal file
View file

@ -0,0 +1,7 @@
CAPTURE THE FLAG
Grab the enemy flag and take it to your capture point to score.
Original map designed by The Cheese
Note: Not all Monkeys eat Bananas

425
maps/ff_napoli.lua Normal file
View file

@ -0,0 +1,425 @@
IncludeScript("base_id");
IncludeScript("base_respawnturret");
-----------------------------------------------------------------------------
-- globals
FLAG_RETURN_TIME = 60;
INITIAL_ROUND_DELAY = 45;
TEAM_SWITCH_DELAY = 4
NUM_PHASES = 3
NONINITIAL_ROUND_DELAY = 45;
RESPAWN_AFTER_CAP = false
-----------------------------------------------------------------------------
function respawnall()
BroadCastMessage( "Area Captured. Respawning..." )
ApplyToAll( { AT.kRespawnPlayers, AT.kRemoveBuildables } )
end
-- sounds, right?
function precache()
PrecacheSound("otherteam.flagstolen")
PrecacheSound("misc.bloop")
end
-- startup
function startup()
SetGameDescription("Invade Defend")
-- set up team limits
local team = GetTeam( Team.kBlue )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kRed )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kYellow )
team:SetPlayerLimit( -1 )
team = GetTeam( Team.kGreen )
team:SetPlayerLimit( -1 )
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
local team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, -1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
team:SetClassLimit(Player.kSniper, -1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
-- start the timer for the points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_DELAY - 30 , schedulemessagetoall, "Gates open in 30 seconds!" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_DELAY - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5sec" , INITIAL_ROUND_DELAY - 5 , schedulemessagetoall, "5" ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4sec" , INITIAL_ROUND_DELAY - 4 , schedulemessagetoall, "4" ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3sec" , INITIAL_ROUND_DELAY - 3, schedulemessagetoall, "3" ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2sec" , INITIAL_ROUND_DELAY - 2, schedulemessagetoall, "2" ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1sec" , INITIAL_ROUND_DELAY - 1, schedulemessagetoall, "1" ) end
-- sounds
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_DELAY - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_DELAY - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_DELAY - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_DELAY - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_DELAY - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_DELAY - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_DELAY - 1 , schedulecountdown, 1 ) end
cp1_flag.enabled = true
for i,v in ipairs({"cp1_flag", "cp2_flag", "cp3_flag", "cp4_flag", "cp5_flag", "cp6_flag", "cp7_flag", "cp8_flag"}) do
local flag = GetInfoScriptByName(v)
if flag then
flag:SetModel(_G[v].model)
flag:SetSkin(teamskins[attackers])
if i == 1 then
flag:Restore()
else
flag:Remove()
end
end
end
flags_set_team( attackers )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
-- overwriting these functions so that there aren't repeat messages
function round_30secwarn() end
function round_10secwarn() end
-- Give everyone a full resupply, but strip secondary grenades and defender detpacks
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:RemoveAmmo( Ammo.kGren2, 4 )
-- wtf, scout or med on d? are you mental?
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
local classt = "Scout"
if player:GetClass() == Player.kMedic then classt = "Medic" end
local id = player:GetId()
AddSchedule("force_changemessage"..id, 2, schedulechangemessage, player, "No "..classt.."s on defense. Autoswitching to Soldier." )
AddSchedule("force_change"..id, 2.5, forcechange, player)
end
if player:GetTeamId() == attackers then
UpdateObjectiveIcon( player, ATTACKERS_OBJECTIVE_ENTITY )
--player:RemoveAmmo( Ammo.kManCannon, 1 )
elseif player:GetTeamId() == defenders then
UpdateObjectiveIcon( player, DEFENDERS_OBJECTIVE_ENTITY )
--player:RemoveAmmo( Ammo.kDetpack, 1 )
end
end
function base_id_cap:oncapture(player, item)
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
--SmartSound(player, "vox.yourcap", "vox.yourcap", "vox.enemycap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
local flag_item = GetInfoScriptByName( item )
RemoveHudItem( player, flag_item:GetName() )
-- turn off this flag
for i,v in ipairs(self.item) do
_G[v].enabled = nil
local flag = GetInfoScriptByName(v)
if flag then
flag:Remove()
end
end
if phase == NUM_PHASES then
-- it's the last round. end and stuff
phase = 1
OutputEvent( "start_gate", "Close" )
AddSchedule("switch_teams", TEAM_SWITCH_DELAY, switch_teams)
else
if phase == 1 then
AddSchedule( "cp2partition", 5, OutputEvent, "cp2_partition", "Disable" )
AddSchedule( "cp3partition", 5, OutputEvent, "cp3_partition", "Enable" )
end
if phase == 2 then
AddSchedule( "cp2partition", 5, OutputEvent, "cp2_partition", "Enable" )
AddSchedule( "cp3partition", 5, OutputEvent, "cp3_partition", "Disable" )
AddSchedule( "cp3areaportal", 5, OutputEvent, "cp3_areaportal", "Toggle" )
end
AddSchedule("respawnall", 5, respawnall)
phase = phase + 1
-- enable the next flag after a time
AddSchedule("flag_start", ROUND_DELAY, flag_start, self.next)
if ROUND_DELAY > 30 then AddSchedule("flag_30secwarn", ROUND_DELAY-30, flag_30secwarn) end
if ROUND_DELAY > 10 then AddSchedule("flag_10secwarn", ROUND_DELAY-10, flag_10secwarn) end
OutputEvent( "start_gate", "Close" )
setup_door_timer("start_gate", NONINITIAL_ROUND_DELAY)
-- clear objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
if DEFENDERS_OBJECTIVE_ONFLAG or DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = nil
else DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_tobase_timer()
update_hud()
end
end
function switch_teams()
if attackers == Team.kBlue then
attackers = Team.kRed
defenders = Team.kBlue
else
attackers = Team.kBlue
defenders = Team.kRed
end
-- set all flag teams to new attackers
flags_set_team( attackers )
-- enable the first flag
cp1_flag.enabled = true
cp1_flag.status = 0
local flag = GetInfoScriptByName("cp1_flag")
if flag then
flag:Restore()
flag:SetSkin(teamskins[attackers])
end
-- switch them team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
-- reset the timer on points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
-- respawn the players
RespawnAllPlayers()
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
-- run custom round reset stuff
onroundreset()
update_hud()
OutputEvent( "point_template", "ForceSpawn" )
OutputEvent( "cp3_areaportal", "Toggle" )
end
-----------------------------------------------------------------------------
-- Scheduled functions that do stuff
-----------------------------------------------------------------------------
-- Sends a message to all after the determined time
function schedulechangemessage( player, message )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
BroadCastMessageToPlayer( player, message )
end
end
-- force a scout/med to switch to soli if they haven't
function forcechange( player )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
ApplyToPlayer( player, { AT.kChangeClassSoldier, AT.kRespawnPlayers } )
end
end
---------------------------------------------------------------------------
--Turrets
------------------------------------------------------------
respawnturret_attackers = base_respawnturret:new({ team = attackers })
respawnturret_defenders = base_respawnturret:new({ team = defenders })
---------------------
--Backpacks
---------------------
genpack = genericbackpack:new({
health = 35,
armor = 50,
grenades = 20,
nails = 50,
shells = 300,
rockets = 15,
cells = 120,
mancannons = 1,
gren1 = 0,
gren2 = 0,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function genpack:dropatspawn() return false
end
genpack_grenpack = genericbackpack:new({
health = 35,
armor = 50,
grenades = 20,
nails = 50,
shells = 300,
rockets = 15,
cells = 120,
mancannons = 1,
gren1 = 2,
gren2 = 1,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
function genpack_grenpack:dropatspawn() return false
end
----------------------------------------------------
--Toggle Cap points
---------------------------------------------------
function cp1_cap:ontouch( trigger_entity )
OutputEvent( "cp1_door", "Toggle" )
end
function cp2_cap:ontouch( trigger_entity )
OutputEvent( "cp2_door", "Toggle" )
end
function cp3_cap:ontouch( trigger_entity )
OutputEvent( "cp3_door", "Toggle" )
end
function cp4_cap:ontouch( trigger_entity )
OutputEvent( "cp4_door", "Toggle" )
end
----------------------------------------------------
--Random schedule functions
---------------------------------------------------
-- Sends a message to all after the determined time
function schedulemessagetoall( message )
BroadCastMessage( message )
end
-- Plays a sound to all after the determined time
function schedulesound( sound )
BroadCastSound( sound )
end
function schedulecountdown( time )
BroadCastMessage( ""..time.."" )
SpeakAll( "AD_" .. time .. "SEC" )
end
function round_start(doorname)
BroadCastMessage("Gates are now open!")
OpenDoor(doorname)
BroadCastSound( "otherteam.flagstolen" )
SpeakAll( "AD_GATESOPEN" )
end
---------------------------------------
--Resetting round
------------------------------------
detpack_wall_open = nil
function onroundreset()
-- close the door
if detpack_wall_open then
-- there's no "close".. wtf
OutputEvent("detpack_hole", "Toggle")
detpack_wall_open = nil
end
-- Reset The Turrets
respawnturret_attackers = base_respawnturret:new({ team = attackers })
respawnturret_defenders = base_respawnturret:new({ team = defenders })
-- reset them limits
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, 0)
team:SetClassLimit(Player.kMedic, 0)
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_DELAY - 30 , schedulemessagetoall, "Gates open in 30 seconds!" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_DELAY - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5sec" , INITIAL_ROUND_DELAY - 5 , schedulemessagetoall, "5" ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4sec" , INITIAL_ROUND_DELAY - 4 , schedulemessagetoall, "4" ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3sec" , INITIAL_ROUND_DELAY - 3, schedulemessagetoall, "3" ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2sec" , INITIAL_ROUND_DELAY - 2, schedulemessagetoall, "2" ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1sec" , INITIAL_ROUND_DELAY - 1, schedulemessagetoall, "1" ) end
-- sounds
if INITIAL_ROUND_DELAY > 30 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_DELAY - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_DELAY - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_DELAY > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_DELAY - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_DELAY > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_DELAY - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_DELAY > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_DELAY - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_DELAY > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_DELAY - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_DELAY > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_DELAY - 1 , schedulecountdown, 1 ) end
end
detpack_trigger = trigger_ff_script:new({})
function detpack_trigger:onexplode( trigger_entity )
if IsDetpack( trigger_entity ) then
BroadCastMessage("The detpack wall has been blown open!")
BroadCastSound( "otherteam.flagstolen" )
OutputEvent("detpack_hole", "Toggle")
OutputEvent("break1", "PlaySound")
detpack_wall_open = true
end
return EVENT_ALLOWED
end
-- Don't want any body touching/triggering it except the detpack
function trigger_detpackable_door:allowed( trigger_entity ) return EVENT_DISALLOWED
end

251
maps/ff_openfire.lua Normal file
View file

@ -0,0 +1,251 @@
-- ff_openfire.lua
-- based on aardvark 15/09/07
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base");
IncludeScript("base_ctf");
IncludeScript("base_location");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10;
FLAG_RETURN_TIME = 60;
-----------------------------------------------------------------------------
-- unique openfire locations
-----------------------------------------------------------------------------
location_redspawn = location_info:new({ text = "Respawn", team = Team.kRed })
location_redsec = location_info:new({ text = "Fire Control", team = Team.kRed })
location_redfr = location_info:new({ text = "Flag Room", team = Team.kRed })
location_redwater = location_info:new({ text = "Perilous Passage", team = Team.kRed })
location_redfrontdoor = location_info:new({ text = "Front Door Corridor", team = Team.kRed })
location_redbalcony = location_info:new({ text = "Balcony", team = Team.kRed })
location_bluespawn = location_info:new({ text = "Respawn", team = Team.kBlue })
location_bluesec = location_info:new({ text = "Fire Control", team = Team.kBlue })
location_bluefr = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_bluewater = location_info:new({ text = "Perilous Passage", team = Team.kBlue })
location_bluefrontdoor = location_info:new({ text = "Front Door Corridor", team = Team.kBlue })
location_bluebalcony = location_info:new({ text = "Balcony", team = Team.kBlue })
location_midmap = location_info:new({ text = "Outside", team = NO_TEAM })
-----------------------------------------------------------------------------
-- bagless resupply
-----------------------------------------------------------------------------
aardvarkresup = trigger_ff_script:new({ team = Team.kUnassigned })
function aardvarkresup:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == self.team then
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
end
end
blue_aardvarkresup = aardvarkresup:new({ team = Team.kBlue })
red_aardvarkresup = aardvarkresup:new({ team = Team.kRed })
-----------------------------------------------------------------------------
-- aardvark security
-----------------------------------------------------------------------------
red_aardvarksec = trigger_ff_script:new()
blue_aardvarksec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1
sec_iconx = 60
sec_icony = 30
sec_iconw = 16
sec_iconh = 16
function red_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
if redsecstatus == 1 then
redsecstatus = 0
AddSchedule("aardvarksecup10red",20,aardvarksecup10red)
AddSchedule("aardvarksecupred",30,aardvarksecupred)
OpenDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
end
end
function blue_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kRed then
if bluesecstatus == 1 then
bluesecstatus = 0
AddSchedule("aardvarksecup10blue",20,aardvarksecup10blue)
AddSchedule("aardvarksecupblue",30,aardvarksecupblue)
OpenDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_30")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_BLUEDOWN" )
RemoveHudItemFromAll( "blue-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
end
end
end
function aardvarksecupred()
redsecstatus = 1
CloseDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_ON")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
function aardvarksecupblue()
bluesecstatus = 1
CloseDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_ON")
SpeakAll( "SD_BLUEUP" )
RemoveHudItemFromAll( "blue-sec-down" )
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
function aardvarksecup10red()
BroadCastMessage("#FF_RED_SEC_10")
end
function aardvarksecup10blue()
BroadCastMessage("#FF_BLUE_SEC_10")
end
-----------------------------------------------------------------------------
-- aardvark lasers and respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
lasers_KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function lasers_KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
if self.team == Team.kBlue then
if redsecstatus == 1 then
return EVENT_ALLOWED
end
end
if self.team == Team.kRed then
if bluesecstatus == 1 then
return EVENT_ALLOWED
end
end
end
end
return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })
sec_blue_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kBlue })
sec_red_slayer = lasers_KILL_KILL_KILL:new({ team = Team.kRed })
-------------------------
-- flaginfo
-------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
flaginfo_base(player_entity) --basic CTF HUD items
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if bluesecstatus == 1 then
AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
else
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
if redsecstatus == 1 then
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
else
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
-----------------------------------------------------------------------------
-- custom openfire pack
-----------------------------------------------------------------------------
aardvarkpack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 400,
nails = 400,
shells = 400,
rockets = 400,
cells = 130,
respawntime = 8,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function aardvarkpack:dropatspawn() return false end
-----------------------------------------------------------------------------
-- backpack entity setup (modified for aardvarkpack)
-----------------------------------------------------------------------------
function build_backpacks(tf)
return healthkit:new({touchflags = tf}),
armorkit:new({touchflags = tf}),
ammobackpack:new({touchflags = tf}),
bigpack:new({touchflags = tf}),
grenadebackpack:new({touchflags = tf}),
aardvarkpack:new({touchflags = tf})
end
blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack, blue_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack ,red_grenadebackpack, red_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack, yellow_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack, green_aardvarkpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})
-----------------------------------------------------------------------------
-- SPAWNS
-----------------------------------------------------------------------------
red_o_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSniper))) end
red_d_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kSniper) == false))) end
redspawn_balc = { validspawn = red_o_only }
redspawn_fr = { validspawn = red_d_only }
blue_o_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kSniper))) end
blue_d_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kSniper) == false))) end
bluespawn_balc = { validspawn = blue_o_only }
bluespawn_fr = { validspawn = blue_d_only }

189
maps/ff_palermo.lua Normal file
View file

@ -0,0 +1,189 @@
-- ff_palermo.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_id_new");
IncludeScript("base_respawnturret");
IncludeScript("base_location");
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
function startup()
id_startup()
-- lower trigger_hurt damage in water
OutputEvent( "trigger_hurt", "SetDamage", "42" )
end
palammopack = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 100,
rockets = 15,
cells = 70,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
palgrenadepackone = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
mancannons = 1,
gren1 = 2,
gren2 = 1,
armor = 50,
health = 25,
respawntime = 30,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
attackers_palgrenadepackone = idbackpack:new({
team = attackers,
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
mancannons = 1,
gren1 = 2,
gren2 = 1,
armor = 50,
health = 25,
respawntime = 30,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
palammotypeone = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 75,
armor = 50,
health = 25,
respawntime = 7,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
attackers_palammotypeone = idbackpack:new({
team = attackers,
grenades = 20,
nails = 50,
shells = 50,
rockets = 20,
cells = 75,
armor = 50,
health = 25,
respawntime = 7,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"
})
--This is called from base_id to do map-specific stuff
function onroundreset()
-- close the holes
OutputEvent("cp1_detpack_hole", "Enable")
OutputEvent("cp4_detpack_hole", "Enable")
--re-enable detpack relays
OutputEvent("cp1_detpack_relay", "Enable")
OutputEvent("cp4_detpack_relay", "Enable")
-- Reset The Turrets(?) and Bags
respawnturret_attackers = base_respawnturret:new({ team = attackers })
respawnturret_defenders = base_respawnturret:new({ team = defenders })
attackers_palammotypeone.team = attackers
attackers_palgrenadepackone.team = attackers
end
bellbutton = func_button:new({})
function bellbutton:ondamage() return true end
---------------------------
--Detpack shit
---------------------------
detpack_trigger = trigger_ff_script:new({ prefix = "" })
function detpack_trigger:onexplode( trigger_entity )
if IsDetpack( trigger_entity ) then
local detpack = CastToDetpack( trigger_entity )
if detpack:GetTeamId() == attackers then
--This triggers a logic_relay in the map, which opens the hole and can trigger any other effect.
OutputEvent( self.prefix .. "_detpack_relay", "Trigger" )
end
end
return EVENT_ALLOWED
end
--The detpack trigger names. Only attakers can activate them.
--Prefix is used so each detpack area can have a different effect.
cp1_detpack_trigger = detpack_trigger:new({ prefix = "cp1" })
cp4_detpack_trigger = detpack_trigger:new({ prefix = "cp4" })
---------------------------------------------------
--Respawn the player if they go too far out to sea.
---------------------------------------------------
out_of_bounds = trigger_ff_script:new({})
function out_of_bounds:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return EVENT_ALLOWED
end
return EVENT_DISALLOWED
end
function out_of_bounds:ontrigger( triggering_entity )
if IsPlayer( triggering_entity ) then
local player = CastToPlayer( triggering_entity )
ApplyToPlayer( player, { AT.kRespawnPlayers } )
end
end
cp1_detpack_trigger_hint = trigger_ff_script:new({})
function cp1_detpack_trigger_hint:ontrigger( triggering_entity )
if IsPlayer( triggering_entity ) then
local player = CastToPlayer( triggering_entity )
DisplayMessage( player, "A demoman on the attacking team can open this passage by laying a detpack here." )
end
end
cp4_detpack_trigger_hint = cp1_detpack_trigger_hint
------------------------------------------
--return the flag if it goes in the water.
------------------------------------------
--hijacking this base_id function to add in the last line
function setup_return_timer()
RemoveSchedule( "timer_tobase_schedule" )
current_timer = FLAG_RETURN_TIME
AddScheduleRepeatingNotInfinitely( "timer_return_schedule", 1, timer_schedule, current_timer)
--five seconds should be enough time to check.
AddSchedule( "water_check", 5, check_flag_position)
end
function check_flag_position()
local flag = GetInfoScriptByName(current_flag)
local o = flag:GetOrigin()
-- -256 is Palermo's sea level
if o.z < -256 then
flag:Return()
BroadCastMessage("The flag was lost at sea and has returned.")
end
end

21
maps/ff_palermo.txt Normal file
View file

@ -0,0 +1,21 @@
INVADE AND DEFEND
Objective:
Blue team starts as the attacker. Red team
starts as the defender.
The attacking team must take control of the
town by pushing through and capping the four
Command Points sequentially. The defending
team simply tries to hold out as long as they
can. Once the attackers succeed, teams swap,
and play begins again.
Command Points are captured by taking the flag
from the previous point and carrying it to the
next. When a Command Point is secured, the flag
required to capture the next Command Point
appears on top of it. For example, the flag
needed to capture Command Point 3 will always
spawn at Command Point 2.

48
maps/ff_push.lua Normal file
View file

@ -0,0 +1,48 @@
-- ff_push.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_push");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
local orig_startup = startup
function startup()
-- set up team names. Localisation?
SetTeamName( Team.kBlue, "Ball Locks" )
SetTeamName( Team.kRed, "Rocket Expediting" )
orig_startup()
end
-----------------------------------------------------------------------------
-- triggers for doors
-----------------------------------------------------------------------------
red_respawn_triggerA = respawndoor:new({ team = Team.kRed })
red_respawn_triggerB = respawndoor:new({ team = Team.kRed })
blue_respawn_triggerA = respawndoor:new({ team = Team.kBlue })
blue_respawn_triggerB = respawndoor:new({ team = Team.kBlue })
-----------------------------------------------------------------------------
-- unique push locations
-----------------------------------------------------------------------------
location_blue_corridor = location_info:new({ text = "Corridor", team = Team.kBlue })
location_red_corridor = location_info:new({ text = "Corridor", team = Team.kRed })
location_blue_lasers = location_info:new({ text = "Lasers", team = Team.kBlue })
location_red_lasers = location_info:new({ text = "Lasers", team = Team.kRed })
location_blue_side_warehouse = location_info:new({ text = "Side Warehouse", team = Team.kBlue })
location_red_side_warehouse = location_info:new({ text = "Side Warehouse", team = Team.kRed })
location_blue_loading_bay = location_info:new({ text = "Loading Bay", team = Team.kBlue })
location_red_loading_bay = location_info:new({ text = "Loading Bay", team = Team.kRed })
location_middle_warehouse = location_info:new({ text = "Middle Warehouse", team = Team.kUnassigned })

4
maps/ff_push.txt Normal file
View file

@ -0,0 +1,4 @@
PUSH SCORING
Objective: Grab the ball from the centre warehouse and then run it to the enemy company's loading zone! Capture it on the raised platform.
The team with the most captures at the end of the game wins!

View file

@ -0,0 +1,211 @@
// Push soundscape file
// Author: Defrag
// Some sections based on existing valve soundscapes but modified
// generic outside sound
"ff.outside"
{
// constant wind base
"playlooping"
{
"volume" "0.2"
"pitch" "100"
"wave" "ambient/wind/ff_wasteland_wind.wav"
}
// Wind gusts (based on cliffe's cs_assault settings)
"playrandom"
{
"time" "20,30"
"volume" "0.3,0.4"
"pitch" "90,110"
"rndwave"
{
"wave" "ambient/wind/wind_snippet1.wav"
"wave" "ambient/wind/wind_snippet2.wav"
"wave" "ambient/wind/wind_snippet3.wav"
"wave" "ambient/wind/wind_snippet4.wav"
"wave" "ambient/wind/wind_snippet5.wav"
}
}
}
// Rats. Ach, gash!
"push.rats"
{
"playrandom"
{
"time" "20,30"
"volume" "0.3,0.5"
"pitch" "90,100"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/creatures/rats1.wav"
"wave" "ambient/creatures/rats2.wav"
"wave" "ambient/creatures/rats3.wav"
"wave" "ambient/creatures/rats4.wav"
}
}
}
// workshop noises
"push.workshop"
{
"playrandom"
{
"time" "30,60"
"volume" "0.1,0.2"
"pitch" "90,110"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/push/airhose.wav"
"wave" "ambient/push/airwrench1.wav"
"wave" "ambient/push/airwrench2.wav"
}
}
}
// outside area between the central warehouse and the base corridor
"push.outside"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "ff.outside"
"volume" "1.0"
}
}
// capture point area
"push.capturepoint"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "ff.outside"
"volume" "1.0"
}
// train going past
"playrandom"
{
"time" "120,180"
"volume" "0.3"
"pitch" "100"
"rndwave"
{
"wave" "ambient/machines/train_rumble.wav"
}
}
}
// side warehouse with no roof
"push.sidewarehouse"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "ff.outside"
"volume" "1.0"
}
"playsoundscape"
{
"name" "push.rats"
"volume" "1.0"
}
"playsoundscape"
{
"name" "push.workshop"
"volume" "1.0"
}
}
// respawn
"push.respawn"
{
"dsp" "1"
"dsp_volume" "0.5"
// General ambient noise
"playlooping"
{
"volume" "0.3"
"pitch" "100"
"wave" "ambient/push/inside_amb1.wav"
}
"playrandom"
{
"time" "30,60"
"volume" "0.3,0.5"
"pitch" "90,100"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/materials/metal4.wav"
"wave" "ambient/materials/rustypipes1.wav"
"wave" "ambient/materials/rustypipes2.wav"
}
}
}
// main warehouse in centre
"push.centralwarehouse"
{
"dsp" "1"
"dsp_volume" "0.5"
// General ambient noise
"playlooping"
{
"volume" "0.5"
"pitch" "100"
"wave" "ambient/push/inside_amb1.wav"
}
"playsoundscape"
{
"name" "push.workshop"
"volume" "1.0"
}
"playsoundscape"
{
"name" "ff.outside"
"volume" "0.6"
}
}
// doughnut shaped hallway that connects the respawn, cap point, side warehouse etc.
"push.doughnut"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "push.respawn"
"volume" "1.0"
}
"playsoundscape"
{
"name" "ff.outside"
"volume" "0.6"
}
}

250
maps/ff_schtop.lua Normal file
View file

@ -0,0 +1,250 @@
-----------------------------------------------------------------------------------------------------------------------------
-- INCLUDES
-----------------------------------------------------------------------------------------------------------------------------
IncludeScript("base_shutdown");
IncludeScript("base_location");
-----------------------------------------------------------------------------------------------------------------------------
-- CONSTANT!
-- I don't recommend changing this, as the in-game timer (above the FR door) will not change along with it.
-- Behaviour is undefined for values <= 10
-----------------------------------------------------------------------------------------------------------------------------
SECURITY_LENGTH = 40
-----------------------------------------------------------------------------------------------------------------------------
-- LOCATIONS
-----------------------------------------------------------------------------------------------------------------------------
location_blue_flagroom = location_info:new({ text = "Flag Room", team = Team.kBlue })
location_blue_window = location_info:new({ text = "Security Window", team = Team.kBlue })
location_blue_security = location_info:new({ text = "Security Area", team = Team.kBlue })
location_blue_courtyard = location_info:new({ text = "Main Courtyard", team = Team.kBlue })
location_blue_rampside = location_info:new({ text = "Ramp Side", team = Team.kBlue })
location_blue_secside = location_info:new({ text = "Security Side", team = Team.kBlue })
location_blue_frontdoor = location_info:new({ text = "Front Door", team = Team.kBlue })
location_blue_water = location_info:new({ text = "Water Area", team = Team.kBlue })
location_blue_spawn = location_info:new({ text = "Team Respawn", team = Team.kBlue })
location_red_flagroom = location_info:new({ text = "Flag Room", team = Team.kRed })
location_red_window = location_info:new({ text = "Security Window", team = Team.kRed })
location_red_security = location_info:new({ text = "Security Area", team = Team.kRed })
location_red_courtyard = location_info:new({ text = "Main Courtyard", team = Team.kRed })
location_red_rampside = location_info:new({ text = "Ramp Side", team = Team.kRed })
location_red_secside = location_info:new({ text = "Security Side", team = Team.kRed })
location_red_frontdoor = location_info:new({ text = "Front Door", team = Team.kRed })
location_red_water = location_info:new({ text = "Water Area", team = Team.kRed })
location_red_spawn = location_info:new({ text = "Team Respawn", team = Team.kRed })
location_yard = location_info:new({ text = "Yard", team = Team.kUnassigned })
-----------------------------------------------------------------------------
-- TOUCH RESUP
-- Brush volume which gives players health, ammo, etc...
-- Pretty much taken from ff_.lua
-----------------------------------------------------------------------------
touch_resup = trigger_ff_script:new({ team = Team.kUnassigned })
function touch_resup:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == self.team then
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
end
end
blue_touch_resup = touch_resup:new({ team = Team.kBlue })
red_touch_resup = touch_resup:new({ team = Team.kRed })
-----------------------------------------------------------------------------------------------------------------------------
-- WINDOWPACK
-- Team-specific packs which are located near the window where players can throw the flag out.
-----------------------------------------------------------------------------------------------------------------------------
windowpack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 130,
gren1 = 0,
gren2 = 0,
respawntime = 8,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function windowpack:dropatspawn() return false end
blue_windowpack = windowpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue } })
red_windowpack = windowpack:new({ touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed } })
-----------------------------------------------------------------------------
-- SPAWN PROTECTION
-- kills those who wander into the enemy spawn
-----------------------------------------------------------------------------
spawn_protection = trigger_ff_script:new({ team = Team.kUnassigned })
function spawn_protection:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
red_spawn_protection = spawn_protection:new({ team = Team.kBlue })
blue_spawn_protection = spawn_protection:new({ team = Team.kRed })
-----------------------------------------------------------------------------
-- OFFENSIVE AND DEFENSIVE SPAWNS
-- Medic, Spy, and Scout spawn in the offensive spawns, other classes spawn in the defensive spawn,
-- Copied from ff_session.lua
-----------------------------------------------------------------------------
red_o_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kEngineer))) end
red_d_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kEngineer) == false))) end
red_ospawn = { validspawn = red_o_only }
red_dspawn = { validspawn = red_d_only }
blue_o_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kScout) or (player:GetClass() == Player.kMedic) or (player:GetClass() == Player.kSpy) or (player:GetClass() == Player.kEngineer))) end
blue_d_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and (((player:GetClass() == Player.kScout) == false) and ((player:GetClass() == Player.kMedic) == false) and ((player:GetClass() == Player.kSpy) == false) and ((player:GetClass() == Player.kEngineer) == false))) end
blue_ospawn = { validspawn = blue_o_only }
blue_dspawn = { validspawn = blue_d_only }
-----------------------------------------------------------------------------
-- AND THEN, SOME MORE STUFF...
-----------------------------------------------------------------------------
red_sec = trigger_ff_script:new()
blue_sec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1
sec_iconx = 60
sec_icony = 30
sec_iconw = 16
sec_iconh = 16
function red_sec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
if redsecstatus == 1 then
redsecstatus = 0
AddSchedule("secup10red", SECURITY_LENGTH - 10, secup10red)
AddSchedule("beginclosered", SECURITY_LENGTH - 6, beginclosered)
AddSchedule("secupred",SECURITY_LENGTH,secupred)
OpenDoor("red_secdoor")
BroadCastMessage("#FF_RED_SEC_40")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end
end
end
function blue_sec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kRed then
if bluesecstatus == 1 then
bluesecstatus = 0
AddSchedule("secup10blue", SECURITY_LENGTH - 10, secup10blue)
AddSchedule("begincloseblue", SECURITY_LENGTH - 6, begincloseblue)
AddSchedule("secupblue",SECURITY_LENGTH,secupblue)
OpenDoor("blue_secdoor")
BroadCastMessage("#FF_BLUE_SEC_40")
SpeakAll( "SD_BLUEDOWN" )
RemoveHudItemFromAll( "blue-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
end
end
end
function secupred()
redsecstatus = 1
BroadCastMessage("#FF_RED_SEC_ON")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
function begincloseblue()
CloseDoor("blue_secdoor")
end
function beginclosered()
CloseDoor("red_secdoor")
end
function secupblue()
bluesecstatus = 1
BroadCastMessage("#FF_BLUE_SEC_ON")
SpeakAll( "SD_BLUEUP" )
RemoveHudItemFromAll( "blue-sec-down" )
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
function secup10red()
BroadCastMessage("#FF_RED_SEC_10")
end
function secup10blue()
BroadCastMessage("#FF_BLUE_SEC_10")
end
grp = bigpack:new({
materializesound="Item.Materialize",
gren1=4,gren2=4,model=
"models/items/backpack/backpack.mdl",
respawntime=1,touchsound="Backpack.Touch"})
function grp:dropatspawn() return false end
-------------------------
-- flaginfo
-------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
flaginfo_base(player_entity) --basic CTF HUD items
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if bluesecstatus == 1 then
AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
else
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 2 )
end
if redsecstatus == 1 then
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
else
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", sec_iconx, sec_icony, sec_iconw, sec_iconh, 3 )
end
end

7
maps/ff_schtop.txt Normal file
View file

@ -0,0 +1,7 @@
ff_schtop
Shut off the security devices protecting the enemy flag and
steal it from their base. Capture it in your own base.
Each capture is worth 10 points for your team.
The team with the most points at the end of the round wins.

View file

@ -0,0 +1,200 @@
////////////////////////////////////////////////
// FF_SCHTOP SOUNDSCAPES
// Modified ff_session soundscape file.
//
// GENERIC
// WATER
// YARD
//
////////////////////////////////////////////////
////////////////////////////////////////////////
// STRANGE AMBIENCE
// Utility soundscape for some digital-sounding ambience.
////////////////////////////////////////////////
"ff_schtop.strange_ambience"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/levels/citadel/field_loop3.wav"
"volume" "0.25"
"pitch" "100"
}
"playlooping"
{
"wave" "hl1/ambience/techamb2.wav"
"volume" "0.25"
"pitch" "100"
}
"playlooping"
{
"wave" "hl1/ambience/alien_blipper.wav"
"volume" "0.25"
"pitch" "100"
}
"playlooping"
{
"wave" "hl1/ambience/alien_cycletone.wav"
"volume" "0.25"
"pitch" "100"
}
"playrandom"
{
"volume" "0.25,0.40"
"time" "5.0,15.0"
"pitch" "80,120"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/levels/prison/radio_random3.wav"
"wave" "ambient/levels/prison/radio_random7.wav"
"wave" "ambient/levels/canals/headcrab_canister_ambient3.wav"
"wave" "ambient/levels/citadel/portal_beam_shoot6.wav"
"wave" "ambient/machines/machine1_hit2.wav"
}
}
}
////////////////////////////////////////////////
// GENERIC
// Some digital-sounding ambience and random wierd noises.
// Default soundscape.
////////////////////////////////////////////////
"ff_schtop.generic"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/atmosphere/ff_ambience.wav"
"volume" "0.66"
"pitch" "100"
}
"playlooping"
{
"wave" "ambient/push/inside_amb1.wav"
"volume" "0.33"
"pitch" "100"
}
"playsoundscape"
{
"name" "ff_schtop.strange_ambience"
"volume" "0.66"
}
"playrandom"
{
"volume" "0.15,0.30"
"time" "10.0,20.0"
"pitch" "50,150"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "weapons/physcannon/energy_sing_flyby1.wav"
"wave" "weapons/physcannon/energy_sing_flyby2.wav"
}
}
}
////////////////////////////////////////////////
// YARD
// Outdoor wind ambience with random gusts.
////////////////////////////////////////////////
"ff_schtop.yard"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/wind/ff_wasteland_wind.wav"
"volume" "0.8"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_windgusts"
"volume" "1.0"
}
"playsoundscape"
{
"name" "ff_schtop.strange_ambience"
"volume" "0.15"
}
"playrandom"
{
"volume" "0.15,0.30"
"time" "7.0,14.0"
"pitch" "80,120"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/levels/citadel/strange_talk6.wav"
"wave" "ambient/levels/citadel/strange_talk7.wav"
"wave" "ambient/levels/citadel/strange_talk8.wav"
"wave" "ambient/levels/citadel/strange_talk9.wav"
"wave" "ambient/levels/citadel/strange_talk10.wav"
}
}
}
////////////////////////////////////////////////
// WATER
// Water running and random dripping ambience.
////////////////////////////////////////////////
"ff_schtop.water"
{
"dsp" "1"
"playlooping"
{
"wave" "ambient/atmosphere/ambience5.wav"
"volume" "0.2"
"pitch" "100"
}
"playlooping"
{
"wave" "ambient/levels/canals/waterleak_loop1.wav"
"volume" "0.3"
"pitch" "100"
}
"playsoundscape"
{
"name" "d1_canals.util_drip"
"volume" "1.0"
}
"playsoundscape"
{
"name" "d1_canals.util_fardrips"
"volume" "1.0"
}
}
////////////////////////////////////////////////

126
maps/ff_shutdown2.lua Normal file
View file

@ -0,0 +1,126 @@
-- ff_shutdown2.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_shutdown");
-----------------------------------------------------------------------------
-- unique shutdown2 locations
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- aardvark security
-----------------------------------------------------------------------------
red_aardvarksec = trigger_ff_script:new()
blue_aardvarksec = trigger_ff_script:new()
bluesecstatus = 1
redsecstatus = 1
function red_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
if redsecstatus == 1 then
redsecstatus = 0
AddSchedule("aardvarksecup10red",50,aardvarksecup10red)
AddSchedule("aardvarksecupred",60,aardvarksecupred)
OpenDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_60")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 )
end
end
end
end
function blue_aardvarksec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kRed then
if bluesecstatus == 1 then
bluesecstatus = 0
AddSchedule("aardvarksecup10blue",50,aardvarksecup10blue)
AddSchedule("aardvarksecupblue",60,aardvarksecupblue)
OpenDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_60")
--BroadCastSound( "otherteam.flagstolen")
SpeakAll( "SD_BLUEDOWN" )
RemoveHudItemFromAll( "blue-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "blue-sec-down", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 )
end
end
end
end
function aardvarksecupred()
redsecstatus = 1
CloseDoor("red_aardvarkdoorhack")
BroadCastMessage("#FF_RED_SEC_ON")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 )
end
function aardvarksecupblue()
bluesecstatus = 1
CloseDoor("blue_aardvarkdoorhack")
BroadCastMessage("#FF_BLUE_SEC_ON")
SpeakAll( "SD_BLUEUP" )
RemoveHudItemFromAll( "blue-sec-down" )
AddHudIconToAll( "hud_secup_blue.vtf", "blue-sec-up", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 )
end
function aardvarksecup10red()
BroadCastMessage("#FF_RED_SEC_10")
end
function aardvarksecup10blue()
BroadCastMessage("#FF_BLUE_SEC_10")
end
-------------------------
-- flaginfo
-------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
flaginfo_base(player_entity) --basic CTF HUD items
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if bluesecstatus == 1 then
AddHudIcon( player, "hud_secup_blue.vtf", "blue-sec-up", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 )
else
AddHudIcon( player, "hud_secdown.vtf", "blue-sec-down", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, 2 )
end
if redsecstatus == 1 then
AddHudIcon( player, "hud_secup_red.vtf", "red-sec-up", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 )
else
AddHudIcon( player, "hud_secdown.vtf", "red-sec-down", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, 3 )
end
end
-----------------------------------------------------------------------------
-- respawn shields
-----------------------------------------------------------------------------
KILL_KILL_KILL = trigger_ff_script:new({ team = Team.kUnassigned })
function KILL_KILL_KILL:allowed( activator )
local player = CastToPlayer( activator )
if player then
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
blue_slayer = KILL_KILL_KILL:new({ team = Team.kBlue })
red_slayer = KILL_KILL_KILL:new({ team = Team.kRed })

5
maps/ff_shutdown2.txt Normal file
View file

@ -0,0 +1,5 @@
SHUTDOWN CAPTURE THE FLAG
Objectives:
# Temporarily de-activate the enemy team's security systems by making your way to the security generator room and touching the switch.
# Once the lasers are de-activated, enter the flag room and steal the enemy flag! Return the enemy flag to your base to capture. The capture point is in the middle of the battlements.

View file

@ -0,0 +1,32 @@
"shutdown2.generatordown"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"pitch" "PITCH_NORM"
"CompatibilityAttenuation" "0.5"
"wave" "ambient/shutdown/generator_down.wav"
}
"shutdown2.generatorup"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"pitch" "PITCH_NORM"
"CompatibilityAttenuation" "0.5"
"wave" "ambient/shutdown/generator_up.wav"
}
"shutdown2.generatorhumloop1"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"pitch" "PITCH_NORM"
"CompatibilityAttenuation" "0.5"
"wave" "ambient/shutdown/generator_hum_low.wav"
}
"shutdown2.generatorhumloop2"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"pitch" "PITCH_NORM"
"CompatibilityAttenuation" "0.5"
"wave" "ambient/shutdown/generator_hum_high.wav"
}

View file

@ -0,0 +1,240 @@
// Shutdown2 soundscape file
// Author: Defrag
// Some sections based on existing valve soundscapes but modified
// Flag Room
"shutdown2.flagroom"
{
"dsp" "1"
"dsp_volume" "0.6"
// General ambient noise
"playlooping"
{
"volume" "0.1"
"pitch" "100"
"wave" "ambient/atmosphere/ff_ambience.wav"
}
"playrandom"
{
"time" "30,60"
"volume" "0.3,0.5"
"pitch" "90,100"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/materials/metal4.wav"
"wave" "ambient/materials/rustypipes1.wav"
"wave" "ambient/materials/rustypipes2.wav"
}
}
}
// Front door
"shutdown2.frontdoor"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "shutdown2.ramproom"
"volume" "0.7"
}
"playsoundscape"
{
"name" "shutdown2.yard"
"volume" "0.3"
}
}
// Lift / Elevator
"shutdown2.lift"
{
"dsp" "1"
"dsp_volume" "0.4"
"playsoundscape"
{
"name" "shutdown2.topramp"
"volume" "0.5"
}
"playsoundscape"
{
"name" "shutdown2.flagroom"
"volume" "0.5"
}
}
// Plank
"shutdown2.plank"
{
"dsp" "1"
"dsp_volume" "0.4"
"playsoundscape"
{
"name" "shutdown2.ramproom"
"volume" "0.2"
}
"playsoundscape"
{
"name" "shutdown2.flagroom"
"volume" "0.6"
}
"playrandom"
{
"time" "20,30"
"volume" "0.5, 0.8"
"pitch" "100"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/materials/rock1.wav"
"wave" "ambient/materials/rock2.wav"
"wave" "ambient/materials/rock3.wav"
"wave" "ambient/materials/rock4.wav"
"wave" "ambient/materials/rock5.wav"
}
}
}
// Ramp Room
"shutdown2.ramproom"
{
"dsp" "1"
"dsp_volume" "0.6"
"playlooping"
{
"volume" "0.3"
"pitch" "100"
"wave" "ambient/atmosphere/tone_alley.wav"
}
}
// Respawn Lower
"shutdown2.respawnlower"
{
"dsp" "1"
"dsp_volume" "0.4"
"playsoundscape"
{
"name" "shutdown2.ramproom"
"volume" "0.6"
}
}
// Respawn Upper
"shutdown2.respawnupper"
{
"dsp" "1"
"dsp_volume" "0.4"
"playsoundscape"
{
"name" "shutdown2.topramp"
"volume" "0.6"
}
}
// Switch Room
"shutdown2.switchroom"
{
"playsoundscape"
{
"name" "shutdown2.topramp"
"volume" "1.0"
}
}
// Top Ramp
"shutdown2.topramp"
{
"dsp" "1"
"dsp_volume" "0.4"
"playsoundscape"
{
"name" "shutdown2.ramproom"
"volume" "0.2"
}
"playsoundscape"
{
"name" "shutdown2.flagroom"
"volume" "0.6"
}
}
// Train Tunnel
"shutdown2.traintunnel"
{
"dsp" "1"
"dsp_volume" "0.8"
"playsoundscape"
{
"name" "shutdown2.ramproom"
"volume" "0.2"
}
"playlooping"
{
"volume" "0.05"
"pitch" "100"
"wave" "ambient/atmosphere/undercity_loop1.wav"
}
"playlooping"
{
"volume" "0.1"
"pitch" "100"
"wave" "ambient/atmosphere/ff_ambience.wav"
}
"playlooping"
{
"volume" "0.5"
"pitch" "100"
"wave" "ambient/water/drip_loop1.wav"
}
}
// Yard between two bases
"shutdown2.yard"
{
"dsp" "1"
"dsp_volume" "0.4"
// constant wind base
"playlooping"
{
"volume" "0.2"
"pitch" "100"
"wave" "ambient/wind/ff_wasteland_wind.wav"
}
// Wind gusts (based on cliffe's cs_assault settings)
"playrandom"
{
"time" "20,30"
"volume" "0.3,0.4"
"pitch" "90,110"
"rndwave"
{
"wave" "ambient/wind/wind_snippet1.wav"
"wave" "ambient/wind/wind_snippet2.wav"
"wave" "ambient/wind/wind_snippet3.wav"
"wave" "ambient/wind/wind_snippet4.wav"
"wave" "ambient/wind/wind_snippet5.wav"
}
}
}

1934
maps/ff_training.lua Normal file

File diff suppressed because it is too large Load diff

592
maps/ff_warpath.lua Normal file
View file

@ -0,0 +1,592 @@
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_cp_default")
IncludeScript("base_cp_sequential")
IncludeScript("base_chatcommands")
-----------------------------------------------------------------------------
--Globals
-----------------------------------------------------------------------------
POINTS_FOR_COMPLETE_CONTROL = 25
ENABLE_COMPLETE_CONTROL_RESET = true
ENABLE_COMPLETE_CONTROL_RESPAWN = true
COMPLETE_CONTROL_RESPAWN_DELAY = 5
INITIAL_ROUND_DELAY = 20
RETOUCH_DELAY = 10.0 --CP3
RETOUCH_DELAY_CP2RED_CP4BLUE = 20
RETOUCH_DELAY_CP2BLUE_CP4RED = 10
CAP_REQ_CP1_CP5 = 750
CAP_REQ_CP3 = 1000
CAP_REQ_CP2RED_CP4BLUE = 1000
CAP_REQ_CP2BLUE_CP4RED = 1250
cp_blue = 1
cp_red = 5
RED_TUNNEL_WALL_BLOWN = false
BLUE_TUNNEL_WALL_BLOWN = false
-----------------------------------------------------------------------------
-- Chat commands and settings
-----------------------------------------------------------------------------
-- teamcapsound
chatbase_addcommand( "teamcapsound", "Determines if a sound is played when the other team starts capping a point", "teamcapsound 0/1" )
function chat_teamcapsound( player, setting )
setting = tonumber(setting)
if setting == "" or setting == nil then
-- no parameter, just echo back their current setting
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Current team capture sound setting: "..tostring(chatbase_getplayersetting(player, "startcapsound")))
elseif setting == 0 or not setting then
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Turned your team capture sound off")
chatbase_setplayersetting(player, "teamcapsound", 0)
else
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Turned your team capture sound on")
chatbase_setplayersetting(player, "teamcapsound", 1)
end
end
chatbase_addplayersetting( "teamcapsound", 1, "Determines if a sound is played when the other team starts capping a point" )
-- startcapsound
chatbase_addcommand( "startcapsound", "Determines if a sound is played when you start to capture a point", "startcapsound 0/1" )
function chat_startcapsound( player, setting )
setting = tonumber(setting)
if setting == "" or setting == nil then
-- no parameter, just echo back their current setting
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Current start capture sound setting: "..tostring(chatbase_getplayersetting(player, "startcapsound")))
elseif setting == 0 or not setting then
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Turned your start capture sound off")
chatbase_setplayersetting(player, "startcapsound", 0)
else
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Turned your start capture sound on")
chatbase_setplayersetting(player, "startcapsound", 1)
end
end
chatbase_addplayersetting( "startcapsound", 1, "Determines if a sound is played when the opposite team starts to capture a point" )
-----------------------------------------------------------------------------
-- event outputs
-----------------------------------------------------------------------------
function startup()
SetGameDescription("Sequential Control Points")
-- disable certain teams
for i,v in pairs(disabled_teams) do
SetPlayerLimit( v, -1 )
end
-- set up team limits
for i1,v1 in pairs(teams) do
local team = GetTeam(v1)
for i2,v2 in ipairs(team_info[team:GetTeamId()].class_limits) do
team:SetClassLimit( i2, v2 )
end
end
RemoveAllCPAmmoAndArmor()
for i,v in ipairs(command_points) do
RemoveSchedule( "cp" .. v.cp_number .. "_cap_timer" )
ResetCPCapping( v )
AddScheduleRepeating( "cp" .. v.cp_number .. "_cap_zone_timer", CAP_ZONE_TIMER_INTERVAL, cap_zone_timer, v )
end
reset_map_items(true)
end
function complete_control_notification ( team_number )
local team = GetTeam(team_number)
SmartTeamSound(team, "yourteam.flagcap", "otherteam.flagcap")
SmartTeamSpeak(team, "CZ_GOTALL", "CZ_THEYGOTALL")
SmartTeamMessage(team, "#FF_CZ2_YOURTEAM_COMPLETE", "#FF_CZ2_OTHERTEAM_COMPLETE")
AddSchedule("reset_map_items", COMPLETE_CONTROL_RESPAWN_DELAY, reset_map_items, false)
end
function reset_map_items (firstRound)
BLUE_TUNNEL_WALL_BLOWN = false
RED_TUNNEL_WALL_BLOWN = false
OutputEvent( "blue_detwall_template", "ForceSpawn" )
OutputEvent( "red_detwall_template", "ForceSpawn" )
OBJECTIVE_TEAM1 = "cp2_zone"
OBJECTIVE_TEAM2 = "cp4_zone"
UpdateTeamObjectiveIcon( GetTeam(TEAM1), GetEntityByName( OBJECTIVE_TEAM1 ) )
UpdateTeamObjectiveIcon( GetTeam(TEAM2), GetEntityByName( OBJECTIVE_TEAM2 ) )
if firstRound then
for i,v in ipairs(command_points) do
ChangeCPDefendingTeam(v.cp_number, Team.kUnassigned)
ResetCPCapping( v )
end
ChangeCPDefendingTeam( 1, TEAM1 )
ChangeCPDefendingTeam( CP_COUNT, TEAM2 )
setup_door_timer("startgate_blue", INITIAL_ROUND_DELAY)
setup_door_timer("startgate_red", INITIAL_ROUND_DELAY)
else
setup_door_timer("startgate_blue", 12)
setup_door_timer("startgate_red", 12)
end
end
function event_StopTouchingCP( entity, cp )
return
end
function event_StartTouchingCP( entity, cp )
if IsPlayer( entity ) then
local player = CastToPlayer( entity )
if chatbase_getplayersetting(player, "startcapsound") ~= 0 then
BroadCastSoundToPlayer( player, "misc.woop" )
end
end
return
end
function event_StartTouchingCC( entity, cc_team_number )
return
end
function event_StopTouchingCC( entity, cc_team_number )
return
end
function event_ChangeCPDefendingTeam( cp_number, new_defending_team )
-- Change the skybeam and groundbeam color
OutputEvent( "cp" .. cp_number .. "_actiondoor_" .. team_info[command_points[cp_number].defending_team].team_name, "Close")
OutputEvent( "cp" .. cp_number .. "_actiondoor_" .. team_info[new_defending_team].team_name, "Open")
-- update valid spawns
if new_defending_team == Team.kBlue then
cp_blue = cp_number
if command_points[cp_number].defending_team == Team.kRed then
cp_red = cp_number + 1
end
elseif new_defending_team == Team.kRed then
cp_red = cp_number
if command_points[cp_number].defending_team == Team.kBlue then
cp_blue = cp_number - 1
end
end
end
function event_ResetTeamCPCapping( cp, team_number )
OutputEvent( "cp" .. cp.cp_number .. "_" .. team_info[team_number].team_name .. "_beam", "TurnOff" )
end
function event_StartTeamCPCapping( cp, team_number )
OutputEvent( "cp" .. cp.cp_number .. "_" .. team_info[team_number].team_name .. "_beam", "TurnOn" )
local team = GetTeam(team_number)
for i,v in pairs(chatbase_players) do
local player = CastToPlayer(v.player)
if IsPlayer(player) then
if player:GetTeamId() ~= team_number then
if chatbase_getplayersetting(player, "teamcapsound") then
BroadCastSoundToPlayer( player, "misc.bloop" )
end
end
end
end
end
team_info = {
[Team.kUnassigned] = {
team_name = "neutral",
enemy_team = Team.kUnassigned,
objective_icon = nil,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen },
skybeam_color = "128 128 128",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 1,
skin = "0",
flag_visibility = "TurnOff",
cc_touch_count = 0,
ccalarmicon = "hud_secdown.vtf", ccalarmiconx = 0, ccalarmicony = 0, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 2,
detcc_sentence = "HTD_DOORS",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
},
[TEAM1] = {
team_name = "blue",
enemy_team = TEAM2,
objective_icon = nil,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue },
skybeam_color = "64 64 255",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 2,
skin = "2",
flag_visibility = "TurnOn",
cc_touch_count = 0,
ccalarmicon = "hud_secup_blue.vtf", ccalarmiconx = 60, ccalarmicony = 5, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 2,
detcc_sentence = "CZ_BCC_DET",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
},
[TEAM2] = {
team_name = "red",
enemy_team = TEAM1,
objective_icon = nil,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed },
skybeam_color = "255 64 64",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 0,
skin = "1",
flag_visibility = "TurnOn",
cc_touch_count = 0,
ccalarmicon = "hud_secup_red.vtf", ccalarmiconx = 60, ccalarmicony = 5, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 3,
detcc_sentence = "CZ_RCC_DET",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
}
}
-------------------------------------------
-- Round start functions
-------------------------------------------
function setup_door_timer(doorname, duration)
CloseDoor(doorname)
AddSchedule("round_opendoor_" .. doorname, duration, round_start, doorname)
if duration > 10 then AddSchedule( "dooropen5sec" , duration - 10 , schedulemessagetoall, "Gates open in 10 seconds!" ) end
if duration > 5 then AddSchedule( "dooropen5sec" , duration - 5 , schedulemessagetoall, "5" ) end
if duration > 4 then AddSchedule( "dooropen4sec" , duration - 4 , schedulemessagetoall, "4" ) end
if duration > 3 then AddSchedule( "dooropen3sec" , duration - 3, schedulemessagetoall, "3" ) end
if duration > 2 then AddSchedule( "dooropen2sec" , duration - 2, schedulemessagetoall, "2" ) end
if duration > 1 then AddSchedule( "dooropen1sec" , duration - 1, schedulemessagetoall, "1" ) end
if duration > 5 then AddSchedule( "dooropen5seccount" , duration - 5 , schedulecountdown, 5 ) end
if duration > 4 then AddSchedule( "dooropen4seccount" , duration - 4 , schedulecountdown, 4 ) end
if duration > 3 then AddSchedule( "dooropen3seccount" , duration - 3 , schedulecountdown, 3 ) end
if duration > 2 then AddSchedule( "dooropen2seccount" , duration - 2 , schedulecountdown, 2 ) end
if duration > 1 then AddSchedule( "dooropen1seccount" , duration - 1 , schedulecountdown, 1 ) end
end
function round_start(doorname)
BroadCastMessage("Gates are now open!")
BroadCastSound( "otherteam.flagstolen" )
SpeakAll( "AD_GATESOPEN" )
OpenDoor(doorname)
end
function schedulemessagetoall( message )
BroadCastMessage( message )
end
function schedulecountdown( time )
BroadCastMessage( ""..time.."" )
SpeakAll( "AD_" .. time .. "SEC" )
end
-----------------------------------------------------------------------------
-- bags
-----------------------------------------------------------------------------
gen_pack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 0,
gren2 = 0,
cells = 130,
respawntime = 10,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch"})
blue_gen_pack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 1,
gren2 = 0,
cells = 130,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue}})
red_gen_pack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 0,
nails = 300,
shells = 300,
rockets = 300,
gren1 = 1,
gren2 = 0,
cells = 130,
respawntime = 15,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kRed}})
-----------------------------------------------------------------------------
-- overrides
-----------------------------------------------------------------------------
-- teleporting
ENABLE_CC_TELEPORTERS = false
ENABLE_CP_TELEPORTERS = false
-- command center
ENABLE_CC = false
-- command points
CP_COUNT = 5
command_points = {
[1] = {
cp_number = 1,
defending_team = Team.kBlue,
cap_requirement = { [TEAM1] = CAP_REQ_CP1_CP5, [TEAM2] = CAP_REQ_CP1_CP5 },
cap_status = { [TEAM1] = 0, [TEAM2] = 0 },
cap_speed = { [TEAM1] = 0, [TEAM2] = 0 },
next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 },
delay_before_retouch = { [TEAM1] = RETOUCH_DELAY, [TEAM2] = RETOUCH_DELAY },
touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
point_value = { [TEAM1] = 1, [TEAM2] = 5 },
score_timer_interval = { [TEAM1] = 30.00, [TEAM2] = 15.00 },
hudstatusicon = "hud_cp_1.vtf", hudposx = -40, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[2] = {
cp_number = 2,
defending_team = Team.kUnassigned,
cap_requirement = { [TEAM1] = CAP_REQ_CP2RED_CP4BLUE, [TEAM2] = CAP_REQ_CP2BLUE_CP4RED },
cap_status = { [TEAM1] = 0, [TEAM2] = 0 },
cap_speed = { [TEAM1] = 0, [TEAM2] = 0 },
next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 },
delay_before_retouch = { [TEAM1] = RETOUCH_DELAY_CP2BLUE_CP4RED, [TEAM2] = RETOUCH_DELAY_CP2RED_CP4BLUE },
touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
point_value = { [TEAM1] = 2, [TEAM2] = 4 },
score_timer_interval = { [TEAM1] = 22.50, [TEAM2] = 22.50 },
hudstatusicon = "hud_cp_2.vtf", hudposx = -20, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[3] = {
cp_number = 3,
defending_team = Team.kUnassigned,
cap_requirement = { [TEAM1] = CAP_REQ_CP3, [TEAM2] = CAP_REQ_CP3 },
cap_status = { [TEAM1] = 0, [TEAM2] = 0 },
cap_speed = { [TEAM1] = 0, [TEAM2] = 0 },
next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 },
delay_before_retouch = { [TEAM1] = RETOUCH_DELAY, [TEAM2] = RETOUCH_DELAY },
touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
point_value = { [TEAM1] = 3, [TEAM2] = 3 },
score_timer_interval = { [TEAM1] = 30.00, [TEAM2] = 30.00 },
hudstatusicon = "hud_cp_3.vtf", hudposx = 0, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[4] = {
cp_number = 4,
defending_team = Team.kUnassigned,
cap_requirement = { [TEAM1] = CAP_REQ_CP2BLUE_CP4RED, [TEAM2] = CAP_REQ_CP2RED_CP4BLUE },
cap_status = { [TEAM1] = 0, [TEAM2] = 0 },
cap_speed = { [TEAM1] = 0, [TEAM2] = 0 },
next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 },
delay_before_retouch = { [TEAM1] = RETOUCH_DELAY_CP2RED_CP4BLUE, [TEAM2] = RETOUCH_DELAY_CP2BLUE_CP4RED },
touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
point_value = { [TEAM1] = 4, [TEAM2] = 2 },
score_timer_interval = { [TEAM1] = 22.50, [TEAM2] = 22.50 },
hudstatusicon = "hud_cp_4.vtf", hudposx = 20, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[CP_COUNT] = {
cp_number = 5,
defending_team = Team.kRed,
cap_requirement = { [TEAM1] = CAP_REQ_CP1_CP5, [TEAM2] = CAP_REQ_CP1_CP5 },
cap_status = { [TEAM1] = 0, [TEAM2] = 0 },
cap_speed = { [TEAM1] = 0, [TEAM2] = 0 },
next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 },
delay_before_retouch = { [TEAM1] = RETOUCH_DELAY, [TEAM2] = RETOUCH_DELAY },
touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() },
point_value = { [TEAM1] = 5, [TEAM2] = 1 },
score_timer_interval = { [TEAM1] = 15.00, [TEAM2] = 30.00 },
hudstatusicon = "hud_cp_5.vtf", hudposx = 40, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 }
}
cap_resupply = {
health = 100,
armor = 300,
nails = 400,
shells = 400,
cells = 400,
grenades = 100,
rockets = 50,
detpacks = 0,
mancannons = 1,
gren1 = 2,
gren2 = 1
}
----------------------------------------------------------------------------
-- Spawnpoints
----------------------------------------------------------------------------
-- Spawn Points
base_blue_spawn = info_ff_teamspawn:new({ cp_number = 0, validspawn = function(self,player)
return player:GetTeamId() == Team.kBlue and self.cp_number == cp_blue
end })
base_red_spawn = info_ff_teamspawn:new({ cp_number = 0, validspawn = function(self,player)
return player:GetTeamId() == Team.kRed and self.cp_number == cp_red
end })
bluespawn_cp1 = base_blue_spawn:new({cp_number=1})
bluespawn_cp2 = base_blue_spawn:new({cp_number=2})
bluespawn_cp3 = base_blue_spawn:new({cp_number=3})
bluespawn_cp4 = base_blue_spawn:new({cp_number=4})
redspawn_cp5 = base_red_spawn:new({cp_number=5})
redspawn_cp4 = base_red_spawn:new({cp_number=4})
redspawn_cp3 = base_red_spawn:new({cp_number=3})
redspawn_cp2 = base_red_spawn:new({cp_number=2})
-- Spawn Doors (base entity)
blue_respawn_door = trigger_ff_script:new({cp_number = 0})
red_respawn_door = trigger_ff_script:new({cp_number = 0})
-- Spawn Doors (validity checks)
function blue_respawn_door:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == Team.kBlue then --and self.cp_number <= cp_blue then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function red_respawn_door:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == Team.kRed then --and self.cp_number >= cp_red then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
--Spawn Doors (Validity checks failure)
function blue_respawn_door:onfailtouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
--if player:GetTeamId() == Team.kBlue then
-- BroadCastMessageToPlayer( player, "You need to capture Command Point ".. self.cp_number .. " before you can use this respawn!" )
--else
BroadCastMessageToPlayer( player, "Your team cannot use this respawn." )
--end
end
end
function red_respawn_door:onfailtouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
--if player:GetTeamId() == Team.kRed then
-- BroadCastMessageToPlayer( player, "You need to capture Command Point ".. self.cp_number .." before you can use this respawn!" )
--else
BroadCastMessageToPlayer( player, "Your team cannot use this respawn." )
--end
end
end
-- Spawn Doors (actual entities with command point condition attached)
bluerespawn_cp2 = blue_respawn_door:new({cp_number=2})
bluerespawn_cp3 = blue_respawn_door:new({cp_number=3})
bluerespawn_cp4 = blue_respawn_door:new({cp_number=4})
redrespawn_cp2 = red_respawn_door:new({cp_number=2})
redrespawn_cp3 = red_respawn_door:new({cp_number=3})
redrespawn_cp4 = red_respawn_door:new({cp_number=4})
-----------------------------------------------------------------------------
-- Grates
-----------------------------------------------------------------------------
detwall_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" })
function detwall_trigger:onexplode( explosion_entity )
if team == Team.kUnassigned then
return
end
if IsDetpack( explosion_entity ) then
local detpack = CastToDetpack( explosion_entity )
-- GetTemId() might not exist for buildables, they have their own seperate shit and it might be named differently
-- if detpack:GetTeamId() ~= self.team then -- both teams can destroy while commented out
BroadCastSound( "misc.thunder" )
if self.team == Team.kRed then
if not RED_TUNNEL_WALL_BLOWN then
OutputEvent( self.team_name .. "_detwall", "Kill" )
BroadCastMessage("Red's tunnel has been blown!" )
RED_TUNNEL_WALL_BLOWN = true
else
OutputEvent( self.team_name .. "_detwall_template", "ForceSpawn" )
BroadCastMessage("Red's tunnel has been sealed!" )
RED_TUNNEL_WALL_BLOWN = false
end
elseif self.team == Team.kBlue then
if not BLUE_TUNNEL_WALL_BLOWN then
OutputEvent( self.team_name .. "_detwall", "Kill" )
BroadCastMessage("Blue's tunnel has been blown!" )
BLUE_TUNNEL_WALL_BLOWN = true
else
OutputEvent( self.team_name .. "_detwall_template", "ForceSpawn" )
BroadCastMessage("Blue's tunnel has been sealed!" )
BLUE_TUNNEL_WALL_BLOWN = false
end
end
-- end
end
end
red_detwall_trigger = detwall_trigger:new({ team = Team.kRed, team_name = "red" })
blue_detwall_trigger = detwall_trigger:new({ team = Team.kBlue, team_name = "blue" })

20
maps/ff_waterpolo.lua Normal file
View file

@ -0,0 +1,20 @@
-- ff_waterpolo.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_fortball_default")
IncludeScript("base_fortball")
-----------------------------------------------------------------------------
-- overrides
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- locations
-----------------------------------------------------------------------------

30
maps/ff_waterpolo.txt Normal file
View file

@ -0,0 +1,30 @@
FF_Waterpolo
GAME MODE: Push Variant
Teams vie for control of the soccer ball.
The ball carrier must enter the enemy's goal
Teams: Red VS Blue
Objectives:
- Take the enemy flag
- Bring it to the enemy's goal
Scoring:
- 10 points per goal
- 10 points given to the enemy team per own goal
- Team with most points at end of round wins
Goalies:
- Each team can have 1 super-fast civialian goalie
- Goalies are invincible inside their own team's zone, but
take 3 times normal damage outside of their zone
- Goalies cannot go out-of-bounds or into the enemy's
zone
- Goalies return the ball if they touch it
Notes:
- Landing out-of-bounds returns the ball
Optional Objectives:
- Grenade packs can be found on the sides of the map

View file

@ -0,0 +1,58 @@
// game sounds for the ff_waterpolo map
"ff_waterpolo.bizwarn"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/bizwarn.wav"
}
"ff_waterpolo.bloop"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/bloop.wav"
}
"ff_waterpolo.buzwarn"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/buzwarn.wav"
}
"ff_waterpolo.dadeda"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/dadeda.wav"
}
"ff_waterpolo.deeoo"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/deeoo.wav"
}
"ff_waterpolo.doop"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/doop.wav"
}
"ff_waterpolo.woop"
{
"channel" "CHAN_STATIC"
"volume" "1.0"
"soundlevel" "SNDLVL_100dB"
"wave" "*misc/woop.wav"
}

View file

@ -0,0 +1,55 @@
// Ramp Room, Front Door, and Resups
"waterpolo.center"
{
"dsp" "1"
"dsp_volume" "0.4"
"playlooping"
{
"volume" "0.2"
"pitch" "100"
"wave" "ambient/water/rumble_rain_nowind.wav"
}
"playlooping"
{
"volume" "0.5"
"wave" "ambient/water/lake_water.wav"
"pitch" "100"
}
// Wind gusts (based on cliffe's cs_assault settings)
"playrandom"
{
"time" "20,30"
"volume" "0.3,0.4"
"pitch" "90,110"
"rndwave"
{
"wave" "ambient/wind/wind_snippet1.wav"
"wave" "ambient/wind/wind_snippet2.wav"
"wave" "ambient/wind/wind_snippet3.wav"
"wave" "ambient/wind/wind_snippet4.wav"
"wave" "ambient/wind/wind_snippet5.wav"
}
}
"playrandom"
{
"time" "30,60"
"volume" "0.4,0.6"
"pitch" "90,110"
"position" "random"
"rndwave"
{
"wave" "ambient/weather/thunder1.wav"
"wave" "ambient/weather/thunder2.wav"
"wave" "ambient/weather/thunder3.wav"
"wave" "ambient/weather/thunder4.wav"
"wave" "ambient/weather/thunder5.wav"
}
}
}

193
maps/ff_well.lua Normal file
View file

@ -0,0 +1,193 @@
-- ff_well.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_ctf")
IncludeScript("base_teamplay")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10
FLAG_RETURN_TIME = 60
-----------------------------------------------------------------------------
-- Locations
-----------------------------------------------------------------------------
location_blue_frupper = location_info:new({ text = "Flag Room Catwalks", team = Team.kBlue })
location_red_frupper = location_info:new({ text = "Flag Room Catwalks", team = Team.kRed })
location_blue_frlower = location_info:new({ text = "Lower Flag Room", team = Team.kBlue })
location_red_frlower = location_info:new({ text = "Lower Flag Room", team = Team.kRed })
location_blue_frwater = location_info:new({ text = "Flag Room Water", team = Team.kBlue })
location_red_frwater = location_info:new({ text = "Flag Room Water", team = Team.kRed })
location_blue_ladder = location_info:new({ text = "Battlements Ladder", team = Team.kBlue })
location_red_ladder = location_info:new({ text = "Battlements Ladder", team = Team.kRed })
location_blue_concexit = location_info:new({ text = "Conc Route Exit", team = Team.kBlue })
location_red_concexit = location_info:new({ text = "Conc Route Exit", team = Team.kRed })
location_blue_canal = location_info:new({ text = "Yard Canal", team = Team.kBlue })
location_red_canal = location_info:new({ text = "Yard Canal", team = Team.kRed })
-----------------------------------------------------------------------------
-- Doors
-----------------------------------------------------------------------------
blue_door1_trigger = trigger_ff_script:new({ team = Team.kBlue })
function blue_door1_trigger:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function blue_door1_trigger:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent("blue_door1_left", "Open")
OutputEvent("blue_door1_right", "Open")
end
end
blue_door2_trigger = trigger_ff_script:new({ team = Team.kBlue })
function blue_door2_trigger:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function blue_door2_trigger:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent("blue_door2_left", "Open")
OutputEvent("blue_door2_right", "Open")
end
end
red_door1_trigger = trigger_ff_script:new({ team = Team.kRed })
function red_door1_trigger:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function red_door1_trigger:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent("red_door1_left", "Open")
OutputEvent("red_door1_right", "Open")
end
end
red_door2_trigger = trigger_ff_script:new({ team = Team.kRed })
function red_door2_trigger:allowed( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
return player:GetTeamId() == self.team
end
return EVENT_DISALLOWED
end
function red_door2_trigger:ontrigger( touch_entity )
if IsPlayer( touch_entity ) then
OutputEvent("red_door2_left", "Open")
OutputEvent("red_door2_right", "Open")
end
end
-----------------------------------------------------------------------------
-- backpacks
-----------------------------------------------------------------------------
wellpackgeneric = genericbackpack:new({
health = 20,
armor = 15,
grenades = 60,
nails = 60,
shells = 60,
rockets = 60,
cells = 60,
mancannons = 1,
gren1 = 1,
gren2 = 1,
respawntime = 35,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function wellpackgeneric:dropatspawn() return false end
-----------------------------------------------------------------------------
-- Grates
-----------------------------------------------------------------------------
base_grate_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" })
function base_grate_trigger:onexplode( explosion_entity )
if IsDetpack( explosion_entity ) then
local detpack = CastToDetpack( explosion_entity )
-- GetTemId() might not exist for buildables, they have their own seperate shit and it might be named differently
if detpack:GetTeamId() ~= self.team then
OutputEvent( self.team_name .. "_grate", "Kill" )
OutputEvent( self.team_name .. "_grate_wall", "Kill" )
if self.team_name == "red" then BroadCastMessage("#FF_RED_GRATEBLOWN") end
if self.team_name == "blue" then BroadCastMessage("#FF_BLUE_GRATEBLOWN") end
end
end
-- I think this is needed so grenades and other shit can blow up here. They won't fire the events, though.
return EVENT_ALLOWED
end
red_grate_trigger = base_grate_trigger:new({ team = Team.kRed, team_name = "red" })
blue_grate_trigger = base_grate_trigger:new({ team = Team.kBlue, team_name = "blue" })
-----------------------------------------------------------------------------
-- Buttons
-----------------------------------------------------------------------------
blue_fr_button = func_button:new({})
function blue_fr_button:ondamage() OutputEvent( "blue_fr_grate_r", "Open" ) end
function blue_fr_button:ondamage() OutputEvent( "blue_fr_grate_l", "Open" ) end
function blue_fr_button:ontouch() OutputEvent( "blue_fr_grate_r", "Open" ) end
function blue_fr_button:ontouch() OutputEvent( "blue_fr_grate_l", "Open" ) end
red_fr_button = func_button:new({})
function red_fr_button:ondamage() OutputEvent( "red_fr_grate_r", "Open" ) end
function red_fr_button:ondamage() OutputEvent( "red_fr_grate_l", "Open" ) end
function red_fr_button:ontouch() OutputEvent( "red_fr_grate_r", "Open" ) end
function red_fr_button:ontouch() OutputEvent( "red_fr_grate_l", "Open" ) end
blue_fd_button = func_button:new({})
function blue_fd_button:ondamage() OutputEvent( "blue_door0", "Open" ) end
function blue_fd_button:ontouch() OutputEvent( "blue_door0", "Open" ) end
red_fd_button = func_button:new({})
function red_fd_button:ondamage() OutputEvent( "red_door0", "Open" ) end
function red_fd_button:ontouch() OutputEvent( "red_door0", "Open" ) end

5
maps/ff_well.txt Normal file
View file

@ -0,0 +1,5 @@
CAPTURE THE FLAG
Fight your way through the enemy base and bring back the flag to you own. The flag is located at the back of the base, high up overlooking the bridge. Open the water route using a detpack for a new route into the enemy base.
The capture point is located in your own base, in the chamber below your flag room.

View file

@ -0,0 +1,165 @@
// The Well soundscape file
// Author: Mervaka
// Some sections based on existing valve soundscapes but modified
"ff.drips1"
{
"playrandom"
{
"volume" "0.1,0.3"
"pitch" "90,120"
"time" "0.5, 5.0"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/water/ff_distant_drip1.wav"
"wave" "ambient/water/ff_distant_drip2.wav"
"wave" "ambient/water/ff_distant_drip3.wav"
"wave" "ambient/water/ff_distant_drip4.wav"
}
}
}
// Yard between two bases
"Well.yard"
{
// DSP: 0 : "Normal (off)"
"dsp" "1"
"dsp_volume" "0.4"
// constant wind base
"playlooping"
{
"volume" "0.2"
"pitch" "100"
"wave" "ambient/wind/ff_wasteland_wind.wav"
}
// Wind gusts (based on cliffe's cs_assault settings)
"playrandom"
{
"time" "20,30"
"volume" "0.3,0.4"
"pitch" "90,110"
"rndwave"
{
"wave" "ambient/wind/wind_snippet1.wav"
"wave" "ambient/wind/wind_snippet2.wav"
"wave" "ambient/wind/wind_snippet3.wav"
"wave" "ambient/wind/wind_snippet4.wav"
"wave" "ambient/wind/wind_snippet5.wav"
}
}
}
// Large Open Flag Room
"Well.flagroom"
{
// DSP: // 1 : "Generic"
"dsp" "1"
"dsp_volume" "0.6"
// constant ambient base
"playlooping"
{
"volume" "0.1"
"pitch" "100"
"wave" "ambient/atmosphere/ff_ambience.wav"
}
"playsoundscape"
{
"name" "ff.drips1"
"volume" "1.0"
}
}
// Centre Bunker
"Well.bunker"
{
"dsp" "1"
"dsp_volume" "0.5"
"playsoundscape"
{
"name" "Well.yard"
"volume" "0.6"
}
}
// Ramp Room, Front Door, and Resups
"Well.front"
{
// DSP: 0 : "Normal (off)"
"dsp" "1"
"dsp_volume" "0.5"
// General ambient noise
"playlooping"
{
"volume" "0.1"
"pitch" "100"
"wave" "ambient/push/inside_amb1.wav"
}
// constant ambient base
"playlooping"
{
"volume" "0.02"
"pitch" "100"
"wave" "ambient/atmosphere/ff_ambience.wav"
}
// wind blowing through warehouse
"playrandom"
{
"time" "20,30"
"volume" "0.1,0.2"
"pitch" "90,110"
"rndwave"
{
"ambient/wind/windgust.wav"
"ambient/wind/wind_moan1.wav"
"ambient/wind/wind_moan2.wav"
"ambient/wind/wind_moan4.wav"
}
}
"playrandom"
{
"time" "30,60"
"volume" "0.3,0.5"
"pitch" "90,100"
"position" "random"
"soundlevel" "SNDLVL_140db"
"rndwave"
{
"wave" "ambient/materials/metal4.wav"
"wave" "ambient/materials/rustypipes1.wav"
"wave" "ambient/materials/rustypipes2.wav"
}
}
}
// Attic
"Well.4bags"
{
// DSP: 0 : "Normal (off)"
"dsp" "1"
"dsp_volume" "0.5
"
"playsoundscape"
{
"name" "Well.front"
"volume" "1.0"
}
// constant ambient base
"playsoundscape"
{
"name" "ff.drips1"
"volume" "0.1"
}
}

198
maps/includes/base.lua Normal file
View file

@ -0,0 +1,198 @@
-- base.lua
-----------------------------------------------------------------------------
-- This file is loaded automatically whenever a map is loaded.
-- Do not change this file.
-----------------------------------------------------------------------------
local _G = getfenv(0)
-----------------------------------------------------------------------------
-- defines
-----------------------------------------------------------------------------
-- Events
EVENT_ALLOWED = true
EVENT_DISALLOWED = false
-----------------------------------------------------------------------------
-- set a cvar, but check to make sure it's not already set correctly
-----------------------------------------------------------------------------
function set_cvar( cvarname, value )
if GetConvar( cvarname ) ~= value then
SetConvar( cvarname, value )
end
end
-----------------------------------------------------------------------------
-- Output Events
-----------------------------------------------------------------------------
function OpenDoor(name) OutputEvent( name, "Open" ) end
function CloseDoor(name) OutputEvent( name, "Close" ) end
function ToggleDoor(name) OutputEvent( name, "Toggle" ) end
-----------------------------------------------------------------------------
-- baseclass (everything derives from this guy)
-----------------------------------------------------------------------------
baseclass = { }
function baseclass:new (o)
-- create object if user does not provide one
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
-----------------------------------------------------------------------------
-- reset everything
-----------------------------------------------------------------------------
function RespawnAllPlayers()
ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips, AT.kAllowRespawn, AT.kReturnDroppedItems })
end
-----------------------------------------------------------------------------
-- lowercase c "Broadcast" functions, because uppercase C "BroadCast" functions are lame
-----------------------------------------------------------------------------
function BroadcastMessage( message )
BroadCastMessage( message )
end
function BroadcastMessageToPlayer( player, message )
BroadCastMessageToPlayer( player, message )
end
function BroadcastSound( soundname )
BroadCastSound( soundname )
end
function BroadcastSoundToPlayer( player, soundname )
BroadCastSoundToPlayer( player, soundname )
end
-----------------------------------------------------------------------------
-- trigger_ff_script
-----------------------------------------------------------------------------
trigger_ff_script = baseclass:new({})
function trigger_ff_script:allowed() return EVENT_ALLOWED end
function trigger_ff_script:ontouch() end
function trigger_ff_script:ontrigger() end
function trigger_ff_script:onendtouch() end
function trigger_ff_script:onfailtouch() end
function trigger_ff_script:onexplode() return EVENT_ALLOWED end
function trigger_ff_script:onbuild() return EVENT_ALLOWED end
function trigger_ff_script:onfailuse() end
function trigger_ff_script:onuse() end
function trigger_ff_script:onactive() end
function trigger_ff_script:oninactive() end
function trigger_ff_script:onremoved() end
function trigger_ff_script:onrestored() end
function trigger_ff_script:spawn()
-- notify the bot if this is a goal type
local info = CastToTriggerScript(entity)
if(info ~= nil) then
if self.botgoaltype and self.team then
info:SetBotGoalInfo(self.botgoaltype, self.team)
end
end
end
-----------------------------------------------------------------------------
-- trigger_ff_clip
-----------------------------------------------------------------------------
trigger_ff_clip = baseclass:new({})
function trigger_ff_clip:spawn()
local clip = CastToTriggerClip(entity)
if (clip ~= nil) then
if self.clipflags then
clip:SetClipFlags(self.clipflags)
end
end
end
-----------------------------------------------------------------------------
-- func_button
-----------------------------------------------------------------------------
func_button = baseclass:new({})
function func_button:allowed() return true end
function func_button:ondamage() end
function func_button:ontouch() end
function func_button:onuse() end
function func_button:onfailuse() end
-----------------------------------------------------------------------------
-- info_ff_script
-----------------------------------------------------------------------------
info_ff_script = baseclass:new({ model = "models/items/healthkit.mdl" })
function info_ff_script:onreturn() end
function info_ff_script:ondrop() end
function info_ff_script:onownerdie() end
function info_ff_script:onownerforcerespawn() end
function info_ff_script:onownerfeign() end
function info_ff_script:onactive() end
function info_ff_script:oninactive() end
function info_ff_script:onremoved() end
function info_ff_script:onrestored() end
function info_ff_script:onexplode() end
function info_ff_script:dropatspawn() return false end
function info_ff_script:usephysics() return false end
function info_ff_script:hasshadow() return true end
-- anims must be named certain things...
function info_ff_script:hasanimation() return false end
-- For when this object is carried, these offsets are used to place
-- the info_ff_script relative to the objects GetAbsOrigin()
function info_ff_script:attachoffset()
local offset = Vector( 0, 0, 0 )
return offset
end
function info_ff_script:precache()
PrecacheModel(self.model)
end
function info_ff_script:spawn()
-- set model and skin
local info = CastToInfoScript( entity )
info:SetModel(self.model)
if self.modelskin then
info:SetSkin(self.modelskin)
end
-- setup touch flags
if self.touchflags ~= nil then info:SetTouchFlags(self.touchflags) end
if self.disallowtouchflags ~= nil then info:SetDisallowTouchFlags(self.disallowtouchflags) end
-- notify the bot if this is a goal type
if(info ~= nil) then
if self.botgoaltype then
info:SetBotGoalInfo(self.botgoaltype)
end
end
if self.renderfx ~= nil then
info:SetRenderFx(self.renderfx)
end
end
function info_ff_script:gettouchsize( mins, maxs ) end
function info_ff_script:getphysicssize( mins, maxs ) end
function info_ff_script:getbloatsize() return 12 end
-----------------------------------------------------------------------------
-- info_ff_teamspawn
-----------------------------------------------------------------------------
info_ff_teamspawn = baseclass:new({})
function info_ff_teamspawn:validspawn() return true end

833
maps/includes/base_ad.lua Normal file
View file

@ -0,0 +1,833 @@
-- base_ad.lua
-- Attack / Defend gametype
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay")
-----------------------------------------------------------------------------
-- globals
-----------------------------------------------------------------------------
if NUM_PHASES == nil then NUM_PHASES = 3; end
if INITIAL_ROUND_LENGTH == nil then INITIAL_ROUND_LENGTH = 90
POINTS_PER_CAPTURE = 25
POINTS_PER_PERIOD = 1
POSTCAP_TIMER = 2
if ATTACKERS == nil then ATTACKERS = Team.kBlue; end
if DEFENDERS == nil then DEFENDERS = Team.kRed; end
--if MAP_LENGTH == nil then MAP_LENGTH = 1436; end -- 23 minutes 56 seconds, 4 seconds less than the default timelimit of 24 minutes.
if ATTACKERS_OBJECTIVE_ENTITY == nil then ATTACKERS_OBJECTIVE_ENTITY = nil end
INITIAL_FUSE_TIMER = 80
BLOW_CP1_ROUTE_TIMER = 300
BLOW_CP2_ROUTE_TIMER = 780
allow_win = true
phase = 1
current_timer = 0
carried_by = nil
function startup( )
SetGameDescription( "Attack Defend" )
-- 4 seconds less than mp_timelimit, just as was the case when it was fixed (I assume it always takes 4 seconds to initialise?)
MAP_LENGTH = (60 * GetConvar( "mp_timelimit" )) - 4;
PERIOD_TIME = MAP_LENGTH * POINTS_PER_PERIOD / 100;
-- set up team limit
-- disable all teams
for i = Team.kBlue, Team.kGreen do
local team = GetTeam( i )
if i then
team:SetPlayerLimit( -1 )
end
end
-- then re-enable attackers/defenders
local team = GetTeam( ATTACKERS )
team:SetPlayerLimit( 0 )
team:SetClassLimit( Player.kCivilian, -1 )
local team = GetTeam( DEFENDERS )
team:SetPlayerLimit( 0 )
team:SetClassLimit( Player.kCivilian, -1 )
team:SetClassLimit(Player.kScout, -1)
-- Should this be map specific?
SetTeamName( ATTACKERS, "#FF_Attackers")
SetTeamName( DEFENDERS, "#FF_Defenders" )
-- start the timer for the points
AddScheduleRepeating( "addpoints", PERIOD_TIME, addpoints )
setup_door_timer( "cp1_gate", INITIAL_ROUND_LENGTH )
setup_map_timers()
allow_win = true
cp1_flag.enabled = true
cp1_flag.team = ATTACKERS
for i,v in ipairs({"cp1_flag", "cp2_flag", "cp3_flag"}) do
local flag = GetInfoScriptByName(v)
if flag then
flag:SetModel(_G[v].model)
flag:SetSkin(teamskins[ATTACKERS])
if i == 1 then
flag:Restore()
else
flag:Remove()
end
end
end
-- Remove future phase flags
flag_remove( "cp2_flag" )
flag_remove( "cp3_flag" )
-- add map initialise stuff. Needs to be done via lua for synchronisation
AddSchedule("blow_first_gate", INITIAL_FUSE_TIMER, blow_first_gate )
AddSchedule("blow_cp1_extra_route", BLOW_CP1_ROUTE_TIMER, blow_cp1_extra_route )
AddSchedule("blow_cp2_extra_route", BLOW_CP2_ROUTE_TIMER, blow_cp2_extra_route )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
UpdateTeamObjectiveIcon( GetTeam(ATTACKERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(DEFENDERS), ATTACKERS_OBJECTIVE_ENTITY )
end
function blow_first_gate( )
OutputEvent( "fuse01", "StartForward" ) -- delay of 80 secs
end
function blow_cp1_extra_route( )
OutputEvent( "cp1_extraroute", "Break" ) -- delay of 300 secs
end
function blow_cp2_extra_route( )
OutputEvent( "cp2_extraroute", "Break" ) -- delay of 780 secs
end
-----------------------------------------
-- Remove a flag by name
-----------------------------------------
function flag_remove( flag_name )
local flag = GetInfoScriptByName( flag_name )
if flag then
flag:Remove()
_G[flag_name].enabled = false
end
end
-----------------------------------------
-- Restore a flag by name
-----------------------------------------
function flag_restore( flag_name )
local flag = GetInfoScriptByName( flag_name )
if flag then
flag:Restore()
_G[flag_name].enabled = true
end
end
-----------------------------------------
--
-----------------------------------------
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 400 )
player:AddArmor( 400 )
-- Remove stuff
player:RemoveAmmo( Ammo.kNails, 400 )
player:RemoveAmmo( Ammo.kShells, 400 )
player:RemoveAmmo( Ammo.kRockets, 400 )
player:RemoveAmmo( Ammo.kCells, 400 )
player:RemoveAmmo( Ammo.kGren2, 4 )
-- Add items (similar to both teams)
player:AddAmmo( Ammo.kShells, 200 )
player:AddAmmo( Ammo.kRockets, 30 )
player:AddAmmo( Ammo.kNails, 200 )
-- Defenders get...
if player:GetTeamId() == DEFENDERS then
-- Player is at full armor now, so we can
-- easily reduce by some percent
-- but were not going to because
-- theres no reason to do so
-- player:RemoveArmor( ( player:GetArmor() * .25 ) )
player:RemoveAmmo( Ammo.kGren1, 4 )
player:AddAmmo( Ammo.kCells, 200 )
elseif player:GetTeamId() == ATTACKERS then
-- Attackers get...
player:AddAmmo( Ammo.kCells, 200 )
end
-- if player:GetTeamId() == ATTACKERS then
UpdateObjectiveIcon( player, ATTACKERS_OBJECTIVE_ENTITY )
-- elseif player:GetTeamId() == DEFENDERS then
-- UpdateObjectiveIcon( player, nil )
-- end
end
function addpoints( )
local team = GetTeam( DEFENDERS )
team:AddScore( POINTS_PER_PERIOD )
end
-----------------------------------------
-- base flag
-----------------------------------------
-- default
base_ad_flag = baseflag:new({
modelskin = teamskins[ATTACKERS],
name = "base_ad_flag",
team = ATTACKERS,
phase = 1,
hudicon = team_hudicons[ATTACKERS],
touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kGreen, AllowFlags.kYellow}
})
-- if ATTACKERS == Team.kRed then
-- ConsoleToAll("Setting up RED ATTACKERS FLAG")
-- base_ad_flag.hudicon = "hud_flag_red.vtf"
-- base_ad_flag.touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kRed}
-- elseif ATTACKERS == Team.kGreen then
-- ConsoleToAll("Setting up GREEN ATTACKERS FLAG")
-- base_ad_flag.hudicon = "hud_flag_green.vtf"
-- base_ad_flag.touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kGreen}
-- elseif ATTACKERS == Team.kBlue then
-- ConsoleToAll("Setting up BLUE ATTACKERS FLAG")
-- base_ad_flag.hudicon = "hud_flag_blue.vtf"
-- base_ad_flag.touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kBlue}
-- elseif ATTACKERS == Team.kYellow then
-- ConsoleToAll("Setting up Yellow ATTACKERS FLAG")
-- base_ad_flag.hudicon = "hud_flag_yellow.vtf"
-- base_ad_flag.touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kYellow}
-- end
end
function base_ad_flag:dropitemcmd( owner_entity )
-- DO NOTHING!
-- -- throw the flag
-- local flag = CastToInfoScript(entity)
-- flag:Drop(FLAG_RETURN_TIME, FLAG_THROW_SPEED)
--
-- if IsPlayer( owner_entity ) then
-- local player = CastToPlayer( owner_entity )
-- player:RemoveEffect( EF.kSpeedlua1 )
--
-- -- Remove any hud icons with identifier "base_ad_flag"
-- RemoveHudItem( player, "base_ad_flag" )
-- end
end
function base_ad_flag:touch( touch_entity )
-- should only respond to players
if (IsPlayer(touch_entity) == false) then
return
end
local player = CastToPlayer(touch_entity)
local teamId = player:GetTeamId()
-- pickup if they can
if self.notouch then
if self.notouch[player:GetId()] then return; end
end
if teamId == ATTACKERS and phase == self.phase then
if phase == 1 then
--BroadCastMessageToPlayer(player, "#FF_AD_TAKE1")
SmartMessage(player, "#FF_AD_TAKE1", "#FF_TEAMPICKUP", "#FF_OTHERTEAMPICKUP", Color.kGreen, Color.kGreen, Color.kRed)
elseif phase == 2 then
--BroadCastMessageToPlayer(player, "#FF_AD_TAKE2")
SmartMessage(player, "#FF_AD_TAKE2", "#FF_TEAMPICKUP", "#FF_OTHERTEAMPICKUP", Color.kGreen, Color.kGreen, Color.kRed)
else
--BroadCastMessageToPlayer(player, "#FF_AD_TAKE3")
SmartMessage(player, "#FF_AD_TAKE3", "#FF_TEAMPICKUP", "#FF_OTHERTEAMPICKUP", Color.kGreen, Color.kGreen, Color.kRed)
end
SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
RandomFlagTouchSpeak( player )
-- have player pick up the flag and lose his disguise (for spy class)
local flag = CastToInfoScript( entity )
if flag ~= nil then
flag:Pickup( player)
player:AddEffect( EF.kSpeedlua1, -1, 0, 0.65 )
player:SetDisguisable( false )
-- if the player is a spy, then force him to lose his cloak
player:SetCloakable( false )
self.hudicon = team_hudicons[ATTACKERS]
-- Add hud icon to show we're carrying the flag
AddHudIcon( player, self.hudicon, flag:GetName(), self.hudx, self.hudy, self.hudstatusiconw, self.hudstatusiconh, self.hudalign )
-- change objective icons
ATTACKERS_OBJECTIVE_ENTITY = player
UpdateTeamObjectiveIcon( GetTeam(ATTACKERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(DEFENDERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateObjectiveIcon( player, GetEntityByName( "cp"..self.phase.."_cap" ) )
LogLuaEvent(player:GetId(), 0, "flag_touch", "flag_name", flag:GetName(), "player_origin", (string.format("%0.2f",player:GetOrigin().x) .. ", " .. string.format("%0.2f",player:GetOrigin().y) .. ", " .. string.format("%0.1f",player:GetOrigin().z) ), "player_health", "" .. player:GetHealth());
-- show on the deathnotice board
--ObjectiveNotice( player, "grabbed the flag" )
carried_by = player:GetName()
destroy_return_timer()
update_hud()
end
end
end
function base_ad_flag:onownerdie( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
player:RemoveEffect( EF.kSpeedlua1 )
player:SetDisguisable( true )
player:SetCloakable( true )
-- Remove any hud icons with identifier "base_ad_flag"
RemoveHudItem( player, "base_ad_flag" )
-- drop the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, 0.0)
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
UpdateObjectiveIcon( player, nil )
UpdateTeamObjectiveIcon( GetTeam(ATTACKERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(DEFENDERS), ATTACKERS_OBJECTIVE_ENTITY )
-- remove flag icon from hud
RemoveHudItem( player, flag:GetName() )
RemoveHudItemFromAll( flag:GetName() .. "_c" )
AddHudIconToAll( self.hudstatusicondropped, ( flag:GetName() .. "_d" ), self.hudstatusiconx, self.hudstatusicony, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconalign )
self.status = 2
setup_return_timer()
update_hud()
end
end
function base_ad_flag:onreturn( )
-- let the teams know that the flag was returned
local team = GetTeam( self.team )
SmartTeamMessage(team, "#FF_TEAMRETURN", "#FF_OTHERTEAMRETURN", Color.kYellow, Color.kYellow)
SmartTeamSound(team, "yourteam.flagreturn", "otherteam.flagreturn")
SmartTeamSpeak(team, "CTF_FLAGBACK", "CTF_EFLAGBACK")
local flag = CastToInfoScript( entity )
RemoveHudItemFromAll( flag:GetName() .. "_d" )
RemoveHudItemFromAll( flag:GetName() .. "_c" )
AddHudIconToAll( self.hudstatusiconhome, ( flag:GetName() .. "_h" ), self.hudstatusiconx, self.hudstatusicony, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconalign )
self.status = 0
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
UpdateTeamObjectiveIcon( GetTeam(ATTACKERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(DEFENDERS), ATTACKERS_OBJECTIVE_ENTITY )
LogLuaEvent(0, 0, "flag_returned","flag_name",flag:GetName());
destroy_return_timer()
update_hud()
end
-----------------------------------------
-- base capture point
-----------------------------------------
base_ad_cap = basecap:new({
phase = 0,
doorname = "cp2_gate",
duration = 90,
team = ATTACKERS
})
function base_ad_cap:allowed ( allowed_entity )
if phase ~= self.phase then
return false
end
-- only respond to players
if ( IsPlayer( allowed_entity ) == false ) then
return false
end
if allow_win == false then
return false
end
local player = CastToPlayer( allowed_entity )
-- check if the player has the flag
for i,v in ipairs( self.item ) do
if player:HasItem( v ) then
player:RemoveEffect( EF.kSpeedlua1 )
-- Remove any hud icons with identifier "base_ad_flag"
RemoveHudItem( player, "base_ad_flag" )
return true
end
end
return false
end
function base_ad_cap:oncapture( player, item )
if phase == 1 then
map_cap1()
elseif phase == 2 then
map_cap2()
else
allow_win = false
map_attackers_win()
end
player:AddFortPoints(500, "#FF_FORTPOINTS_CAPTUREPOINT")
if self.closedoor then
CloseDoor(self.closedoor)
end
-- remove objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
UpdateTeamObjectiveIcon( GetTeam(ATTACKERS), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(DEFENDERS), ATTACKERS_OBJECTIVE_ENTITY )
-- Remove previous phase flag
flag_remove( item )
-- Delay for a couple seconds after the cap
AddSchedule( "cap_delay_timer", POSTCAP_TIMER, cap_delay_timer, self )
end
-----------------------------------------
-- waste a couple seconds before respawning/ending
-----------------------------------------
function cap_delay_timer( cap )
if phase == NUM_PHASES then
-- it's the last round. end and stuff
GoToIntermission()
RemoveSchedule( "addpoints" )
else
phase = phase + 1
-- setup double cap points for the last round
if phase == NUM_PHASES then
POINTS_PER_CAPTURE = POINTS_PER_CAPTURE * 2
end
-- Restore next flag
if phase == 2 then
flag_restore( "cp2_flag" )
elseif phase == 3 then
flag_restore( "cp3_flag" )
end
-- update objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
setup_door_timer( cap.doorname, cap.duration)
ApplyToAll( { AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips } )
end
end
function setup_door_timer( doorname, duration )
AddSchedule( "round_start", duration, round_start, doorname )
if duration > 65 then AddSchedule( "round_60secwarn", duration-60, round_60secwarn ) end
if duration > 35 then AddSchedule( "round_30secwarn", duration-30, round_30secwarn ) end
if duration > 15 then AddSchedule( "round_10secwarn", duration-10, round_10secwarn ) end
end
function round_start( doorname )
BroadCastMessage( "#FF_AD_GATESOPEN" )
BroadCastSound( "otherteam.flagstolen" )
SpeakAll( "AD_GATESOPEN" )
OpenDoor( doorname )
end
function round_60secwarn( )
BroadCastMessage( "#FF_ROUND_60SECWARN" )
end
function round_30secwarn( )
BroadCastMessage( "#FF_ROUND_30SECWARN" )
end
function round_10secwarn( )
BroadCastMessage( "#FF_ROUND_10SECWARN" )
end
----------------
-- map timers --
----------------
function setup_map_timers( )
local timelimit = MAP_LENGTH
AddSchedule( "map_10mintimer", timelimit-600, map_timewarn, 600 )
AddSchedule( "map_5mintimer", timelimit-300, map_timewarn, 300 )
AddSchedule( "map_2mintimer", timelimit-120, map_timewarn, 120 )
AddSchedule( "map_60sectimer", timelimit-60, map_timewarn, 60 )
AddSchedule( "map_30sectimer", timelimit-30, map_timewarn, 30 )
AddSchedule( "map_10sectimer", timelimit-10, map_timewarn, 10 )
AddSchedule( "map_9sectimer", timelimit-9, map_timewarn, 9 )
AddSchedule( "map_8sectimer", timelimit-8, map_timewarn, 8 )
AddSchedule( "map_7sectimer", timelimit-7, map_timewarn, 7 )
AddSchedule( "map_6sectimer", timelimit-6, map_timewarn, 6 )
AddSchedule( "map_5sectimer", timelimit-5, map_timewarn, 5 )
AddSchedule( "map_4sectimer", timelimit-4, map_timewarn, 4 )
AddSchedule( "map_3sectimer", timelimit-3, map_timewarn, 3 )
AddSchedule( "map_2sectimer", timelimit-2, map_timewarn, 2 )
AddSchedule( "map_1sectimer", timelimit-1, map_timewarn, 1 )
AddSchedule( "map_timer", timelimit, map_defenders_win )
end
function map_attackers_win( )
RemoveSchedule( "map_10mintimer" )
RemoveSchedule( "map_5mintimer" )
RemoveSchedule( "map_2mintimer" )
RemoveSchedule( "map_60sectimer" )
RemoveSchedule( "map_30sectimer" )
RemoveSchedule( "map_10sectimer" )
RemoveSchedule( "map_9sectimer" )
RemoveSchedule( "map_8sectimer" )
RemoveSchedule( "map_7sectimer" )
RemoveSchedule( "map_6sectimer" )
RemoveSchedule( "map_5sectimer" )
RemoveSchedule( "map_4sectimer" )
RemoveSchedule( "map_3sectimer" )
RemoveSchedule( "map_2sectimer" )
RemoveSchedule( "map_1sectimer" )
RemoveSchedule( "map_timer" )
BroadCastSound( "yourteam.flagcap" )
--BroadCastMessage("#FF_AD_" .. TeamName(ATTACKERS) .. "#FF_WIN")
BroadCastMessage( "#FF_AD_BLUEWIN" )
--SpeakAll( "AD_" .. TeamName( ATTACKERS ) .. "CAP".. TeamName( DEFENDERS ) )
SpeakAll( "AD_CAP" )
end
function map_defenders_win( )
if allow_win == false then
return false
end
--BroadCastSound("yourteam.flagcap")
BroadCastMessage("#FF_AD_REDWIN")
--SpeakAll( "AD_HOLD_" .. TeamName(DEFENDERS) )
SpeakAll( "AD_HOLD" )
allow_win = false
--Defenders wins, call Intermission!
phase = NUM_PHASES
RemoveSchedule( "addpoints" )
addpoints()
AddSchedule( "cap_delay_timer", POSTCAP_TIMER, cap_delay_timer, self )
end
function map_timewarn( time )
BroadCastMessage( "#FF_MAP_" .. time .. "SECWARN" )
SpeakAll( "AD_" .. time .. "SEC" )
end
function map_cap1( )
BroadCastSound( "yourteam.flagcap" )
BroadCastMessage( "#FF_AD_CAP1" )
SpeakAll( "AD_CP1" )
--SpeakAll("AD_CP1_" .. TeamName(ATTACKERS))
end
function map_cap2( )
BroadCastSound( "yourteam.flagcap" )
BroadCastMessage( "#FF_AD_CAP2" )
SpeakAll( "AD_CP2" )
--SpeakAll("AD_CP2_" .. TeamName(ATTACKERS))
end
function timer_schedule()
current_timer = current_timer -1
end
function setup_return_timer()
RemoveSchedule( "timer_tobase_schedule" )
current_timer = FLAG_RETURN_TIME
AddScheduleRepeatingNotInfinitely( "timer_return_schedule", 1, timer_schedule, current_timer)
end
function destroy_return_timer()
RemoveSchedule( "timer_return_schedule" )
end
-----------------------------------------
-- spawn info stuffs
-----------------------------------------
function start_allowedmethod( self, player_entity )
if ( IsPlayer( player_entity ) == false ) then
return false
end
local player = CastToPlayer( player_entity )
local teamId = player:GetTeamId( )
return (teamId == ATTACKERS and phase == 1)
end
function alpha_allowedmethod( self, player_entity )
if ( IsPlayer( player_entity ) == false ) then
return false
end
local player = CastToPlayer( player_entity )
local teamId = player:GetTeamId( )
return (teamId == ATTACKERS and phase == 2)
or (teamId == DEFENDERS and phase == 1)
end
function beta_allowedmethod( self, player_entity )
if ( IsPlayer( player_entity ) == false ) then
return false
end
local player = CastToPlayer( player_entity )
local teamId = player:GetTeamId( )
return (teamId == ATTACKERS and phase == 3)
or (teamId == DEFENDERS and phase == 2)
end
function final_allowedmethod( self, player_entity )
if ( IsPlayer( player_entity ) == false ) then
return false
end
local player = CastToPlayer( player_entity )
local teamId = player:GetTeamId( )
return (teamId == DEFENDERS and phase == 3)
end
-----------------------------------------
-- instanciate everything
-----------------------------------------
cp1_flag = base_ad_flag:new({ phase = 1 })
cp2_flag = base_ad_flag:new({ phase = 2 })
cp3_flag = base_ad_flag:new({ phase = 3 })
cp1_cap = base_ad_cap:new({ item={"cp1_flag"}, phase = 1, doorname = "cp2_gate", closedoor = "cp1_exit"})
cp2_cap = base_ad_cap:new({ item={"cp2_flag"}, phase = 2, doorname = "cp3_gate", closedoor = "cp2_exit"})
cp3_cap = base_ad_cap:new({ item={"cp3_flag"}, phase = 3, doorname = "", closedoor = "cp3_exit"})
start_door = respawndoor:new({allowed = start_allowedmethod})
start_spawn = {validspawn = start_allowedmethod}
alpha_door = respawndoor:new({allowed = alpha_allowedmethod})
alpha_spawn = {validspawn = alpha_allowedmethod}
beta_door = respawndoor:new({allowed = beta_allowedmethod})
beta_spawn = {validspawn = beta_allowedmethod}
final_door = respawndoor:new({allowed = final_allowedmethod})
final_spawn = {validspawn = final_allowedmethod}
------------------------------------------------
-- hud info
------------------------------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
local flag = GetInfoScriptByName("cp"..phase.."_flag")
local flagname = flag:GetName()
attackers = ATTACKERS
defenders = DEFENDERS
--RemoveHudItemFromAll( "background" )
--AddHudIconToAll( "hud_statusbar_256_128.vtf", "background", -64, 32, 128, 70, 3 )
RemoveHudItem( player, "cp_flag_c" )
RemoveHudItem( player, "cp_flag_d" )
RemoveHudItem( player, "cp_flag_h" )
RemoveHudItem( player, "flag_tobase_timer" )
RemoveHudItem( player, "flag_tobase_text" )
RemoveHudItem( player, "flag_return_timer" )
RemoveHudItem( player, "flag_return_text" )
RemoveHudItem( player, "flag_carried_by" )
RemoveHudItem( player, "flag_carried_by2" )
RemoveHudItem( player, "flag_athome" )
RemoveHudItem( player, "flag_athome2" )
if attackers == Team.kBlue then
hudstatusicondropped = "hud_flag_dropped_blue.vtf"
hudstatusiconhome = "hud_flag_home_blue.vtf"
hudstatusiconcarried = "hud_flag_carried_blue.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kRed then
hudstatusicondropped = "hud_flag_dropped_red.vtf"
hudstatusiconhome = "hud_flag_home_red.vtf"
hudstatusiconcarried = "hud_flag_carried_red.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
elseif attackers == Team.kYellow then
hudstatusicondropped = "hud_flag_dropped_yellow.vtf"
hudstatusiconhome = "hud_flag_home_yellow.vtf"
hudstatusiconcarried = "hud_flag_carried_yellow.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kGreen then
hudstatusicondropped = "hud_flag_dropped_green.vtf"
hudstatusiconhome = "hud_flag_home_green.vtf"
hudstatusiconcarried = "hud_flag_carried_green.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
end
flag_hudstatusiconx = 4
flag_hudstatusicony = 42
flag_hudstatusiconw = 15
flag_hudstatusiconh = 15
flag_hudstatusiconalign = 3
text_hudstatusx = 0
text_hudstatusy = flag_hudstatusicony + 24
text_hudstatusalign = 4
if _G[flagname].enabled == true then
if flag:IsCarried() then
AddHudText(player, "flag_carried_by", "#AD_FlagCarriedBy", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudText(player, "flag_carried_by2", carried_by, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIcon(player, hudstatusiconcarried, ( "cp_flag_c" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif flag:IsDropped() and _G[flagname].status == 2 then
AddHudText(player, "flag_return_text", "#AD_FlagReturn", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTimer(player, "flag_return_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIcon(player, hudstatusicondropped, ( "cp_flag_d" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif _G[flagname].status == 0 then
AddHudText(player, "flag_athome", "#AD_FlagIsAt", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudText(player, "flag_athome2", "#AD_ASpawn", text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIcon(player, hudstatusiconhome, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
end
RemoveHudItem( player, "Zone_Team"..attackers )
RemoveHudItem( player, "Zone_Team"..defenders )
RemoveHudItem( player, "Zone_Phase"..attackers )
RemoveHudItem( player, "Zone_Phase"..defenders )
od_hudstatusiconx = -28
od_hudstatusicony = 38
od_hudstatusiconw = 24
od_hudstatusiconh = 24
od_hudstatusiconalign = 3
if player:GetTeamId() == attackers then
AddHudIcon( player, "hud_offense.vtf", "Zone_Team"..attackers, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIcon( player, "hud_cp_"..phase..".vtf", "Zone_Phase"..attackers, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
else
AddHudIcon( player, "hud_defense.vtf", "Zone_Team"..defenders, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIcon( player, "hud_cp_"..phase..".vtf", "Zone_Phase"..defenders, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
end
end
function update_hud()
local flag = GetInfoScriptByName("cp"..phase.."_flag")
local flagname = flag:GetName()
attackers = ATTACKERS
defenders = DEFENDERS
--RemoveHudItemFromAll( "background" )
--AddHudIconToAll( "hud_statusbar_256_128.vtf", "background", -64, 32, 128, 70, 3 )
RemoveHudItemFromAll( "cp_flag_c" )
RemoveHudItemFromAll( "cp_flag_d" )
RemoveHudItemFromAll( "cp_flag_h" )
RemoveHudItemFromAll( "flag_tobase_timer" )
RemoveHudItemFromAll( "flag_tobase_text" )
RemoveHudItemFromAll( "flag_return_timer" )
RemoveHudItemFromAll( "flag_return_text" )
RemoveHudItemFromAll( "flag_carried_by" )
RemoveHudItemFromAll( "flag_carried_by2" )
RemoveHudItemFromAll( "flag_athome" )
RemoveHudItemFromAll( "flag_athome2" )
if attackers == Team.kBlue then
hudstatusicondropped = "hud_flag_dropped_blue.vtf"
hudstatusiconhome = "hud_flag_home_blue.vtf"
hudstatusiconcarried = "hud_flag_carried_blue.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kRed then
hudstatusicondropped = "hud_flag_dropped_red.vtf"
hudstatusiconhome = "hud_flag_home_red.vtf"
hudstatusiconcarried = "hud_flag_carried_red.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
elseif attackers == Team.kYellow then
hudstatusicondropped = "hud_flag_dropped_yellow.vtf"
hudstatusiconhome = "hud_flag_home_yellow.vtf"
hudstatusiconcarried = "hud_flag_carried_yellow.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kGreen then
hudstatusicondropped = "hud_flag_dropped_green.vtf"
hudstatusiconhome = "hud_flag_home_green.vtf"
hudstatusiconcarried = "hud_flag_carried_green.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
end
flag_hudstatusiconx = 4
flag_hudstatusicony = 42
flag_hudstatusiconw = 15
flag_hudstatusiconh = 15
flag_hudstatusiconalign = 3
text_hudstatusx = 0
text_hudstatusy = flag_hudstatusicony + 24
text_hudstatusalign = 4
if _G[flagname].enabled == true then
if flag:IsCarried() then
AddHudTextToAll("flag_carried_by", "#AD_FlagCarriedBy", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTextToAll("flag_carried_by2", carried_by, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIconToAll( hudstatusiconcarried, ( "cp_flag_c" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif flag:IsDropped() and _G[flagname].status == 2 then
AddHudTextToAll("flag_return_text", "#AD_FlagReturn", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTimerToAll("flag_return_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIconToAll( hudstatusicondropped, ( "cp_flag_d" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif _G[flagname].status == 0 then
AddHudTextToAll("flag_athome", "#AD_FlagIsAt", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTextToAll("flag_athome2", "#AD_ASpawn", text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIconToAll( hudstatusiconhome, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
else
AddHudTextToAll("flag_tobase_text", "#AD_FlagReturnBase", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTimerToAll("flag_tobase_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIconToAll(hudstatusicontobase, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
RemoveHudItemFromAll( "Zone_Team"..attackers )
RemoveHudItemFromAll( "Zone_Team"..defenders )
RemoveHudItemFromAll( "Zone_Phase"..attackers )
RemoveHudItemFromAll( "Zone_Phase"..defenders )
od_hudstatusiconx = -28
od_hudstatusicony = 38
od_hudstatusiconw = 24
od_hudstatusiconh = 24
od_hudstatusiconalign = 3
AddHudIconToTeam( GetTeam(attackers), "hud_offense.vtf", "Zone_Team"..attackers, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(attackers), "hud_cp_"..phase..".vtf", "Zone_Phase"..attackers, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(defenders), "hud_defense.vtf", "Zone_Team"..defenders, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(defenders), "hud_cp_"..phase..".vtf", "Zone_Phase"..defenders, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
end

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,457 @@
--[[
================================================================================================================
== base_chatcommands.lua
== -- Allows maps to use player chat as commands to perform
== -- various functions
================================================================================================================
== Instructions
== -- To add commands:
=~~ Code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
chatbase_addcommand( "commandname", "Command description", "command example" )
function chat_commandname( player, parameter1, parameter2, ... )
-- perform some task
end
=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
== -- The description and example parameters are both optional
== -- Do NOT put the command prefix in either the example or the commandname parameters
== -- The player parameter will always get sent to chat_commandname functions, but the others are optional
== -- Parameters are sent by players in this format !commandname param1 param2 ...
== --
== -- To add player settings:
=~~ Code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
chatbase_addplayersetting( "settingname", default_value, "Setting description" )
=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
== -- The description is optional
== --
== -- To get a setting value for a player:
=~~ Code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
chatbase_getplayersetting( player, "settingname" )
=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
== --
== -- To set a setting value for a player:
=~~ Code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
chatbase_setplayersetting( player, "settingname", value )
=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
== --
== -- Settings:
== -- -- The settings below should be copied, pasted, and altered into your maps .lua if you want to
== -- -- change any of them
================================================================================================================
]]--
-- chat command settings
CHAT_COMMAND_PREFIX = "!" -- Command prefix, all commands must start with this string
CHAT_COMMAND_HIDECHATSTRING = true -- Determines if the chat string is shown if it executes a command
CHAT_COMMAND_DISABLE_PERIODIC_NOTIFY = false -- If false, the server will notify players that chat commands
-- are enabled for the map ONLY IF non-default chat commands exist
CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT = 0 -- Number of times to repeat the notification (set to -1 for infinite)
CHAT_COMMAND_PERIODIC_NOTIFY_PERIOD = 60 -- Time between notifications (in seconds)
-- theme settings
-- 0 = orange 1 = blue 2 = red 3 = yellow 4 = green
-- 5 = white 6 = black 7 = gray 8 = purple 9 = teal
CHAT_COMMAND_COLOR_MAIN = 0 -- used most often
CHAT_COMMAND_COLOR_HIGHLIGHT1 = 5 -- used to emphasize something
CHAT_COMMAND_COLOR_HIGHLIGHT2 = 5 -- used to emphasize something
CHAT_COMMAND_COLOR_HIGHLIGHT3 = 5 -- used to emphasize something
CHAT_COMMAND_COLOR_ERROR = 2 -- used for error messages
-- chat command debug settings
CHAT_COMMAND_DEBUG = false
CHAT_COMMAND_DEBUG_PREFIX = "[lua-chatcommands] "
--[[
=====================================
== GLOBAL VARS
=====================================
== Do NOT edit these unless you know
== exactly what you're doing
=====================================
]]--
-- chat commands global table
chatbase_commands = {}
chatbase_players = {}
chatbase_settings = {}
chatbase_defaultcommands = {"help","disablenotify"}
--[[
=====================================
== CHAT COMMAND FUNCTIONS
=====================================
==
=====================================
]]--
-------------------------------------
-- Setup
-------------------------------------
function chatbase_addcommand( command, description, example )
chatbase_debug( "Adding command "..tostring(command).." with desc "..tostring(description).." and example "..tostring(example) )
chatbase_commands[command] = {}
chatbase_commands[command].description = description
chatbase_commands[command].example = example
end
function chatbase_addplayersetting( setting, default, description )
chatbase_debug( "Adding setting "..tostring(setting).." with default "..tostring(default).." and desc "..tostring(description) )
chatbase_settings[setting] = {}
chatbase_settings[setting].default = default
chatbase_settings[setting].description = description
end
-------------------------------------
-- Utilities
-------------------------------------
function chatbase_customcommandsexist()
-- check that non-default commands exist
chatbase_debug("Checking if custom commands exist")
local nondefexist = false
for command,values in pairs(chatbase_commands) do
local found = false
chatbase_debug("Checking command "..tostring(command))
for i,defcommand in pairs(chatbase_defaultcommands) do
chatbase_debug(" -> Against default command "..tostring(defcommand))
if defcommand == command then
chatbase_debug("Command "..tostring(command).." is default")
found = true
end
end
if not found then
chatbase_debug("Command "..tostring(command).." is not default")
nondefexist = true
break;
end
end
chatbase_debug("Custom commands exist: "..tostring(nondefexist))
return nondefexist;
end
-------------------------------------
-- Notifications
-------------------------------------
function chatbase_setupnotify()
chatbase_debug("setupnotify called")
-- if notifications are completely disabled, return early
if CHAT_COMMAND_DISABLE_PERIODIC_NOTIFY then return end
chatbase_debug("setupnotify got past disabled check")
-- if only default commands exist, then theres no reason to notify
if not chatbase_customcommandsexist() then return end
chatbase_debug("setupnotify got past custom commands check")
-- call a function that will notify anyone that meets the requirements every NOTIFY_PERIOD
AddScheduleRepeating( "chatbase_notifyenabled", CHAT_COMMAND_PERIODIC_NOTIFY_PERIOD, chatbase_notifyenabled )
end
-- wait 10 seconds to setup notification, just to be safe that all commands are registered
AddSchedule("chatbase_setupnotify", 10, chatbase_setupnotify)
function chatbase_notifyenabled()
chatbase_debug("notifyenabled called")
-- if notifications are completely disabled, return early
if CHAT_COMMAND_DISABLE_PERIODIC_NOTIFY then return end
chatbase_debug("notifyenabled got past disabled check")
-- if only default commands exist, then theres no reason to notify
if not chatbase_customcommandsexist() then return end
chatbase_debug("notifyenabled got past custom commands check")
-- notify any players that deserve it
for i,v in pairs(chatbase_players) do
chatbase_debug("checking player ID "..i)
local player = CastToPlayer(v.player)
if IsPlayer(player) then
chatbase_debug("--> IsPlayer")
-- only notify if they havent set their setting to disable notifications
if v.settings["disablenotify"] ~= true then
chatbase_debug("--> disablenotify not true | REPEAT: "..CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT.." numtimesnotified: "..tostring(v.settings["numtimesnotified"]))
-- check repeat type
if CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT == 0 and v.settings["numtimesnotified"] == 0 then
-- only show once
v.settings["numtimesnotified"] = v.settings["numtimesnotified"]+1
chatbase_notifyplayer(player)
end
if CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT > 0 and v.settings["numtimesnotified"] <= CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT then
-- repeat a set number of times
v.settings["numtimesnotified"] = v.settings["numtimesnotified"]+1
chatbase_notifyplayer(player)
end
if CHAT_COMMAND_PERIODIC_NOTIFY_REPEAT < 0 then
-- repeat infinitely (var is set to a negative number)
v.settings["numtimesnotified"] = v.settings["numtimesnotified"]+1
chatbase_notifyplayer(player)
end
end
end
end
end
function chatbase_notifyplayer(player)
if not IsPlayer(player) then chatbase_error("function chatbase_notifyplayer: Notifying a nonplayer"); return; end
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Chat commands are enabled for this map. Type "..CHAT_COMMAND_PREFIX.."help to see what is available")
end
-------------------------------------
-- Player Table Functions
-------------------------------------
function chatbase_addplayer(player)
if not IsPlayer(player) then chatbase_error("function chatbase_addplayer: Trying to add a nonplayer"); return; end
-- add an entry for the player
chatbase_players[player:GetId()] = {}
chatbase_players[player:GetId()].player = player
chatbase_players[player:GetId()].settings = {}
for setting,values in pairs(chatbase_settings) do
chatbase_players[player:GetId()].settings[setting] = values.default
end
end
function chatbase_removeplayer(player)
-- param could be a player or a playerid
if tonumber(player) then player = GetPlayerByID(player) end
if not IsPlayer(player) then chatbase_error("function chatbase_removeplayer: Trying to remove a nonplayer"); return; end
-- clear their entry
chatbase_players[player:GetId()] = nil
end
-------------------------------------
-- Player Settings Functions
-------------------------------------
function chatbase_getplayersetting( player, setting )
-- param could be a player or a playerid
if tonumber(player) then player = GetPlayerByID(player) end
if not IsPlayer(player) then chatbase_error("function chatbase_getplayersetting: Trying to get setting of a nonplayer"); return nil; end
if chatbase_players[player:GetId()] ~= nil then
return chatbase_players[player:GetId()].settings[setting]
else
chatbase_error("function chatbase_getplayersetting: Player not found in the table");
return nil
end
end
function chatbase_setplayersetting( player, setting, value )
-- param could be a player or a playerid
if tonumber(player) then player = GetPlayerByID(player) end
if not IsPlayer(player) then chatbase_error("function chatbase_setplayersetting: Trying to set setting of a nonplayer"); return false; end
if chatbase_players[player:GetId()] ~= nil then
chatbase_players[player:GetId()].settings[setting] = value;
return true
else
chatbase_error("function chatbase_setplayersetting: Player not found in the table");
return false
end
end
-------------------------------------
-- Debug/Messaging
-------------------------------------
function chatbase_error( str )
ConsoleToAll(CHAT_COMMAND_DEBUG_PREFIX.."[ERROR] "..str)
end
function chatbase_debug( str )
if CHAT_COMMAND_DEBUG then ConsoleToAll(CHAT_COMMAND_DEBUG_PREFIX..str) end
end
--[[
=====================================
== DEFAULT COMMAND IMPLEMENTATION
=====================================
==
=====================================
]]--
chatbase_addcommand( "help", "Display a list of all available commands" )
function chat_help( player )
ChatToPlayer( player, "^"..CHAT_COMMAND_COLOR_MAIN.."Chat Commands:")
for command,values in pairs(chatbase_commands) do
local command_text = "^"..CHAT_COMMAND_COLOR_HIGHLIGHT1..CHAT_COMMAND_PREFIX..command
if values.description ~= nil then
command_text = command_text.. " ^"..CHAT_COMMAND_COLOR_MAIN.."- ".."^"..CHAT_COMMAND_COLOR_HIGHLIGHT2..values.description
end
if values.example ~= nil then
command_text = command_text.. " ^"..CHAT_COMMAND_COLOR_MAIN.."(example: "..CHAT_COMMAND_PREFIX..values.example..")"
end
ChatToPlayer( player, command_text )
end
end
if not CHAT_COMMAND_DISABLE_PERIODIC_NOTIFY then
chatbase_addcommand( "disablenotify", "Disables the periodic notification that chat commands are enabled" )
function chat_disablenotify( player )
chatbase_setplayersetting( player, "disablenotify", true )
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_MAIN.."Periodic \"chat commands are enabled\" notifications disabled")
end
end
--[[
=====================================
== DEFAULT SETTING IMPLEMENTATION
=====================================
==
=====================================
]]--
chatbase_addplayersetting( "disablenotify", false, "Disables periodic notifications that chat commands are enabled" )
chatbase_addplayersetting( "numtimesnotified", 0, "Number of times the player has been notified that chat commands are enabled" )
--[[
=====================================
== CALLBACKS
=====================================
==
=====================================
]]--
-- player_onchat()
---- handle chat commands
-- save parent player_onchat
local base_player_onchat = player_onchat
function player_onchat( player, chatstring )
-- call parent onchat function if it exists
if base_player_onchat ~= nil then base_player_onchat(player,chatstring) end
local player = CastToPlayer( player )
-- string.gsub call removes all control characters (newlines, return carriages, etc)
-- string.sub call removes the playername: part of the string, leaving just the message
local message = string.sub( string.gsub( chatstring, "%c", "" ), string.len(player:GetName())+3 )
chatbase_debug("Message: "..message)
local prefix = string.sub(message,1,string.len(CHAT_COMMAND_PREFIX))
chatbase_debug("Prefix: "..prefix)
-- if the first character of the string doesn't match the prefix, then we don't care about it
if prefix ~= CHAT_COMMAND_PREFIX then return true; end
-- strip the prefix character
message = string.sub( message, 1+string.len(CHAT_COMMAND_PREFIX) )
chatbase_debug("Message: "..message)
-- if there is no message at all, return
if string.match(message, "%a+") == nil then return true end
-- get command and parameters
local command = string.lower( string.match(message, "%a+") )
local paramstring = string.sub(message, string.len(command)+2)
local params = explode(" ", paramstring)
-- loop through all params and convert any numbers to actual numbers
for i,param in pairs(params) do
-- tonumber() returns nil if it can't convert to a number
if tonumber(param) ~= nil then
param = tonumber(param)
end
chatbase_debug(" Param "..i..": "..param)
end
-- insert the player as the first param always
table.insert( params, 1, player )
-- find function to call
local func, finderror = findfunction("chat_"..command)
if func ~= nil then
if CHAT_COMMAND_DEBUG then ConsoleToAll(CHAT_COMMAND_DEBUG_PREFIX.."Function for "..command.." found"); end
-- translates to chat_<command>( <arg1>, <arg2>, ... ) e.g. chat_help() or chat_set( "varname", 5 )
func(unpack(params))
else
ChatToPlayer(player, "^"..CHAT_COMMAND_COLOR_ERROR.."Unexpected error while executing command")
chat_error("Command function find error for "..command.."("..paramstring.."):".. finderror)
return true
end
if CHAT_COMMAND_HIDECHATSTRING then
return false
else
return true
end
end
-- player_connected()
---- keep track of players
-- save parent player_connected
local base_player_connected = player_connected
function player_connected( player )
-- call parent onchat function if it exists
if base_player_connected ~= nil then base_player_connected(player) end
local player = CastToPlayer( player )
chatbase_addplayer( player )
end
-- player_disconnected()
---- keep track of players
-- save parent player_disconnected
local base_player_disconnected = player_disconnected
function player_disconnected( player )
-- call parent onchat function if it exists
if base_player_disconnected ~= nil then base_player_disconnected(player) end
local player = CastToPlayer( player )
chatbase_removeplayer( player )
end
--[[
=====================================
== HELPERS
=====================================
==
=====================================
]]--
-- Find a function with the given string name in the global table
function findfunction(x)
assert(type(x) == "string")
local f=_G
for v in x:gmatch("[^%.]+") do
if type(f) ~= "table" then
return nil, "looking for '"..v.."' expected table, not "..type(f)
end
f=f[v]
end
if type(f) == "function" then
return f
else
return nil, "expected function, not "..type(f)
end
end
-- Explode a string by the given divider
function explode(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
-- for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
pos = sp + 1 -- Jump past current divider
end
table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
return arr
end

1620
maps/includes/base_cp.lua Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,234 @@
-- base_cp_default.lua
-- if you want to customize these base cp defaults, copy all of this file's contents
-- into your map's lua file, edit what you want, and then include base_cp.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay")
IncludeScript("base_location")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- globals
-----------------------------------------------------------------------------
-- teams
TEAM1 = Team.kBlue
TEAM2 = Team.kRed
DISABLED_TEAM3 = Team.kYellow
DISABLED_TEAM4 = Team.kGreen
teams = { TEAM1, TEAM2 }
disabled_teams = { DISABLED_TEAM3, DISABLED_TEAM4 }
team_info = {
[Team.kUnassigned] = {
team_name = "neutral",
enemy_team = Team.kUnassigned,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen },
skybeam_color = "128 128 128",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 1,
skin = "0",
flag_visibility = "TurnOff",
cc_touch_count = 0,
ccalarmicon = "hud_secdown.vtf", ccalarmiconx = 0, ccalarmicony = 0, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 2,
detcc_sentence = "HTD_DOORS",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
},
[TEAM1] = {
team_name = "blue",
enemy_team = TEAM2,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue },
skybeam_color = "64 64 255",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 2,
skin = "0",
flag_visibility = "TurnOn",
cc_touch_count = 0,
ccalarmicon = "hud_secup_blue.vtf", ccalarmiconx = 60, ccalarmicony = 5, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 2,
detcc_sentence = "CZ_BCC_DET",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
},
[TEAM2] = {
team_name = "red",
enemy_team = TEAM1,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kRed },
skybeam_color = "255 64 64",
respawnbeam_color = { [0] = 100, [1] = 100, [2] = 100 },
color_index = 0,
skin = "1",
flag_visibility = "TurnOn",
cc_touch_count = 0,
ccalarmicon = "hud_secup_red.vtf", ccalarmiconx = 60, ccalarmicony = 5, ccalarmiconwidth = 16, ccalarmiconheight = 16, ccalarmiconalign = 3,
detcc_sentence = "CZ_RCC_DET",
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = -1,
}
}
}
-- command points
CP_COUNT = 5
command_points = {
[1] = { cp_number = 1, defending_team = Team.kUnassigned, cap_requirement = { [TEAM1] = 1000, [TEAM2] = 1000 }, cap_status = { [TEAM1] = 0, [TEAM2] = 0 }, cap_speed = { [TEAM1] = 0, [TEAM2] = 0 }, next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 }, delay_before_retouch = { [TEAM1] = 4.0, [TEAM2] = 4.0 }, touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, point_value = { [TEAM1] = 1, [TEAM2] = 5 }, score_timer_interval = { [TEAM1] = 30.00, [TEAM2] = 15.00 }, hudstatusicon = "hud_cp_1.vtf", hudposx = -40, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[2] = { cp_number = 2, defending_team = Team.kUnassigned, cap_requirement = { [TEAM1] = 1000, [TEAM2] = 1000 }, cap_status = { [TEAM1] = 0, [TEAM2] = 0 }, cap_speed = { [TEAM1] = 0, [TEAM2] = 0 }, next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 }, delay_before_retouch = { [TEAM1] = 4.0, [TEAM2] = 4.0 }, touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, point_value = { [TEAM1] = 2, [TEAM2] = 4 }, score_timer_interval = { [TEAM1] = 26.25, [TEAM2] = 18.75 }, hudstatusicon = "hud_cp_2.vtf", hudposx = -20, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[3] = { cp_number = 3, defending_team = Team.kUnassigned, cap_requirement = { [TEAM1] = 1000, [TEAM2] = 1000 }, cap_status = { [TEAM1] = 0, [TEAM2] = 0 }, cap_speed = { [TEAM1] = 0, [TEAM2] = 0 }, next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 }, delay_before_retouch = { [TEAM1] = 4.0, [TEAM2] = 4.0 }, touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, point_value = { [TEAM1] = 3, [TEAM2] = 3 }, score_timer_interval = { [TEAM1] = 22.50, [TEAM2] = 22.50 }, hudstatusicon = "hud_cp_3.vtf", hudposx = 0, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[4] = { cp_number = 4, defending_team = Team.kUnassigned, cap_requirement = { [TEAM1] = 1000, [TEAM2] = 1000 }, cap_status = { [TEAM1] = 0, [TEAM2] = 0 }, cap_speed = { [TEAM1] = 0, [TEAM2] = 0 }, next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 }, delay_before_retouch = { [TEAM1] = 4.0, [TEAM2] = 4.0 }, touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, point_value = { [TEAM1] = 4, [TEAM2] = 2 }, score_timer_interval = { [TEAM1] = 18.75, [TEAM2] = 26.25 }, hudstatusicon = "hud_cp_4.vtf", hudposx = 20, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 },
[CP_COUNT] = { cp_number = 5, defending_team = Team.kUnassigned, cap_requirement = { [TEAM1] = 1000, [TEAM2] = 1000 }, cap_status = { [TEAM1] = 0, [TEAM2] = 0 }, cap_speed = { [TEAM1] = 0, [TEAM2] = 0 }, next_cap_zone_timer = { [TEAM1] = 0, [TEAM2] = 0 }, delay_before_retouch = { [TEAM1] = 4.0, [TEAM2] = 4.0 }, touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, former_touching_players = { [TEAM1] = Collection(), [TEAM2] = Collection() }, point_value = { [TEAM1] = 5, [TEAM2] = 1 }, score_timer_interval = { [TEAM1] = 15.00, [TEAM2] = 30.00 }, hudstatusicon = "hud_cp_5.vtf", hudposx = 40, hudposy = 56, hudalign = 4, hudwidth = 16, hudheight = 16 }
}
-- scoring
POINTS_FOR_COMPLETE_CONTROL = 100
CC_DESTROY_POINTS = 15
-- zones
CAP_ZONE_TIMER_INTERVAL = 0.2
CAP_ZONE_NOTOUCH_SPEED = 10
PLAYER_TOUCHING_CP_ZONE = {}
ENTITY_TOUCHING_CC = {}
-- flags
ENABLE_FLAGS = false
FLAG_CARRIER_SPEED = 0.75
FLAG_RETURN_TIME = 0
flags = { team_info[TEAM1].team_name .. "_flag", team_info[TEAM2].team_name .. "flag" }
-- teleporting
ENABLE_CC_TELEPORTERS = true
ENABLE_CP_TELEPORTERS = true
-- command center
ENABLE_CC = true
-- complete control
ENABLE_COMPLETE_CONTROL_POINTS = true
ENABLE_COMPLETE_CONTROL_RESET = true
ENABLE_COMPLETE_CONTROL_RESPAWN = true
COMPLETE_CONTROL_RESPAWN_DELAY = 1
-- door names (prefixes will automatically be added based on the trigger's team)
doors = { "_flagroom_door_top" , "_flagroom_door_bottom", "_base_door_01_left", "_base_door_01_right", "_base_door_02_left", "_base_door_02_right" }
-- cp capture sounds
good_cap_sounds = {
[1] = "CZ_GOTCP1",
[2] = "CZ_GOTCP2",
[3] = "CZ_GOTCP3",
[4] = "CZ_GOTCP4",
[5] = "CZ_GOTCP5"
}
bad_cap_sounds = {
[1] = "CZ_LOSTCP1",
[2] = "CZ_LOSTCP2",
[3] = "CZ_LOSTCP3",
[4] = "CZ_LOSTCP4",
[5] = "CZ_LOSTCP5"
}
-- cp status background icons
icons = {
[TEAM1] = { teamicon = "hud_cp_" .. team_info[TEAM1].team_name .. ".vtf", lockicon = "hud_cp_locked.vtf" },
[TEAM2] = { teamicon = "hud_cp_" .. team_info[TEAM2].team_name .. ".vtf", lockicon = "hud_cp_locked.vtf" },
[Team.kUnassigned] = { teamicon = "hud_cp_neutral.vtf" }
}
-- cp cap status icons
cp_zone_icons = {
[TEAM1] = { hudicon = "hud_flag_" .. team_info[TEAM1].team_name .. ".vtf", hudx = 5, hudy = 162, hudwidth = 48, hudheight = 48, hudalign = 1, hudposy_offset = -20 },
[TEAM2] = { hudicon = "hud_flag_" .. team_info[TEAM2].team_name .. ".vtf", hudx = 5, hudy = 162, hudwidth = 48, hudheight = 48, hudalign = 1, hudposy_offset = 20 }
}
-- All of the CP ammo and armor (mainly used for removing all ammo and armor when command points reset)
cp_ammo_and_armor_names = {
"cp_cp1_ammo",
"cp_cp2_ammo",
"cp_cp3_ammo",
"cp_cp4_ammo",
"cp_cp5_ammo",
-- backwards compatiblity - use "cp_*" names in your map instead!
"cz2_cp1_ammo",
"cz2_cp2_ammo",
"cz2_cp3_ammo",
"cz2_cp4_ammo",
"cz2_cp5_ammo",
"cp_cp1_armor",
"cp_cp2_armor",
"cp_cp3_armor",
"cp_cp4_armor",
"cp_cp5_armor",
-- backwards compatiblity - use "cp_*" names in your map instead!
"cz2_cp1_armor",
"cz2_cp2_armor",
"cz2_cp3_armor",
"cz2_cp4_armor",
"cz2_cp5_armor",
}
cap_resupply = {
health = 100,
armor = 100,
nails = 100,
shells = 100,
cells = 100,
grenades = 50,
rockets = 50,
detpacks = 0,
mancannons = 1,
gren1 = 2,
gren2 = 1
}

File diff suppressed because it is too large Load diff

151
maps/includes/base_ctf.lua Normal file
View file

@ -0,0 +1,151 @@
-- base_ctf.lua
-- Capture the flag gametype
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
-----------------------------------------------------------------------------
-- entities
-----------------------------------------------------------------------------
-- hudalign and hudstatusiconalign : 0 = HUD_LEFT, 1 = HUD_RIGHT, 2 = HUD_CENTERLEFT, 3 = HUD_CENTERRIGHT
-- (pixels from the left / right of the screen / left of the center of the screen / right of center of screen,
-- AfterShock
blue_flag = baseflag:new({team = Team.kBlue,
modelskin = 0,
name = "Blue Flag",
hudicon = "hud_flag_blue_new.vtf",
hudx = 5,
hudy = 80,
hudwidth = 70,
hudheight = 70,
hudalign = 1,
hudstatusicondropped = "hud_flag_dropped_blue.vtf",
hudstatusiconhome = "hud_flag_home_blue.vtf",
hudstatusiconcarried = "hud_flag_carried_blue.vtf",
hudstatusiconx = 60,
hudstatusicony = 5,
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconalign = 2,
objectiveicon = true,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kRed,AllowFlags.kYellow,AllowFlags.kGreen}})
red_flag = baseflag:new({team = Team.kRed,
modelskin = 1,
name = "Red Flag",
hudicon = "hud_flag_red_new.vtf",
hudx = 5,
hudy = 150,
hudwidth = 70,
hudheight = 70,
hudalign = 1,
hudstatusicondropped = "hud_flag_dropped_red.vtf",
hudstatusiconhome = "hud_flag_home_red.vtf",
hudstatusiconcarried = "hud_flag_carried_red.vtf",
hudstatusiconx = 60,
hudstatusicony = 5,
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconalign = 3,
objectiveicon = true,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue,AllowFlags.kYellow,AllowFlags.kGreen}})
yellow_flag = baseflag:new({team = Team.kYellow,
modelskin = 2,
name = "Yellow Flag",
hudicon = "hud_flag_yellow_new.vtf",
hudx = 5,
hudy = 220,
hudwidth = 70,
hudheight = 70,
hudalign = 1,
hudstatusicondropped = "hud_flag_dropped_yellow.vtf",
hudstatusiconhome = "hud_flag_home_yellow.vtf",
hudstatusiconcarried = "hud_flag_carried_yellow.vtf",
hudstatusiconx = 53,
hudstatusicony = 25,
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconalign = 2,
objectiveicon = true,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue,AllowFlags.kRed,AllowFlags.kGreen} })
green_flag = baseflag:new({team = Team.kGreen,
modelskin = 3,
name = "Green Flag",
hudicon = "hud_flag_green_new.vtf",
hudx = 5,
hudy = 290,
hudwidth = 70,
hudheight = 70,
hudalign = 1,
hudstatusicondropped = "hud_flag_dropped_green.vtf",
hudstatusiconhome = "hud_flag_home_green.vtf",
hudstatusiconcarried = "hud_flag_carried_green.vtf",
hudstatusiconx = 53,
hudstatusicony = 25,
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconalign = 3,
objectiveicon = true,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue,AllowFlags.kRed,AllowFlags.kYellow} })
-- red cap point
red_cap = basecap:new({team = Team.kRed,
item = {"blue_flag","yellow_flag","green_flag"}})
-- blue cap point
blue_cap = basecap:new({team = Team.kBlue,
item = {"red_flag","yellow_flag","green_flag"}})
-- yellow cap point
yellow_cap = basecap:new({team = Team.kYellow,
item = {"blue_flag","red_flag","green_flag"}})
-- green cap point
green_cap = basecap:new({team = Team.kGreen,
item = {"blue_flag","red_flag","yellow_flag"}})
-----------------------------------------------------------------------------
-- map handlers
-----------------------------------------------------------------------------
function startup()
SetGameDescription( "Capture the Flag" )
-- set up team limits on each team
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
end
function precache()
-- precache sounds
PrecacheSound("yourteam.flagstolen")
PrecacheSound("otherteam.flagstolen")
PrecacheSound("yourteam.flagcap")
PrecacheSound("otherteam.flagcap")
PrecacheSound("yourteam.drop")
PrecacheSound("otherteam.drop")
PrecacheSound("yourteam.flagreturn")
PrecacheSound("otherteam.flagreturn")
end
--flaginfo runs whenever the player spawns or uses the flaginfo command.
--Right now it just refreshes the HUD items; this ensures that players who just joined the server have the right information
function flaginfo( player_entity )
flaginfo_base(player_entity) --see base_teamplay.lua
end

View file

@ -0,0 +1,34 @@
-- base_ctf4.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_ctf")
-----------------------------------------------------------------------------
-- map level handlers
-----------------------------------------------------------------------------
function startup()
SetGameDescription( "4-way CTF" )
-- set up team limits
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, 0)
SetPlayerLimit(Team.kGreen, 0)
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
end
--flaginfo runs whenever the player spawns or uses the flaginfo command.
--Right now it just refreshes the HUD items; this ensures that players who just joined the server have the right information
function flaginfo( player_entity )
flaginfo_base(player_entity) --see base_teamplay.lua
end

View file

@ -0,0 +1,689 @@
-- base_fortball.lua
-- if you want base fortball with the default setup,
-- include base_fortball_default.lua in your map's lua file
-- and then include base_fortball.lua
-- precache (sounds)
function precache()
PrecacheSound("misc.bizwarn")
PrecacheSound("misc.bloop")
PrecacheSound("misc.buzwarn")
PrecacheSound("misc.dadeda")
PrecacheSound("misc.deeoo")
PrecacheSound("misc.doop")
PrecacheSound("misc.woop")
PrecacheSound("otherteam.flagstolen")
PrecacheSound("yourteam.flagcap")
PrecacheSound("otherteam.flagcap")
-- Unagi Power! Unagi!
PrecacheSound("misc.unagi_spatial")
-- goalie sounds
--PrecacheSound( goalie_sound_loop )
--PrecacheSound( goalie_sound_idle )
--PrecacheSound( goalie_sound_pain )
--PrecacheSound( goalie_sound_kill )
end
function startup()
SetGameDescription( "Fortball" )
-- disable certain teams
for i,v in pairs(disabled_teams) do
SetPlayerLimit( v, -1 )
end
-- set up team limits
for i1,v1 in pairs(teams) do
local team = GetTeam(v1)
for i2,v2 in ipairs(team_info[team:GetTeamId()].class_limits) do
team:SetClassLimit( i2, v2 )
end
end
local ball = GetEntityByName( "ball" )
for i,v in pairs(teams) do
objective_entities[v] = ball
end
the_wall_reset()
end
function the_wall_reset()
OutputEvent( "the_wall", "Enable" )
OutputEvent( "the_wall_laser_blue", "TurnOn" )
OutputEvent( "the_wall_laser_red", "TurnOn" )
AddSchedule("the_wall_disable", THE_WALL_TIMER_DISABLE, the_wall_disable )
AddSchedule("the_wall_10secwarn", THE_WALL_TIMER_WARN, the_wall_10secwarn )
end
function the_wall_disable()
OutputEvent( "the_wall", "Disable" )
OutputEvent( "the_wall_laser_blue", "TurnOff" )
OutputEvent( "the_wall_laser_red", "TurnOff" )
BroadCastMessage("#FF_ROUND_STARTED")
BroadCastSound("otherteam.flagstolen")
end
function the_wall_10secwarn()
BroadCastMessage("#FF_MAP_10SECWARN")
AddSchedule("the_wall_9secwarn", 1, the_wall_9secwarn )
end
function the_wall_9secwarn()
BroadCastMessage("#FF_MAP_9SECWARN")
AddSchedule("the_wall_8secwarn", 1, the_wall_8secwarn )
end
function the_wall_8secwarn()
BroadCastMessage("#FF_MAP_8SECWARN")
AddSchedule("the_wall_7secwarn", 1, the_wall_7secwarn )
end
function the_wall_7secwarn()
BroadCastMessage("#FF_MAP_7SECWARN")
AddSchedule("the_wall_6secwarn", 1, the_wall_6secwarn )
end
function the_wall_6secwarn()
BroadCastMessage("#FF_MAP_6SECWARN")
AddSchedule("the_wall_5secwarn", 1, the_wall_5secwarn )
end
function the_wall_5secwarn()
BroadCastMessage("#FF_MAP_5SECWARN")
SpeakAll( "AD_5SEC" )
AddSchedule("the_wall_4secwarn", 1, the_wall_4secwarn )
end
function the_wall_4secwarn()
BroadCastMessage("#FF_MAP_4SECWARN")
SpeakAll( "AD_4SEC" )
AddSchedule("the_wall_3secwarn", 1, the_wall_3secwarn )
end
function the_wall_3secwarn()
BroadCastMessage("#FF_MAP_3SECWARN")
SpeakAll( "AD_3SEC" )
AddSchedule("the_wall_2secwarn", 1, the_wall_2secwarn )
end
function the_wall_2secwarn()
BroadCastMessage("#FF_MAP_2SECWARN")
SpeakAll( "AD_2SEC" )
AddSchedule("the_wall_1secwarn", 1, the_wall_1secwarn )
end
function the_wall_1secwarn()
BroadCastMessage("#FF_MAP_1SECWARN")
SpeakAll( "AD_1SEC" )
end
function goalie_bounds_notification(player)
BroadCastSoundToPlayer( player, "misc.buzwarn" )
BroadCastMessageToPlayer(player, "#FF_WATERPOLO_GOALIE_BOUNDS")
end
function reset_ball_carrier()
if ball_carrier ~= nil and IsPlayer( ball_carrier ) then
local player = CastToPlayer(ball_carrier)
UpdateObjectiveIcon( player, objective_entities[player:GetTeamId()] )
if not BALL_ALWAYS_ENEMY_OBJECTIVE then
local enemy_team = team_info[player:GetTeamId()].enemy_team
objective_entities[enemy_team] = GetEntityByName( "ball" )
UpdateTeamObjectiveIcon( GetTeam(enemy_team), objective_entities[enemy_team] )
end
end
ball_carrier = nil
end
-- Give everyone a full resupply, but strip grenades
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
-- god damn right
player:RemoveAmmo( Ammo.kDetpack, 1 )
player:RemoveAmmo( Ammo.kManCannon, 1 )
player:RemoveAmmo( Ammo.kGren1, 4 )
player:RemoveAmmo( Ammo.kGren2, 4 )
-- goalies run fast
if player:GetClass() ~= Player.kCivilian then
player:RemoveEffect( EF.kSpeedlua1 )
else
player:AddEffect( EF.kSpeedlua1, -1, 0, GOALIE_SPEED )
-- stop the goalie loop sound
--player:StopSound( goalie_sound_loop )
-- play the goalie loop sound
--player:EmitSound( goalie_sound_loop )
end
-- objective
UpdateObjectiveIcon( player, objective_entities[player:GetTeamId()] )
end
function player_onkill( player )
-- stop the goalie loop sound
--if player:GetClass() == Player.kCivilian then
--player:StopSound( goalie_sound_loop )
--end
return true
end
function player_killed( player )
-- stop the goalie loop sound
--if player:GetClass() == Player.kCivilian then
--player:StopSound( goalie_sound_loop )
--end
end
function player_switchteam( player, currentteam, desiredteam )
-- stop the goalie loop sound
--if player:GetClass() == Player.kCivilian then
--player:StopSound( goalie_sound_loop )
--end
return true
end
function player_disconnected( player )
if ball_carrier ~= nil then
if ball_carrier:GetId() == player:GetId() then
reset_ball_carrier()
end
end
-- stop the goalie loop sound
--if player:GetClass() == Player.kCivilian then
--player:StopSound( goalie_sound_loop )
--end
end
function remove_hud_items(ball, player)
RemoveHudItem( player, ball:GetName() )
local team = player:GetTeamId()
if (team == TEAM1) then
RemoveHudItemFromAll( "ball-icon-blue" )
elseif (team == TEAM2) then
RemoveHudItemFromAll( "ball-icon-red" )
end
end
function player_ondamage( player, damageinfo )
-- goalies have "UNAGI POWER, UNAGI!"
local attacker = damageinfo:GetAttacker()
if IsPlayer( attacker ) then
attacker = CastToPlayer( attacker )
if attacker:GetClass() == Player.kCivilian and attacker:GetTeamId() ~= player:GetTeamId() then
ConsoleToAll( "Goalie, " .. attacker:GetName() .. ", has UNAGI POWER, UNAGI!" )
--attacker:EmitSound("misc.unagi_spatial")
attacker:AddFortPoints( POINTS_PER_GOALIE_ATTACK, "#FF_FORTPOINTS_GOALIE_ATTACK" )
damageinfo:ScaleDamage(69)
--attacker:EmitSound( goalie_sound_kill )
elseif attacker:GetClass() == Player.kSniper and player:GetClass() ~= Player.kCivilian then
-- snipers do less damage to non-goalies
damageinfo:ScaleDamage(0.1)
end
end
if player:GetClass() == Player.kCivilian then
if player:GetTeamId() == player:GetLocationTeam() then
-- goalies are invincible in their team's locations
damageinfo:ScaleDamage(0)
--player:EmitSound( goalie_sound_idle )
else
-- goalies take more damage outside their team's locations
damageinfo:ScaleDamage(3)
--player:EmitSound( goalie_sound_pain )
end
end
end
-----------------------------------------------------------------------------
-- ball information
-- status: 0 = home, 1 = carried, 2 = dropped
-----------------------------------------------------------------------------
base_ball = info_ff_script:new({
name = "base ball",
team = Team.kUnassigned,
model = "models/items/ball/ball.mdl",
modelskin = 0,
tosssound = "Flag.toss",
dropnotouchtime = 0,
capnotouchtime = 2,
hudicon = "hud_ball",
hudx = 5,
hudy = 210,
hudwidth = 48,
hudheight = 48,
hudalign = 1,
hudstatusiconbluex = 60,
hudstatusiconbluey = 5,
hudstatusiconredx = 60,
hudstatusiconredy = 5,
hudstatusiconblue = "hud_ball.vtf",
hudstatusiconred = "hud_ball.vtf",
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconbluealign = 2,
hudstatusiconredalign = 3,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed},
botgoaltype = Bot.kFlag,
status = 0
})
function base_ball:hasanimation() return false end
function base_ball:usephysics() return true end
function base_ball:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if self.notouch[player:GetId()] then return end
local ball = CastToInfoScript( entity )
if player:GetClass() ~= Player.kCivilian then
-- if the player is a spy, then force him to lose his disguise
player:SetDisguisable( false )
player:SetCloakable( false )
ConsoleToAll( player:GetName() .. " has the ball!" )
--SmartSound( player, "misc.bloop", "misc.bloop", "misc.bloop" )
SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
SmartSpeak(player, "CTF_YOUHAVEBALL", "CTF_TEAMHASBALL", "CTF_ENEMYHASBALL")
SmartMessage( player, "#FF_WATERPOLO_YOU_PICKUP", "#FF_WATERPOLO_TEAM_PICKUP", "#FF_WATERPOLO_ENEMY_PICKUP", Color.kGreen, Color.kGreen, Color.kRed )
ball:Pickup( player )
AddHudIcon( player, self.hudicon, ball:GetName(), self.hudx, self.hudy, self.hudwidth, self.hudheight, self.hudalign )
local team = player:GetTeamId()
if (team == TEAM1) then
AddHudIconToAll( self.hudstatusiconblue, "ball-icon-blue", self.hudstatusiconbluex, self.hudstatusiconbluey, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconbluealign )
elseif (team == TEAM2) then
AddHudIconToAll( self.hudstatusiconred, "ball-icon-red", self.hudstatusiconredx, self.hudstatusiconredy, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconredalign )
end
-- 100 points for initial touch on ball
if self.status == 0 then player:AddFortPoints(POINTS_PER_INITIALTOUCH, "#FF_FORTPOINTS_INITIALTOUCH") end
self.status = 1
UpdateObjectiveIcon( player, goal_entities[player:GetTeamId()] )
ball_carrier = player
if not BALL_ALWAYS_ENEMY_OBJECTIVE then
local enemy_team = team_info[player:GetTeamId()].enemy_team
objective_entities[enemy_team] = nil
UpdateTeamObjectiveIcon( GetTeam(enemy_team), objective_entities[enemy_team] )
end
-- goalies return the ball
else
if ball:IsDropped() then
-- if pressing +use
if player:IsInUse() then
ConsoleToAll( "Goalie, " .. player:GetName() .. ", returned the ball!" )
SmartSound( player, "misc.deeoo", "misc.deeoo", "misc.deeoo" )
SmartMessage( player, "#FF_WATERPOLO_YOU_RETURN", "#FF_WATERPOLO_TEAM_GOALIE_RETURN", "#FF_WATERPOLO_ENEMY_GOALIE_RETURN" )
player:AddFortPoints( POINTS_PER_GOALIE_RETURN, "#FF_FORTPOINTS_GOALIE_RETURN" )
ball:Return()
self.status = 0
else
BroadCastMessageToPlayer(player, "#FF_WATERPOLO_USE_RETURN")
end
end
end
end
end
function base_ball:onownerdie( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
-- drop the ball
ConsoleToAll( player:GetName() .. " died and dropped the ball!" )
local ball = CastToInfoScript( entity )
ball:Drop(BALL_RETURN_TIME, 0.0)
remove_hud_items(ball, player)
self.status = 2
reset_ball_carrier()
end
end
function base_ball:ownercloak( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
-- drop the ball
ConsoleToAll( player:GetName() .. " cloaked and dropped the ball!" )
local ball = CastToInfoScript( entity )
ball:Drop(BALL_RETURN_TIME, 0.0)
remove_hud_items(ball, player)
self.status = 2
reset_ball_carrier()
end
end
function base_ball:ownerfeign( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
-- drop the ball
ConsoleToAll( player:GetName() .. " feigned and dropped the ball!" )
local ball = CastToInfoScript( entity )
ball:Drop(BALL_RETURN_TIME, 0.0)
remove_hud_items(ball, player)
self.status = 2
reset_ball_carrier()
end
end
function base_ball:dropitemcmd( drop_entity )
if IsPlayer( drop_entity ) then
-- throw the ball
local ball = CastToInfoScript( entity )
local player = CastToPlayer( drop_entity )
if not player:IsInUse() then
ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED)
else
ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED * 0.333)
end
ConsoleToAll( player:GetName() .. " passed the ball!" )
remove_hud_items(ball, player)
self.status = 2
reset_ball_carrier()
SmartSound( player, "misc.woop", "misc.woop", "misc.woop" )
-- Make it so the player can't touch the ball for 1 second
-- (so it can't be thrown and not stick to the player)
self:addnotouch(player:GetId(), 1)
end
end
function base_ball:ondrop( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
-- let the teams know that the flag was dropped
SmartSound(player, "yourteam.drop", "yourteam.drop", "otherteam.drop")
SmartMessage(player, "#FF_YOUBALLDROP", "#FF_TEAMBALLDROP", "#FF_ENEMYBALLDROP", Color.kYellow, Color.kYellow, Color.kYellow)
end
local ball = CastToInfoScript(entity)
ball:EmitSound(self.tosssound)
end
function base_ball:onloseitem( owner_entity )
if IsPlayer( owner_entity ) then
-- let the player that lost the ball put on a disguise
local player = CastToPlayer( owner_entity )
player:SetDisguisable(true)
player:SetCloakable( true )
self:addnotouch(player:GetId(), self.capnotouchtime)
end
end
function base_ball:spawn()
self.notouch = { }
info_ff_script.spawn(self)
self.status = 0
end
function base_ball:addnotouch( player_id, duration )
self.notouch[player_id] = duration
AddSchedule(self.name .. "-" .. player_id, duration, self.removenotouch, self, player_id)
end
function base_ball.removenotouch(self, player_id)
self.notouch[player_id] = nil
end
-- For when this object is carried, these offsets are used to place
-- the info_ff_script relative to the players feet
function base_ball:attachoffset()
-- x = forward/backward
-- y = left/right
-- z = up/down
local offset = Vector( 32, 0, 0 )
return offset
end
function base_ball:precache()
PrecacheSound(self.tosssound)
info_ff_script.precache(self)
end
function base_ball:onreturn()
ConsoleToAll( "The ball has returned!" )
SpeakAll ( "CTF_BALLRETURN" )
BroadCastMessage( "#FF_WATERPOLO_BALL_RETURN", Color.kYellow )
self.status = 0
reset_ball_carrier()
end
ball = base_ball:new({
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed},
botgoaltype = Bot.kFlag
})
-- generic goal
base_goal = trigger_ff_script:new({
health = 100,
armor = 300,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 200,
detpacks = 0,
mancannons = 0,
gren1 = 0,
gren2 = 0,
item = "",
team = 0,
botgoaltype = Bot.kFlagCap
})
function base_goal:spawn()
if self.team ~= Team.kUnassigned then
goal_entities[self.team] = entity
end
end
function base_goal:allowed ( allowed_entity )
if IsPlayer( allowed_entity ) then
-- player has to be carrying the item
local player = CastToPlayer( allowed_entity )
return player:HasItem( self.item )
end
return EVENT_DISALLOWED
end
function base_goal:ontrigger ( trigger_entity )
if IsPlayer( trigger_entity ) then
-- player should capture now
local player = CastToPlayer( trigger_entity )
if player:HasItem( self.item ) then
local team = GetTeam( self.team )
team:AddScore( POINTS_PER_CAPTURE )
ConsoleToAll( team:GetName() .. " team scores!" )
local ball = GetInfoScriptByName( self.item )
ball:Return()
remove_hud_items(ball, player)
if player:GetTeamId() == self.team then
ConsoleToAll( player:GetName() .. " scored a goal!" )
-- show on the deathnotice board
ObjectiveNotice( player, "scored a goal" )
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
SmartSpeak(player, "CTF_YOUSCORE", "CTF_TEAMSCORE", "CTF_THEYSCORE")
SmartMessage( player, "#FF_WATERPOLO_YOU_GOAL", "#FF_WATERPOLO_TEAM_GOAL", "#FF_WATERPOLO_ENEMY_GOAL", Color.kGreen, Color.kGreen, Color.kRed)
player:AddFortPoints( POINTS_PER_CAPTURE * 100, "#FF_FORTPOINTS_GOAL" )
else
ConsoleToAll( player:GetName() .. " scored an own goal!\nWait, what?! Kill him like that Columbian a few years ago! OWN GOAL! OWN GOAL!" )
-- show on the deathnotice board
ObjectiveNotice( player, "scored an own goal" )
SmartSound(player, "otherteam.flagcap", "otherteam.flagcap", "yourteam.flagcap")
SmartSpeak(player, "CTF_THEYSCORE", "CTF_THEYSCORE", "CTF_TEAMSCORE")
SmartMessage( player, "#FF_WATERPOLO_YOU_OWN_GOAL", "#FF_WATERPOLO_TEAM_OWN_GOAL", "#FF_WATERPOLO_ENEMY_OWN_GOAL", Color.kRed, Color.kRed, Color.kGreen)
player:AddFortPoints( -POINTS_PER_CAPTURE * 100, "#FF_FORTPOINTS_OWN_GOAL" )
end
ApplyToAll({ AT.kRespawnPlayers, AT.kReloadClips })
the_wall_reset()
end
end
end
-- on blue's side of map, but points go to red
blue_goal = base_goal:new({ item = "ball", team = TEAM2 })
-- on red's side of map, but points go to blue
red_goal = base_goal:new({ item = "ball", team = TEAM1 })
-- respawns a goalie
base_goalie_respawner = trigger_ff_script:new({ team = Team.kUnassigned })
function base_goalie_respawner:ontouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
if player:GetClass() == Player.kCivilian and player:GetTeamId() == self.team then
-- respawn the goalie
ApplyToPlayer(player, { AT.kRespawnPlayers })
AddSchedule("goalie_bounds_notification_" .. player:GetId(), 0.1, goalie_bounds_notification, player )
end
end
end
-- goalie respawner
blue_goalie_respawner = base_goalie_respawner:new({ team = TEAM1 })
red_goalie_respawner = base_goalie_respawner:new({ team = TEAM2 })
-- returns the item
base_item_returner = trigger_ff_script:new({ item = "", message = "" })
function base_item_returner:allowed ( allowed_entity )
if IsPlayer( allowed_entity ) then
-- player has to be carrying the item or be a goalie
local player = CastToPlayer( allowed_entity )
if player:HasItem( self.item ) or player:GetClass() == Player.kCivilian then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function base_item_returner:ontrigger ( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
if player:GetClass() ~= Player.kCivilian then
-- return the item
local item = GetInfoScriptByName( self.item )
item:Return()
remove_hud_items(item, player)
ConsoleToAll( player:GetName() .. self.message )
SpeakAll ( "CTF_BALLRETURN" )
SmartMessage( player, "#FF_WATERPOLO_YOU_BOUNDS", "#FF_WATERPOLO_TEAM_BOUNDS", "#FF_WATERPOLO_ENEMY_BOUNDS", Color.kYellow, Color.kYellow, Color.kYellow )
else
-- respawn the goalie
ApplyToPlayer(player, { AT.kRespawnPlayers })
AddSchedule("goalie_bounds_notification_" .. player:GetId(), 0.1, goalie_bounds_notification, player )
end
end
end
-- ball stripper
ball_stripper = base_item_returner:new({ item = "ball", message = " took the ball out of bounds!" })
-- spawn ammo packs
waterpolo_pack_spawn_blue = blue_ammobackpack
waterpolo_pack_spawn_red = red_ammobackpack
fortball_pack_spawn_blue = blue_ammobackpack
fortball_pack_spawn_red = red_ammobackpack
-- unique fortball spawns (goalies spawn on top of the goal)
bluespawn = { validspawn = function(self,player) return player:GetTeamId() == TEAM1 and player:GetClass() ~= Player.kCivilian and player:GetClass() ~= Player.kSniper end }
redspawn = { validspawn = function(self,player) return player:GetTeamId() == TEAM2 and player:GetClass() ~= Player.kCivilian and player:GetClass() ~= Player.kSniper end }
bluespawn_goalie = { validspawn = function(self,player) return player:GetTeamId() == TEAM1 and player:GetClass() == Player.kCivilian end }
redspawn_goalie = { validspawn = function(self,player) return player:GetTeamId() == TEAM2 and player:GetClass() == Player.kCivilian end }
bluespawn_sniper = { validspawn = function(self,player) return player:GetTeamId() == TEAM1 and player:GetClass() == Player.kSniper end }
redspawn_sniper = { validspawn = function(self,player) return player:GetTeamId() == TEAM2 and player:GetClass() == Player.kSniper end }
-----------------------------------------------------------------------------
-- unique fortball locations
-----------------------------------------------------------------------------
location_ballsonia = location_info:new({ text = "Ballsonia", team = Team.kUnassigned })
location_midfield = location_info:new({ text = "Midfield", team = Team.kUnassigned })
location_blue_side = location_info:new({ text = "Blue Side", team = TEAM1 })
location_red_side = location_info:new({ text = "Red Side", team = TEAM2 })
location_blue_goal = location_info:new({ text = "Blue Goal", team = TEAM1 })
location_red_goal = location_info:new({ text = "Red Goal", team = TEAM2 })
location_upper_deck = location_info:new({ text = "Upper Deck", team = Team.kUnassigned })
location_blue_upper_deck = location_info:new({ text = "Blue Upper Deck", team = TEAM1 })
location_red_upper_deck = location_info:new({ text = "Red Upper Deck", team = TEAM2 })
location_nose_bleeds = location_info:new({ text = "Nose Bleeds", team = Team.kUnassigned })
location_blue_nose_bleeds = location_info:new({ text = "Blue Nose Bleeds", team = TEAM1 })
location_red_nose_bleeds = location_info:new({ text = "Red Nose Bleeds", team = TEAM2 })
location_rainy_sky = location_info:new({ text = "Rainy Sky", team = Team.kUnassigned })
location_death_hills = location_info:new({ text = "Death Hills", team = Team.kUnassigned })
location_sideroom1 = location_info:new({ text = "Side Room 1", team = Team.kUnassigned })
location_sideroom2 = location_info:new({ text = "Side Room 2", team = Team.kUnassigned })

View file

@ -0,0 +1,101 @@
-- base_fortball_default.lua
-- if you want to customize these base fortball defaults, copy all of this file's contents
-- into your map's lua file, edit what you want, and then include base_fortball.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
IncludeScript("base_location");
-- set genericbackpack's disallow touch flags for not letting goalies pick up anything
genericbackpack.disallowtouchflags = {AllowFlags.kCivilian}
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
-- teams
TEAM1 = Team.kBlue
TEAM2 = Team.kRed
DISABLED_TEAM3 = Team.kYellow
DISABLED_TEAM4 = Team.kGreen
teams = { TEAM1, TEAM2 }
disabled_teams = { DISABLED_TEAM3, DISABLED_TEAM4 }
team_info = {
[Team.kUnassigned] = {
team_name = "neutral",
enemy_team = Team.kUnassigned,
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = 0,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = 0,
},
},
[TEAM1] = {
team_name = "blue",
enemy_team = TEAM2,
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = -1,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = 1,
},
},
[TEAM2] = {
team_name = "red",
enemy_team = TEAM1,
class_limits = {
[Player.kScout] = 0,
[Player.kSniper] = -1,
[Player.kSoldier] = 0,
[Player.kDemoman] = 0,
[Player.kMedic] = 0,
[Player.kHwguy] = 0,
[Player.kPyro] = 0,
[Player.kSpy] = 0,
[Player.kEngineer] = 0,
[Player.kCivilian] = 1,
},
},
}
-- objectives
objective_entities = { [TEAM1] = nil, [TEAM2] = nil }
goal_entities = { [TEAM1] = nil, [TEAM2] = nil }
ball_carrier = nil
BALL_ALWAYS_ENEMY_OBJECTIVE = true
-- scoring
POINTS_PER_GOAL = 10
POINTS_PER_INITIALTOUCH = 100
POINTS_PER_GOALIE_RETURN = 50
POINTS_PER_GOALIE_ATTACK = 10
BALL_RETURN_TIME = 15
BALL_THROW_SPEED = 2048
GOALIE_SPEED = 2.0
THE_WALL_TIMER_DISABLE = 12.5
THE_WALL_TIMER_WARN = 2.5
-- goalie sounds
goalie_sound_loop = "ff_waterpolo.psychotic_goalie"
goalie_sound_idle = "NPC_BlackHeadcrab.Talk"
goalie_sound_pain = "NPC_BlackHeadcrab.ImpactAngry"
goalie_sound_kill = "NPC_BlackHeadcrab.Telegraph"

View file

@ -0,0 +1,471 @@
-- base_hunted.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
IncludeScript("base_location");
-----------------------------------------------------------------------------
-- Basic hunted-style gameplay. Respawns all players when the VIP is killed
-----------------------------------------------------------------------------
POINTS_PER_HUNTED_DEATH = 5
POINTS_PER_HUNTED_DEATH_FOR_ASSASSIN = 5
POINTS_PER_HUNTED_ESCAPE = 10
POINTS_PER_HUNTED_ESCAPE_FOR_HUNTED = 10
POINTS_PER_HUNTED_ESCAPE_FOR_BODYGUARDS = 10
POINTS_PER_HUNTED_ATTACK = 2
HUNTED_ALLIES_TEAM = Team.kRed
HUNTED_ENTITY = nil
LAST_HUNTED_LOCATION = nil
ESCAPE_DOOR_BUTTON_UNLOCKED = true
-- escape_door_top is also defined as a base_escape_door object down below
escape_door = {
entity_names = { "escape_door_top", "escape_door_bottom" },
isopen = false,
openicon = "hud_door_open.vtf",
closedicon = "hud_door_closed.vtf",
hudposx = 0,
hudposy = 32,
hudwidth = 64,
hudheight = 32,
hudalignx = 4,
hudaligny = 0
}
-- precache sounds
function precache()
PrecacheSound("ff_hunted.thunder")
PrecacheSound("ff_hunted.cheer")
PrecacheSound("ff_hunted.dying_bird")
PrecacheSound("ff_hunted.dying_bird_full")
PrecacheSound("ff_hunted.dying_bird_full")
PrecacheSound("ff_hunted.i_am_the_werewolf")
PrecacheSound("ff_hunted.i_fight_vampires")
PrecacheSound("ff_hunted.werewolf_howling")
PrecacheSound("ff_hunted.werewolf_movies")
PrecacheSound("ff_hunted.werewolves_howling")
PrecacheSound("otherteam.flagstolen")
end
function startup()
SetGameDescription( "Hunted" )
-- set up team names
SetTeamName( Team.kBlue, "The Hunted" )
SetTeamName( Team.kRed, "Bodyguards" )
SetTeamName( Team.kYellow, "Assassins" )
SetTeamName( Team.kGreen, "Green Kid Touchers" )
-- set up team limits
SetPlayerLimit( Team.kBlue, 1 ) -- There can be only one Highlander!
SetPlayerLimit( Team.kRed, 0 ) -- Unlimited bodyguards.
SetPlayerLimit( Team.kYellow, 6 ) -- Only 6 assassins, but can we dynamically change this based on maxplayers and/or the current playercount?
SetPlayerLimit( Team.kGreen, -1 ) -- Fuck green.
local team = GetTeam( Team.kBlue )
team:SetAllies( Team.kRed )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, 0 )
team = GetTeam( Team.kRed )
team:SetAllies( Team.kBlue )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, 1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, 0 )
team:SetClassLimit( Player.kHwguy, 0 )
team:SetClassLimit( Player.kPyro, 1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, 0 )
team:SetClassLimit( Player.kCivilian, -1 )
team = GetTeam( Team.kYellow )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, 0 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, 1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
RemoveSchedule( "hunted_location_timer" )
AddScheduleRepeating( "hunted_location_timer" , 1.0, hunted_location_timer )
end
-------------------------------------------
-- hunted flaginfo
-------------------------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
if escape_door.isopen then
RemoveHudItem( player, "escape_door_closed" )
AddHudIcon( player, escape_door.openicon, "escape_door_open", escape_door.hudposx, escape_door.hudposy, escape_door.hudwidth, escape_door.hudheight, escape_door.hudalignx, escape_door.hudaligny )
else
RemoveHudItem( player, "escape_door_open" )
AddHudIcon( player, escape_door.closedicon, "escape_door_closed", escape_door.hudposx, escape_door.hudposy, escape_door.hudwidth, escape_door.hudheight, escape_door.hudalignx, escape_door.hudaligny )
end
end
function hunted_location_timer()
if HUNTED_ENTITY ~= nil then
local player = CastToPlayer( HUNTED_ENTITY )
if player:GetLocation() ~= LAST_HUNTED_LOCATION then
LAST_HUNTED_LOCATION = player:GetLocation()
RemoveHudItem( player, "hunted_location" )
AddHudTextToTeam( GetTeam(Team.kRed), "hunted_location", "Hunted Location: " .. player:GetLocation(), 4, 44, 0, 1 )
RemoveHudItemFromTeam( GetTeam(Team.kYellow), "hunted_location" )
end
elseif LAST_HUNTED_LOCATION ~= nil then
LAST_HUNTED_LOCATION = nil
RemoveHudItemFromAll( "hunted_location" )
end
end
function respawn_everyone()
ApplyToAll({ AT.kAllowRespawn, AT.kRespawnPlayers, AT.kRemoveProjectiles, AT.kStopPrimedGrens })
AddSchedule( "close_escape_doors", 4.0, close_escape_doors )
end
function close_escape_doors()
for i,v in ipairs(escape_door.entity_names) do
-- close each enemy escape door
OutputEvent( v, "Close" )
end
end
function lock_escape_door_button()
ESCAPE_DOOR_BUTTON_UNLOCKED = false
end
function unlock_escape_door_button()
ESCAPE_DOOR_BUTTON_UNLOCKED = true
end
function hunted_escape_notification()
BroadCastMessage( "The Hunted escaped!" )
BroadCastSound ( "ff_hunted.cheer" )
end
function player_ondamage( player, damageinfo )
-- if no damageinfo do nothing
if not damageinfo then return end
local attacker = damageinfo:GetAttacker()
local inflictor = damageinfo:GetInflictor()
-- hunted has body armor on and only takes damage from certain things
if player:GetTeamId() == Team.kBlue then
local weapon = damageinfo:GetInflictor():GetClassName()
local attacker_is_buildable = false
if IsSentrygun(attacker) or IsDispenser(attacker) or IsSentrygun(inflictor) or IsDispenser(inflictor) then
attacker_is_buildable = true
end
if attacker_is_buildable ~= true and weapon ~= "ff_weapon_sniperrifle" and weapon ~= "ff_weapon_crowbar" and weapon ~= "ff_projectile_dart" and weapon ~= "ff_weapon_knife" then
damageinfo:ScaleDamage(0)
else
-- BroadCastSound ( "ff_hunted.dying_bird" )
end
-- hunted also has quad damage
else
if IsPlayer( attacker ) then
attacker = CastToPlayer( attacker )
if attacker:GetTeamId() == Team.kBlue and player:GetTeamId() ~= HUNTED_ALLIES_TEAM then
damageinfo:ScaleDamage(4)
attacker:AddFortPoints( POINTS_PER_HUNTED_ATTACK * 10, "Hunted Attack" )
ConsoleToAll( "The Hunted, " .. attacker:GetName() .. ", dealt quad damage to" .. player:GetName() .. "!" )
end
end
end
end
function player_onkill( player )
-- Don't let blue hunted suicide.
if player:GetTeamId() == Team.kBlue then
return false
end
return true
end
-- We only care when The Hunted is killed by another player
function player_killed ( player_victim, damageinfo )
-- if no damageinfo do nothing
if not damageinfo then return end
-- Entity that is attacking
local attacker = damageinfo:GetAttacker()
-- If no attacker do nothing
if not attacker then return end
local player_attacker = nil
-- get the attacking player
if IsPlayer(attacker) then
attacker = CastToPlayer(attacker)
player_attacker = attacker
elseif IsSentrygun(attacker) then
attacker = CastToSentrygun(attacker)
player_attacker = attacker:GetOwner()
elseif IsDetpack(attacker) then
attacker = CastToDetpack(attacker)
player_attacker = attacker:GetOwner()
elseif IsDispenser(attacker) then
attacker = CastToDispenser(attacker)
player_attacker = attacker:GetOwner()
end
-- if still no attacking player after all that, try the inflictor
if not player_attacker then
-- Entity that is attacking
local inflictor = damageinfo:GetInflictor()
if inflictor then
if IsSentrygun(inflictor) then
inflictor = CastToSentrygun(inflictor)
player_attacker = inflictor:GetOwner()
elseif IsDetpack(inflictor) then
inflictor = CastToDetpack(inflictor)
player_attacker = inflictor:GetOwner()
elseif IsDispenser(inflictor) then
inflictor = CastToDispenser(inflictor)
player_attacker = inflictor:GetOwner()
end
end
end
-- if still no attacking player after all that, forget about it
if not player_attacker then return end
if player_victim:GetTeamId() == Team.kBlue then
ConsoleToAll( "The Hunted, " .. player_victim:GetName() .. ", was assassinated!" )
BroadCastMessage( "The Hunted was assassinated!" )
-- BroadCastSound ( "ff_hunted.werewolves_howling" )
BroadCastSound ( "ff_hunted.thunder" )
local team = GetTeam( Team.kYellow )
team:AddScore( POINTS_PER_HUNTED_DEATH )
ApplyToAll( { AT.kDisallowRespawn } )
AddSchedule("respawn_everyone", 2, respawn_everyone)
end
end
function player_disconnected( player )
if player:GetTeamId() == Team.kBlue then
HUNTED_ENTITY = nil
UpdateObjectiveIcon( player, HUNTED_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(Team.kRed), HUNTED_ENTITY )
RemoveHudItemFromAll("hunted_location")
end
end
BLOCKTEAMCHANGE = {}
function player_switchteam( player, currentteam, desiredteam )
local i = player:GetId()
local stime = GetServerTime()
if desiredteam == Team.kBlue then
local delaytime = BLOCKTEAMCHANGE[i]
if delaytime ~= nil and delaytime > stime then
return false
end
BLOCKTEAMCHANGE[i] = stime + 10;
end
if player:GetTeamId() == Team.kBlue then
HUNTED_ENTITY = nil
UpdateObjectiveIcon( player, HUNTED_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(Team.kRed), HUNTED_ENTITY )
RemoveHudItemFromAll("hunted_location")
end
return true
end
-- Give everyone a full resupply, but strip grenades from assassins
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 100 )
player:AddAmmo( Ammo.kNails, 300 )
player:AddAmmo( Ammo.kShells, 300 )
player:AddAmmo( Ammo.kRockets, 300 )
player:AddAmmo( Ammo.kCells, 300 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )
if player:GetTeamId() ~= Team.kYellow then
player:AddAmmo( Ammo.kGren1, 4 )
player:AddAmmo( Ammo.kGren2, 4 )
end
-- AddHudText( player, "escape_door_text", "ESCAPE DOOR:", 0, 32, 4 )
if player:GetTeamId() == Team.kRed then
UpdateObjectiveIcon( player, HUNTED_ENTITY )
if HUNTED_ENTITY ~= nil then
local player_hunted = CastToPlayer( HUNTED_ENTITY )
AddHudText( player, "hunted_location", "Hunted Location: " .. player_hunted:GetLocation(), 4, 44, 0, 1 )
end
elseif player:GetTeamId() == Team.kYellow then
UpdateObjectiveIcon( player, nil )
else
HUNTED_ENTITY = player
UpdateObjectiveIcon( player, GetEntityByName("hunted_escape") )
UpdateTeamObjectiveIcon( GetTeam(Team.kRed), HUNTED_ENTITY )
end
-- if player:GetTeamId() == Team.kRed then
-- BroadCastSoundToPlayer(player, "ff_hunted.i_fight_vampires")
-- elseif player:GetTeamId() == Team.kYellow then
-- BroadCastSoundToPlayer(player, "ff_hunted.werewolf_howling")
-- else
-- BroadCastSoundToPlayer(player, "ff_hunted.i_am_the_werewolf")
-- end
end
-- escape portal entrance
hunted_escape = trigger_ff_script:new({
botgoaltype = Bot.kHuntedEscape,
team = Team.kBlue
})
-- escape touch
function hunted_escape:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == Team.kBlue then
player:AddFrags( POINTS_PER_HUNTED_ESCAPE_FOR_HUNTED )
player:AddFortPoints( POINTS_PER_HUNTED_ESCAPE_FOR_HUNTED * 10, "Hunted Escape" )
ConsoleToAll( "The Hunted, " .. player:GetName() .. ", escaped!" )
local team = GetTeam( Team.kBlue )
team:AddScore( POINTS_PER_HUNTED_ESCAPE )
team = GetTeam( Team.kRed )
team:AddScore( POINTS_PER_HUNTED_ESCAPE )
ApplyToAll({ AT.kAllowRespawn, AT.kRespawnPlayers, AT.kRemoveProjectiles, AT.kStopPrimedGrens })
AddSchedule( "hunted_escape_notification", 0.1, hunted_escape_notification )
AddSchedule( "close_escape_doors", 4.0, close_escape_doors )
end
end
end
base_escape_door = trigger_ff_script:new({})
function base_escape_door:onopen()
BroadCastMessage("Escape Door Open!")
BroadCastSound("otherteam.flagstolen")
escape_door.isopen = true
RemoveHudItemFromAll( "escape_door_closed" )
AddHudIconToAll( escape_door.openicon, "escape_door_open", escape_door.hudposx, escape_door.hudposy, escape_door.hudwidth, escape_door.hudheight, escape_door.hudalignx, escape_door.hudaligny )
end
function base_escape_door:onfullyclosed()
BroadCastMessage("Escape Door Closed!")
-- BroadCastSound("otherteam.flagstolen")
escape_door.isopen = false
RemoveHudItemFromAll( "escape_door_open" )
AddHudIconToAll( escape_door.closedicon, "escape_door_closed", escape_door.hudposx, escape_door.hudposy, escape_door.hudwidth, escape_door.hudheight, escape_door.hudalignx, escape_door.hudaligny )
end
escape_door_top = base_escape_door
base_escape_door_button = func_button:new({})
function base_escape_door_button:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if ESCAPE_DOOR_BUTTON_UNLOCKED then
lock_escape_door_button()
AddSchedule( "unlock_escape_door_button", 6.66, unlock_escape_door_button )
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
-- TODO this doesn't work
function base_escape_door_button:onfailuse( use_entity )
if IsPlayer( use_entity ) then
local player = CastToPlayer( use_entity )
BroadCastMessageToPlayer( player, "#FF_NOTALLOWEDBUTTON" )
end
end
escape_door_button_left = base_escape_door_button
escape_door_button_right = base_escape_door_button
escape_door_button_inside = base_escape_door_button

926
maps/includes/base_id.lua Normal file
View file

@ -0,0 +1,926 @@
-- base_id.lua
-- Invade / Defend gametype
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay")
-----------------------------------------------------------------------------
-- globals
-----------------------------------------------------------------------------
if POINTS_PER_CAPTURE == nil then POINTS_PER_CAPTURE = 10; end
if POINTS_PER_PERIOD == nil then POINTS_PER_PERIOD = 2; end
if PERIOD_TIME == nil then PERIOD_TIME = 30; end
if NUM_PHASES == nil then NUM_PHASES = 4; end
if INITIAL_ROUND_DELAY == nil then INITIAL_ROUND_DELAY = 45; end
if ROUND_DELAY == nil then ROUND_DELAY = 20; end
if onroundreset == nil then onroundreset = function() end end
if FLAG_RETURN_TIME == nil then FLAG_RETURN_TIME = 60; end
if ATTACKERS_OBJECTIVE_ENTITY == nil then ATTACKERS_OBJECTIVE_ENTITY = nil end
if DEFENDERS_OBJECTIVE_ENTITY == nil then DEFENDERS_OBJECTIVE_ENTITY = nil end
if DEFENDERS_OBJECTIVE_ONFLAG == nil then DEFENDERS_OBJECTIVE_ONFLAG = true end
if DEFENDERS_OBJECTIVE_ONCARRIER == nil then DEFENDERS_OBJECTIVE_ONCARRIER = true end
if TEAM_SWITCH_DELAY == nil then TEAM_SWITCH_DELAY = 2 end
if RESPAWN_AFTER_CAP == nil then RESPAWN_AFTER_CAP = false end
if RESPAWN_DELAY == nil then RESPAWN_DELAY = 2 end
basecap = trigger_ff_script:new({
health = 100,
armor = 300,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 200,
detpacks = 1,
mancannons = 1,
gren1 = 0,
gren2 = 0,
item = "",
team = 0,
botgoaltype = Bot.kFlagCap,
})
function basecap:allowed ( allowed_entity )
if IsPlayer( allowed_entity ) then
-- get the player and his team
local player = CastToPlayer( allowed_entity )
local team = player:GetTeam()
-- check if the player is on our team
if team:GetTeamId() ~= self.team then
return false
end
-- check if the player has the flag
for i,v in ipairs(self.item) do
local flag = GetInfoScriptByName(v)
-- Make sure flag isn't nil
if flag then
if player:HasItem(flag:GetName()) then
return true
end
end
end
end
return false
end
function basecap:ontrigger ( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
-- player should capture now
for i,v in ipairs( self.item ) do
-- find the flag and cast it to an info_ff_script
local flag = GetInfoScriptByName(v)
-- Make sure flag isn't nil
if flag then
-- check if the player is carrying the flag
if player:HasItem(flag:GetName()) then
-- reward player for capture
player:AddFortPoints(FORTPOINTS_PER_CAPTURE, "#FF_FORTPOINTS_CAPTUREFLAG")
-- reward player's team for capture
local team = player:GetTeam()
team:AddScore(POINTS_PER_CAPTURE)
-- Remove any hud icons
-- local flag2 = CastToInfoScript(flag)
RemoveHudItem( player, flag:GetName() )
RemoveHudItemFromAll( flag:GetName() .. "_c" )
LogLuaEvent(player:GetId(), 0, "flag_capture","flag_name",flag:GetName())
-- return the flag
flag:Return()
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then player:AddHealth(self.health) end
if self.armor ~= nil and self.armor ~= 0 then player:AddArmor(self.armor) end
-- give the player some ammo
if self.nails ~= nil and self.nails ~= 0 then player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then player:AddAmmo(Ammo.kGren2, self.gren2) end
self:oncapture( player, v )
end
end
end
end
end
function basecap:oncapture(player, item)
-- let the teams know that a capture occured
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
end
function baseflag:spawn()
self.notouch = { }
info_ff_script.spawn(self)
local flag = CastToInfoScript( entity )
LogLuaEvent(0, 0, "flag_spawn","flag_name",flag:GetName())
self.status = 0
update_hud()
end
function baseflag:ownercloak( owner_entity )
-- drop the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, 0.0)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
self.status = 2
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_return_timer()
update_hud()
end
function baseflag:dropitemcmd( owner_entity )
if allowdrop == false then return end
--Used by logging
self.flagtoss = true
-- throw the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, FLAG_THROW_SPEED)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
self.status = 2
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_return_timer()
update_hud()
end
function baseflag:onownerforcerespawn( owner_entity )
local flag = CastToInfoScript( entity )
local player = CastToPlayer( owner_entity )
player:SetDisguisable( true )
player:SetCloakable( true )
RemoveHudItem( player, flag:GetName() )
flag:Drop(0, FLAG_THROW_SPEED)
RemoveHudItem( player, flag:GetName() )
self.status = 2
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
update_hud()
end
function baseflag:onreturn( )
-- let the teams know that the flag was returned
local team = GetTeam( self.team )
SmartTeamMessage(team, "#FF_TEAMRETURN", "#FF_OTHERTEAMRETURN", Color.kYellow, Color.kYellow)
SmartTeamSound(team, "yourteam.flagreturn", "otherteam.flagreturn")
SmartTeamSpeak(team, "CTF_FLAGBACK", "CTF_EFLAGBACK")
local flag = CastToInfoScript( entity )
self.status = 0
LogLuaEvent(0, 0, "flag_returned","flag_name",flag:GetName());
-- objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = flag end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
destroy_return_timer()
update_hud()
end
phase = 1
current_flag = "cp1_flag" --currently only used by Palermo for hacky flag returning in water
attackers = Team.kBlue
defenders = Team.kRed
current_timer = 0
carried_by = nil
function startup()
SetGameDescription( "Invade Defend" )
-- set up team limits
local team = GetTeam( Team.kBlue )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kRed )
team:SetPlayerLimit( 0 )
team = GetTeam( Team.kYellow )
team:SetPlayerLimit( -1 )
team = GetTeam( Team.kGreen )
team:SetPlayerLimit( -1 )
-- CTF maps generally don't have civilians,
-- so override in map LUA file if you want 'em
local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
-- set them team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- start the timer for the points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
cp1_flag.enabled = true
for i,v in ipairs({"cp1_flag", "cp2_flag", "cp3_flag", "cp4_flag", "cp5_flag", "cp6_flag", "cp7_flag", "cp8_flag"}) do
local flag = GetInfoScriptByName(v)
if flag then
flag:SetModel(_G[v].model)
flag:SetSkin(teamskins[attackers])
if i == 1 then
flag:Restore()
else
flag:Remove()
end
end
end
flags_set_team( attackers )
ATTACKERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_flag" )
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
end
-- Give everyone a full resupply, but strip secondary grenades
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )
player:RemoveAmmo( Ammo.kGren2, 4 )
if player:GetTeamId() == attackers then
UpdateObjectiveIcon( player, ATTACKERS_OBJECTIVE_ENTITY )
elseif player:GetTeamId() == defenders then
UpdateObjectiveIcon( player, DEFENDERS_OBJECTIVE_ENTITY )
end
end
function addpoints()
local team = GetTeam(defenders)
team:AddScore(POINTS_PER_PERIOD)
end
function precache()
-- precache sounds
PrecacheSound("yourteam.flagstolen")
PrecacheSound("otherteam.flagstolen")
PrecacheSound("yourteam.flagcap")
PrecacheSound("otherteam.flagcap")
PrecacheSound("yourteam.drop")
PrecacheSound("otherteam.drop")
PrecacheSound("yourteam.flagreturn")
PrecacheSound("otherteam.flagreturn")
-- PrecacheSound("vox.yourcap")
-- PrecacheSound("vox.enemycap")
-- PrecacheSound("vox.yourstole")
-- PrecacheSound("vox.enemystole")
-- PrecacheSound("vox.yourflagret")
-- PrecacheSound("vox.enemyflagret")
end
-- kinda ghetto, sure
function flags_set_team( teamid )
-- set all flags teams
cp1_flag.team = teamid
cp2_flag.team = teamid
cp3_flag.team = teamid
cp4_flag.team = teamid
cp5_flag.team = teamid
cp6_flag.team = teamid
cp7_flag.team = teamid
cp8_flag.team = teamid
end
-----------------------------------------
--Backpacks
-----------------------------------------
idbackpack = genericbackpack:new({team = nil})
function idbackpack:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() ~= self.team then
return false
end
local dispensed = 0
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then dispensed = dispensed + player:AddHealth( self.health ) end
if self.armor ~= nil and self.armor ~= 0 then dispensed = dispensed + player:AddArmor( self.armor ) end
-- give player ammo
if self.nails ~= nil and self.nails ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren2, self.gren2) end
-- if the player took ammo, then have the backpack respawn with a delay
if dispensed >= 1 then
local backpack = CastToInfoScript(entity);
if backpack then
backpack:EmitSound(self.touchsound);
backpack:Respawn(self.respawntime);
end
end
end
end
backpack_attackers = idbackpack:new({team = attackers})
backpack_defenders = idbackpack:new({team = defenders})
-----------------------------------------
-- base flag
-----------------------------------------
base_id_flag = baseflag:new({
phase = 1,
enabled = nil,
touchflags = { AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kRed },
hudicon = BLUE_FLAG_HUD_ICON,
})
function base_id_flag:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
-- pickup if they can
if self.notouch[player:GetId()] then return; end
if player:GetTeamId() == attackers and phase == self.phase and self.enabled then
SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
RandomFlagTouchSpeak( player )
--SmartSound(player, "vox.yourstole", "vox.yourstole", "vox.enemystole")
SmartMessage(player, "#FF_YOUPICKUP", "#FF_TEAMPICKUP", "#FF_OTHERTEAMPICKUP", Color.kGreen, Color.kGreen, Color.kRed)
local flag = CastToInfoScript(entity)
flag:Pickup(player)
player:SetDisguisable( false )
-- if the player is a spy, then force him to lose his cloak
player:SetCloakable( false )
self.hudicon = team_hudicons[attackers]
AddHudIcon( player, self.hudicon, flag:GetName(), self.hudx, self.hudy, self.hudstatusiconw, self.hudstatusiconh, self.hudalign )
-- log action in stats
LogLuaEvent(player:GetId(), 0, "flag_touch", "flag_name", flag:GetName(), "player_origin", (string.format("%0.2f",player:GetOrigin().x) .. ", " .. string.format("%0.2f",player:GetOrigin().y) .. ", " .. string.format("%0.1f",player:GetOrigin().z) ), "player_health", "" .. player:GetHealth());
-- change objective icons
ATTACKERS_OBJECTIVE_ENTITY = player
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..self.phase.."_cap" ) end
if DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = player end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
UpdateObjectiveIcon( player, GetEntityByName( "cp"..self.phase.."_cap" ) )
carried_by = player:GetName()
destroy_return_timer()
update_hud()
end
end
end
function player_switchclass( player, current, desired )
return true
end
function base_id_flag:onownerdie( owner_entity )
-- drop the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, 0.0)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
player:SetDisguisable( true )
player:SetCloakable( true )
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = flag end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
UpdateObjectiveIcon( player, nil )
self.status = 2
setup_return_timer()
update_hud()
end
-----------------------------------------
-- base capture point
-----------------------------------------
base_id_cap = basecap:new({
phase = 0,
})
function base_id_cap:allowed ( touch_entity )
if phase ~= self.phase then
return EVENT_DISALLOWED
end
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
if player:GetTeamId() == defenders then
BroadCastMessageToPlayer( player, "#AD_Defend" )
else
for i,v in ipairs(self.item) do
if player:HasItem( v ) then
return EVENT_ALLOWED
end
end
end
end
return EVENT_DISALLOWED
end
function base_id_cap:oncapture(player, item)
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
--SmartSound(player, "vox.yourcap", "vox.yourcap", "vox.enemycap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
local flag_item = GetInfoScriptByName( item )
RemoveHudItem( player, flag_item:GetName() )
-- turn off this flag
for i,v in ipairs(self.item) do
_G[v].enabled = nil
local flag = GetInfoScriptByName(v)
if flag then
flag:Remove()
end
end
-- show on the deathnotice board
ObjectiveNotice( player, "captured point "..phase )
if phase == NUM_PHASES then
-- it's the last round. end and stuff
AddSchedule("team_switch_delay", TEAM_SWITCH_DELAY, round_end)
else
if RESPAWN_AFTER_CAP then
AddSchedule("respawn_all", RESPAWN_DELAY, respawn_all)
else
phase = phase + 1
end
-- enable the next flag after a time
AddSchedule("flag_start", ROUND_DELAY, flag_start, self.next)
if ROUND_DELAY > 30 then AddSchedule("flag_30secwarn", ROUND_DELAY-30, flag_30secwarn) end
if ROUND_DELAY > 10 then AddSchedule("flag_10secwarn", ROUND_DELAY-10, flag_10secwarn) end current_flag = self.next
-- clear objective icon
ATTACKERS_OBJECTIVE_ENTITY = nil
if DEFENDERS_OBJECTIVE_ONFLAG or DEFENDERS_OBJECTIVE_ONCARRIER then DEFENDERS_OBJECTIVE_ENTITY = nil
else DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" ) end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
setup_tobase_timer()
update_hud()
end
end
function respawn_all()
RespawnAllPlayers()
phase = phase + 1
end
function round_end()
phase = 1
current_flag = "cp1_flag"
if attackers == Team.kBlue then
attackers = Team.kRed
defenders = Team.kBlue
else
attackers = Team.kBlue
defenders = Team.kRed
end
-- set all flag teams to new attackers
flags_set_team( attackers )
-- switch them team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- enable the first flag
cp1_flag.enabled = true
cp1_flag.status = 0
local flag = GetInfoScriptByName("cp1_flag")
if flag then
flag:Restore()
flag:SetSkin(teamskins[attackers])
end
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
DEFENDERS_OBJECTIVE_ENTITY = GetEntityByName( "cp"..phase.."_cap" )
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
-- reset the timer on points
AddScheduleRepeating("addpoints", PERIOD_TIME, addpoints)
-- respawn the players
RespawnAllPlayers()
setup_door_timer("start_gate", INITIAL_ROUND_DELAY)
-- run custom round reset stuff
onroundreset()
update_hud()
end
function setup_door_timer(doorname, duration)
CloseDoor(doorname)
AddSchedule("round_start", duration, round_start, doorname)
AddSchedule("round_30secwarn", duration-30, round_30secwarn)
AddSchedule("round_10secwarn", duration-10, round_10secwarn)
end
function round_start(doorname)
BroadCastMessage("#FF_AD_GATESOPEN")
BroadCastSound( "otherteam.flagstolen" )
OpenDoor(doorname)
end
function round_30secwarn() BroadCastMessage("#FF_ROUND_30SECWARN") end
function round_10secwarn() BroadCastMessage("#FF_ROUND_10SECWARN") end
function flag_start(flagname)
BroadCastMessage("#AD_FlagAtBase")
_G[flagname].enabled = true
_G[flagname].status = 0
local flag = GetInfoScriptByName(flagname)
if flag then
flag:Restore()
flag:SetSkin(teamskins[attackers])
end
-- change objective icon
ATTACKERS_OBJECTIVE_ENTITY = flag
if DEFENDERS_OBJECTIVE_ONFLAG then DEFENDERS_OBJECTIVE_ENTITY = flag end
UpdateTeamObjectiveIcon( GetTeam(attackers), ATTACKERS_OBJECTIVE_ENTITY )
UpdateTeamObjectiveIcon( GetTeam(defenders), DEFENDERS_OBJECTIVE_ENTITY )
update_hud()
end
function flag_30secwarn() BroadCastMessage("#AD_30SecReturn") end
function flag_10secwarn() BroadCastMessage("#AD_10SecReturn") end
function timer_schedule()
current_timer = current_timer -1
end
function setup_return_timer()
RemoveSchedule( "timer_tobase_schedule" )
current_timer = FLAG_RETURN_TIME
AddScheduleRepeatingNotInfinitely( "timer_return_schedule", 1, timer_schedule, current_timer)
end
function destroy_return_timer()
RemoveSchedule( "timer_return_schedule" )
end
function setup_tobase_timer()
RemoveSchedule( "timer_return_schedule" )
current_timer = ROUND_DELAY
AddScheduleRepeatingNotInfinitely( "timer_tobase_schedule", 1, timer_schedule, current_timer)
end
function destroy_tobase_timer()
RemoveSchedule( "timer_tobase_schedule" )
end
------------------------------------------------
-- instanciate them
------------------------------------------------
cp1_flag = base_id_flag:new({phase = 1})
cp2_flag = base_id_flag:new({phase = 2})
cp3_flag = base_id_flag:new({phase = 3})
cp4_flag = base_id_flag:new({phase = 4})
cp5_flag = base_id_flag:new({phase = 5})
cp6_flag = base_id_flag:new({phase = 6})
cp7_flag = base_id_flag:new({phase = 7})
cp8_flag = base_id_flag:new({phase = 8})
cp1_cap = base_id_cap:new({phase = 1, item = {"cp1_flag"}, next = "cp2_flag"})
cp2_cap = base_id_cap:new({phase = 2, item = {"cp2_flag"}, next = "cp3_flag"})
cp3_cap = base_id_cap:new({phase = 3, item = {"cp3_flag"}, next = "cp4_flag"})
cp4_cap = base_id_cap:new({phase = 4, item = {"cp4_flag"}, next = "cp5_flag"})
cp5_cap = base_id_cap:new({phase = 5, item = {"cp5_flag"}, next = "cp6_flag"})
cp6_cap = base_id_cap:new({phase = 6, item = {"cp6_flag"}, next = "cp7_flag"})
cp7_cap = base_id_cap:new({phase = 7, item = {"cp7_flag"}, next = "cp8_flag"})
cp8_cap = base_id_cap:new({phase = 8, item = {"cp8_flag"}, next = nil})
base_attacker_spawn = info_ff_teamspawn:new({ phase = 0, validspawn = function(self,player)
return player:GetTeamId() == attackers and phase == self.phase
end })
base_defender_spawn = info_ff_teamspawn:new({ phase = 0, validspawn = function(self,player)
return player:GetTeamId() == defenders and phase == self.phase
end })
cp1_attacker = base_attacker_spawn:new({phase=1})
cp2_attacker = base_attacker_spawn:new({phase=2})
cp3_attacker = base_attacker_spawn:new({phase=3})
cp4_attacker = base_attacker_spawn:new({phase=4})
cp5_attacker = base_attacker_spawn:new({phase=5})
cp6_attacker = base_attacker_spawn:new({phase=6})
cp7_attacker = base_attacker_spawn:new({phase=7})
cp8_attacker = base_attacker_spawn:new({phase=8})
cp1_defender = base_defender_spawn:new({phase=1})
cp2_defender = base_defender_spawn:new({phase=2})
cp3_defender = base_defender_spawn:new({phase=3})
cp4_defender = base_defender_spawn:new({phase=4})
cp5_defender = base_defender_spawn:new({phase=5})
cp6_defender = base_defender_spawn:new({phase=6})
cp7_defender = base_defender_spawn:new({phase=7})
cp8_defender = base_defender_spawn:new({phase=8})
------------------------------------------------
-- hud info
------------------------------------------------
function flaginfo( player_entity )
local player = CastToPlayer( player_entity )
local flag = GetInfoScriptByName("cp"..phase.."_flag")
local flagname = flag:GetName()
--RemoveHudItemFromAll( "background" )
--AddHudIconToAll( "hud_statusbar_256_128.vtf", "background", -64, 32, 128, 70, 3 )
RemoveHudItem( player, "cp_flag_c" )
RemoveHudItem( player, "cp_flag_d" )
RemoveHudItem( player, "cp_flag_h" )
RemoveHudItem( player, "flag_tobase_timer" )
RemoveHudItem( player, "flag_tobase_text" )
RemoveHudItem( player, "flag_return_timer" )
RemoveHudItem( player, "flag_return_text" )
RemoveHudItem( player, "flag_carried_by" )
RemoveHudItem( player, "flag_carried_by2" )
RemoveHudItem( player, "flag_athome" )
RemoveHudItem( player, "flag_athome2" )
if attackers == Team.kBlue then
hudstatusicondropped = "hud_flag_dropped_blue.vtf"
hudstatusiconhome = "hud_flag_home_blue.vtf"
hudstatusiconcarried = "hud_flag_carried_blue.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kRed then
hudstatusicondropped = "hud_flag_dropped_red.vtf"
hudstatusiconhome = "hud_flag_home_red.vtf"
hudstatusiconcarried = "hud_flag_carried_red.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
elseif attackers == Team.kYellow then
hudstatusicondropped = "hud_flag_dropped_yellow.vtf"
hudstatusiconhome = "hud_flag_home_yellow.vtf"
hudstatusiconcarried = "hud_flag_carried_yellow.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kGreen then
hudstatusicondropped = "hud_flag_dropped_green.vtf"
hudstatusiconhome = "hud_flag_home_green.vtf"
hudstatusiconcarried = "hud_flag_carried_green.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
end
flag_hudstatusiconx = 4
flag_hudstatusicony = 42
flag_hudstatusiconw = 15
flag_hudstatusiconh = 15
flag_hudstatusiconalign = 3
text_hudstatusx = 0
text_hudstatusy = flag_hudstatusicony + 24
text_hudstatusalign = 4
local CPnumber = phase - 1
if _G[flagname].enabled == true then
if flag:IsCarried() then
AddHudText(player, "flag_carried_by", "#AD_FlagCarriedBy", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudText(player, "flag_carried_by2", carried_by, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIcon(player, hudstatusiconcarried, ( "cp_flag_c" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif flag:IsDropped() and _G[flagname].status == 2 then
if CPnumber > 0 then
AddHudTextToAll("flag_return_text", "Flag will return to CP"..CPnumber.." in", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
else
AddHudTextToAll("flag_return_text", "#AD_FlagReturnBase", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
end
AddHudTimer(player, "flag_return_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIcon(player, hudstatusicondropped, ( "cp_flag_d" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif _G[flagname].status == 0 then
AddHudText(player, "flag_athome", "#AD_FlagIsAt", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
if CPnumber > 0 then
AddHudText(player, "flag_athome2", "Capture Point "..CPnumber, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
else
AddHudText(player, "flag_athome2", "#AD_ASpawn", text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
end
AddHudIcon(player, hudstatusiconhome, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
else
if CPnumber > 0 then
AddHudText(player, "flag_tobase_text", "Flag will return to CP"..CPnumber.." in", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
else
AddHudText(player, "flag_tobase_text", "#AD_FlagReturnBase", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
end
AddHudTimer(player, "flag_tobase_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIcon(player, hudstatusicontobase, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
RemoveHudItem( player, "Zone_Team"..attackers )
RemoveHudItem( player, "Zone_Team"..defenders )
RemoveHudItem( player, "Zone_Phase"..attackers )
RemoveHudItem( player, "Zone_Phase"..defenders )
od_hudstatusiconx = -28
od_hudstatusicony = 38
od_hudstatusiconw = 24
od_hudstatusiconh = 24
od_hudstatusiconalign = 3
if player:GetTeamId() == attackers then
AddHudIcon( player, "hud_offense.vtf", "Zone_Team"..attackers, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIcon( player, "hud_cp_"..phase..".vtf", "Zone_Phase"..attackers, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
else
AddHudIcon( player, "hud_defense.vtf", "Zone_Team"..defenders, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIcon( player, "hud_cp_"..phase..".vtf", "Zone_Phase"..defenders, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
end
end
function update_hud()
local flag = GetInfoScriptByName("cp"..phase.."_flag")
local flagname = flag:GetName()
--RemoveHudItemFromAll( "background" )
--AddHudIconToAll( "hud_statusbar_256_128.vtf", "background", -64, 32, 128, 70, 3 )
RemoveHudItemFromAll( "cp_flag_c" )
RemoveHudItemFromAll( "cp_flag_d" )
RemoveHudItemFromAll( "cp_flag_h" )
RemoveHudItemFromAll( "flag_tobase_timer" )
RemoveHudItemFromAll( "flag_tobase_text" )
RemoveHudItemFromAll( "flag_return_timer" )
RemoveHudItemFromAll( "flag_return_text" )
RemoveHudItemFromAll( "flag_carried_by" )
RemoveHudItemFromAll( "flag_carried_by2" )
RemoveHudItemFromAll( "flag_athome" )
RemoveHudItemFromAll( "flag_athome2" )
if attackers == Team.kBlue then
hudstatusicondropped = "hud_flag_dropped_blue.vtf"
hudstatusiconhome = "hud_flag_home_blue.vtf"
hudstatusiconcarried = "hud_flag_carried_blue.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kRed then
hudstatusicondropped = "hud_flag_dropped_red.vtf"
hudstatusiconhome = "hud_flag_home_red.vtf"
hudstatusiconcarried = "hud_flag_carried_red.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
elseif attackers == Team.kYellow then
hudstatusicondropped = "hud_flag_dropped_yellow.vtf"
hudstatusiconhome = "hud_flag_home_yellow.vtf"
hudstatusiconcarried = "hud_flag_carried_yellow.vtf"
hudstatusicontobase = "hud_flag_home_l.vtf"
elseif attackers == Team.kGreen then
hudstatusicondropped = "hud_flag_dropped_green.vtf"
hudstatusiconhome = "hud_flag_home_green.vtf"
hudstatusiconcarried = "hud_flag_carried_green.vtf"
hudstatusicontobase = "hud_flag_home_r.vtf"
end
flag_hudstatusiconx = 4
flag_hudstatusicony = 42
flag_hudstatusiconw = 15
flag_hudstatusiconh = 15
flag_hudstatusiconalign = 3
text_hudstatusx = 0
text_hudstatusy = flag_hudstatusicony + 24
text_hudstatusalign = 4
local CPnumber = phase - 1
if _G[flagname].enabled == true then
if flag:IsCarried() then
AddHudTextToAll("flag_carried_by", "#AD_FlagCarriedBy", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
AddHudTextToAll("flag_carried_by2", carried_by, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
AddHudIconToAll( hudstatusiconcarried, ( "cp_flag_c" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif flag:IsDropped() and _G[flagname].status == 2 then
if CPnumber > 0 then
AddHudTextToAll("flag_return_text", "Flag will return to CP"..CPnumber.." in", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
else
AddHudTextToAll("flag_return_text", "#AD_FlagReturnBase", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
end
AddHudTimerToAll("flag_return_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIconToAll( hudstatusicondropped, ( "cp_flag_d" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
elseif _G[flagname].status == 0 then
AddHudTextToAll("flag_athome", "#AD_FlagIsAt", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
if CPnumber > 0 then
AddHudTextToAll("flag_athome2", "Capture Point "..CPnumber, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
else
AddHudTextToAll("flag_athome2", "#AD_ASpawn", text_hudstatusx, text_hudstatusy+8, text_hudstatusalign, 0)
end
AddHudIconToAll( hudstatusiconhome, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
else
if CPnumber > 0 then
AddHudTextToAll("flag_tobase_text", "Flag will return to CP"..CPnumber.." in", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
else
AddHudTextToAll("flag_tobase_text", "#AD_FlagReturnBase", text_hudstatusx, text_hudstatusy, text_hudstatusalign, 0)
end
AddHudTimerToAll("flag_tobase_timer", current_timer + 1, -1, text_hudstatusx, text_hudstatusy+8, text_hudstatusalign)
AddHudIconToAll(hudstatusicontobase, ( "cp_flag_h" ), flag_hudstatusiconx, flag_hudstatusicony, flag_hudstatusiconw, flag_hudstatusiconh, flag_hudstatusiconalign )
end
RemoveHudItemFromAll( "Zone_Team"..attackers )
RemoveHudItemFromAll( "Zone_Team"..defenders )
RemoveHudItemFromAll( "Zone_Phase"..attackers )
RemoveHudItemFromAll( "Zone_Phase"..defenders )
od_hudstatusiconx = -28
od_hudstatusicony = 38
od_hudstatusiconw = 24
od_hudstatusiconh = 24
od_hudstatusiconalign = 3
AddHudIconToTeam( GetTeam(attackers), "hud_offense.vtf", "Zone_Team"..attackers, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(attackers), "hud_cp_"..phase..".vtf", "Zone_Phase"..attackers, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(defenders), "hud_defense.vtf", "Zone_Team"..defenders, od_hudstatusiconx, od_hudstatusicony, od_hudstatusiconw, od_hudstatusiconh, od_hudstatusiconalign )
AddHudIconToTeam( GetTeam(defenders), "hud_cp_"..phase..".vtf", "Zone_Phase"..defenders, od_hudstatusiconx + 2, od_hudstatusicony + 2, 20, 20, od_hudstatusiconalign )
end

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,898 @@
-- base_idzone.lua
-- Invade / Defend the Zone gametype
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay")
-----------------------------------------------------------------------------
-- global overrides that you can do what you want with
-----------------------------------------------------------------------------
FORT_POINTS_PER_INITIAL_TOUCH = 200
FORT_POINTS_PER_PERIOD = 50
FORT_POINTS_PER_DEFEND = 100
POINTS_PER_INITIAL_TOUCH = 1
POINTS_PER_PERIOD = 1
DELAY_BEFORE_PERIOD_POINTS = 2
PERIOD_TIME = 1
INITIAL_ROUND_PERIOD = 60
ROUND_SETUP_PERIOD = 17
DEFENSE_PERIOD_TIME = 60
POINTS_PER_DEFENSE_PERIOD = 1
DEFAULT_POINTS_TO_CAP = 10
NUMBER_OF_CAP_POINTS = 3
DELAY_BEFORE_TEAMSWITCH = 2
DELAY_AFTER_CAP = 3
ZONE_COLOR = "blue"
-----------------------------------------------------------------------------
-- global variables and other shit that shouldn't be messed with
-----------------------------------------------------------------------------
phase = 1
zone_points = 0
zone_max_points = DEFAULT_POINTS_TO_CAP
zone_scoring = false
draw_hud = true
attackers = Team.kBlue
defenders = Team.kRed
scoring_team = Team.kRed
local teamdata = {
[Team.kBlue] = { skin = "0", beamcolour = "0 0 255" },
[Team.kRed] = { skin = "1", beamcolour = "255 0 0" }
}
-- stores ID's of attackers in the cap room
local zone_collection = Collection()
-- stores if the player has touched the cap point (for 1 touch per death)
local playerTouchedTable = {}
-----------------------------------------------------------------------------
-- functions that do sh... stuff
-----------------------------------------------------------------------------
-- sounds, right?
function precache()
PrecacheSound("otherteam.flagstolen") -- doors open sound
PrecacheSound("otherteam.drop") -- warning sound
PrecacheSound("yourteam.flagreturn") -- scoring sound
PrecacheSound("misc.bloop") -- minutes remaining
PrecacheSound("misc.doop") -- attackers capping sound
end
-- pretty standard setup, aside from scoring starting
function startup()
SetGameDescription( "Invade Defend the Zone" )
-- set up team limits on each team
SetPlayerLimit( Team.kBlue, 0 )
SetPlayerLimit( Team.kRed, 0 )
SetPlayerLimit( Team.kYellow, -1 )
SetPlayerLimit( Team.kGreen, -1 )
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- Making the game not suck.
local team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, 1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
team:SetClassLimit(Player.kSniper, 1)
team:SetClassLimit(Player.kEngineer, 2)
team:SetClassLimit(Player.kDemoman, 2)
team:SetClassLimit(Player.kHwguy, 2)
team:SetClassLimit(Player.kPyro, 2)
AddSchedule( "round_start", INITIAL_ROUND_PERIOD, round_start)
if INITIAL_ROUND_PERIOD > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_PERIOD - 30 , schedulemessagetoall, "#ADZ_30SecWarning" ) end
if INITIAL_ROUND_PERIOD > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_PERIOD - 10 , schedulemessagetoall, "#ADZ_10SecWarning" ) end
-- sounds
if INITIAL_ROUND_PERIOD > 30 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_PERIOD - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_PERIOD > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_PERIOD - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_PERIOD > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_PERIOD - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_PERIOD > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_PERIOD - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_PERIOD > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_PERIOD - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_PERIOD > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_PERIOD - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_PERIOD > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_PERIOD - 1 , schedulecountdown, 1 ) end
zone_max_points = zone1.pointstocap
-- calculate defense period points
local total_points_to_reset = 1
for i=1,NUMBER_OF_CAP_POINTS do
local t_points = getfield("zone"..i..".pointstocap")
total_points_to_reset = total_points_to_reset + t_points
end
local timelimit = GetConvar( "mp_timelimit" )
-- convert mp_timelimit from minutes to seconds and divide by the number of rounds minus initial round period
POINTS_PER_DEFENSE_PERIOD = total_points_to_reset / (timelimit / (DEFENSE_PERIOD_TIME / 60))
POINTS_PER_DEFENSE_PERIOD = math.ceil(POINTS_PER_DEFENSE_PERIOD)
update_zone_all( )
AddScheduleRepeating( "period_scoring_sched", PERIOD_TIME, period_scoring )
AddScheduleRepeating( "defense_period_scoring_sched", DEFENSE_PERIOD_TIME, defenders_scoring )
end
-----------------------------------------------------------------------------
-- player_ functions
-----------------------------------------------------------------------------
-- on player spawn
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:RemoveAmmo( Ammo.kManCannon, 1 )
player:SetCloakable( true )
player:SetDisguisable( true )
update_zone_player( player )
-- give demo 1 mirv, and only 1 mirv
if player:GetClass() == Player.kDemoman or player:GetClass() == Player.kEngineer then
player:RemoveAmmo( Ammo.kGren2, 4 )
player:AddAmmo( Ammo.kGren2, 1 )
end
if player:GetTeamId() == attackers then
local attackers_objective = GetEntityByName( "zone"..phase )
UpdateObjectiveIcon( player, attackers_objective )
else
UpdateObjectiveIcon( player, nil )
player:RemoveAmmo( Ammo.kDetpack, 1 )
end
-- wtf, scout or med on d? are you mental?
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
local classt = "Scout"
if player:GetClass() == Player.kMedic then classt = "Medic" end
local id = player:GetId()
AddSchedule("force_changemessage"..id, 2, schedulechangemessage, player, "No "..classt.."s on defense. Autoswitching to Soldier." )
AddSchedule("force_change"..id, 2, forcechange, player)
end
-- remove any players not on a team from playertouchedtable
for playerx, recordx in pairs(playerTouchedTable) do
if GetPlayerByID( playerx ) then
local playert = GetPlayerByID( playerx )
if ( playert:GetTeamId() ~= attackers ) then
playerTouchedTable[playerx] = nil
end
end
end
if player:GetTeamId() ~= attackers then return end
-- add to table and reset touched to 0
playerTouchedTable[player:GetId()] = {touched = false, allowed = true}
end
-- needed so that people who switch team are removed from the cap room collection properly.
function player_switchteam ( player, oldteam, newteam )
if oldteam == attackers then
base_zone_trigger:onendtouch( player )
end
return true
end
-- on player killed
function player_killed ( player, damageinfo )
-- if no damageinfo do nothing
if not damageinfo then return end
-- Entity that is attacking
local attacker = damageinfo:GetAttacker()
-- If no attacker do nothing
if not attacker then return end
local player_attacker = nil
-- get the attacking player
if IsPlayer(attacker) then
attacker = CastToPlayer(attacker)
player_attacker = attacker
elseif IsSentrygun(attacker) then
attacker = CastToSentrygun(attacker)
player_attacker = attacker:GetOwner()
elseif IsDetpack(attacker) then
attacker = CastToDetpack(attacker)
player_attacker = attacker:GetOwner()
elseif IsDispenser(attacker) then
attacker = CastToDispenser(attacker)
player_attacker = attacker:GetOwner()
else
return
end
-- if still no attacking player after all that, forget about it
if not player_attacker then return end
-- If player killed self or teammate do nothing
if (player:GetId() == player_attacker:GetId()) or (player:GetTeamId() == player_attacker:GetTeamId()) then
return
end
-- If player is an attacker, then do stuff
if player:GetTeamId() == attackers then
-- Check if he's in the cap point
for playerx in zone_collection.items do
playerx = CastToPlayer(playerx)
if playerx:GetId() == player:GetId() then
player_attacker:AddFortPoints( FORT_POINTS_PER_DEFEND, "Defending the Point" )
-- for safety, remove player from collection
zone_collection:RemoveItem( player )
-- also for safety, if no more players, reset the cap
if zone_collection:Count() == 0 then
update_zone_all( )
zone_turnoff( phase )
end
return
end
end
end
end
function player_ondamage ( player, damageinfo )
-- if no damageinfo do nothing
if not damageinfo then return end
-- Get Damage Force
local damage = damageinfo:GetDamage()
-- Entity that is attacking
local attacker = damageinfo:GetAttacker()
-- If no attacker do nothing
if not attacker then return end
local player_attacker = nil
-- get the attacking player
if IsPlayer(attacker) then
attacker = CastToPlayer(attacker)
player_attacker = attacker
elseif IsSentrygun(attacker) then
attacker = CastToSentrygun(attacker)
player_attacker = attacker:GetOwner()
elseif IsDetpack(attacker) then
attacker = CastToDetpack(attacker)
player_attacker = attacker:GetOwner()
elseif IsDispenser(attacker) then
attacker = CastToDispenser(attacker)
player_attacker = attacker:GetOwner()
else
return
end
-- if still no attacking player after all that, forget about it
if not player_attacker then return end
-- If player killed self or teammate do nothing
if (player:GetId() == player_attacker:GetId()) or (player:GetTeamId() == player_attacker:GetTeamId()) then
return
end
-- If player is an attacker, then do stuff
if player:GetTeamId() == attackers then
-- Check if he's in the cap point
for playerx in zone_collection.items do
playerx = CastToPlayer(playerx)
if playerx:GetId() == player:GetId() then
if (damage > 100) then damage = 100 end
player_attacker:AddFortPoints( damage, "Protecting the Point" )
return
end
end
end
end
-----------------------------------------------------------------------------
-- on cap
-----------------------------------------------------------------------------
function zone_cap( cap_phase )
zone_collection:RemoveAllItems()
zone_turnoff( phase )
zone_points = 0
-- reset touches
for playerx, recordx in pairs(playerTouchedTable) do
if GetPlayerByID( playerx ) then
local playert = GetPlayerByID( playerx )
if ( playert:GetTeamId() == attackers ) then
-- add to table and reset touched to 0
playerTouchedTable[playert:GetId()] = {touched = false, allowed = true}
end
end
end
draw_hud = false
if phase == NUMBER_OF_CAP_POINTS then
onreset_outputs()
-- it's the last round. end and stuff
phase = 1
-- run custom round reset stuff
AddSchedule( "onroundreset_sched", DELAY_BEFORE_TEAMSWITCH, onroundreset )
else
oncap_outputs()
phase = phase + 1
AddSchedule( "aftercap_sched", DELAY_AFTER_CAP, oncap_outputs_nextphase )
AddSchedule( "aftercap_sched2", DELAY_AFTER_CAP, oncap_nextphase )
end
update_zone_all( )
end
-----------------------------------------------------------------------------
-- round functions
-----------------------------------------------------------------------------
-- Opens the gates and schedules the round's end.
function round_start()
-- Opens the gates and all that lovely stuff
OpenDoor("frontgate")
BroadCastMessage( "#FF_AD_GATESOPEN" )
BroadCastSound( "otherteam.flagstolen" )
SpeakAll( "AD_GATESOPEN" )
openstartdoor()
end
-- Checks to see if it's the first or second round, then either swaps teams, or ends the game.
function onroundreset()
if attackers == Team.kBlue then
attackers = Team.kRed
defenders = Team.kBlue
onswitch_bluetodef()
else
attackers = Team.kBlue
defenders = Team.kRed
onswitch_redtodef()
end
-- objective icon
UpdateTeamObjectiveIcon( GetTeam(attackers), nil )
UpdateTeamObjectiveIcon( GetTeam(defenders), nil )
-- switch them team names
SetTeamName( attackers, "Attackers" )
SetTeamName( defenders, "Defenders" )
-- reset them limits
team = GetTeam(defenders)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, -1)
team:SetClassLimit(Player.kMedic, -1)
team = GetTeam(attackers)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kScout, 0)
team:SetClassLimit(Player.kMedic, 0)
-- reset schedules
AddSchedule( "round_start", INITIAL_ROUND_PERIOD, round_start)
-- reset player touched table
playerTouchedTable = {}
-- remove all leftovers from the cap point collection
zone_collection:RemoveAllItems()
-- respawn the players
RespawnAllPlayers()
-- MORE scheduled message loveliness.
if INITIAL_ROUND_PERIOD > 30 then AddSchedule( "dooropen30sec" , INITIAL_ROUND_PERIOD - 30 , schedulemessagetoall, "#ADZ_30SecWarning" ) end
if INITIAL_ROUND_PERIOD > 10 then AddSchedule( "dooropen10sec" , INITIAL_ROUND_PERIOD - 10 , schedulemessagetoall, "#ADZ_10SecWarning" ) end
-- sounds
if INITIAL_ROUND_PERIOD > 10 then AddSchedule( "dooropen30secsound" , INITIAL_ROUND_PERIOD - 30 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_PERIOD > 10 then AddSchedule( "dooropen10secsound" , INITIAL_ROUND_PERIOD - 10 , schedulesound, "misc.bloop" ) end
if INITIAL_ROUND_PERIOD > 5 then AddSchedule( "dooropen5seccount" , INITIAL_ROUND_PERIOD - 5 , schedulecountdown, 5 ) end
if INITIAL_ROUND_PERIOD > 4 then AddSchedule( "dooropen4seccount" , INITIAL_ROUND_PERIOD - 4 , schedulecountdown, 4 ) end
if INITIAL_ROUND_PERIOD > 3 then AddSchedule( "dooropen3seccount" , INITIAL_ROUND_PERIOD - 3 , schedulecountdown, 3 ) end
if INITIAL_ROUND_PERIOD > 2 then AddSchedule( "dooropen2seccount" , INITIAL_ROUND_PERIOD - 2 , schedulecountdown, 2 ) end
if INITIAL_ROUND_PERIOD > 1 then AddSchedule( "dooropen1seccount" , INITIAL_ROUND_PERIOD - 1 , schedulecountdown, 1 ) end
DeleteSchedule( "defense_period_scoring_sched" )
AddScheduleRepeating( "defense_period_scoring_sched", DEFENSE_PERIOD_TIME, defenders_scoring )
draw_hud = true
update_zone_all( )
onswitch()
end
-----------------------------------------------------------------------------
-- zone functions
-----------------------------------------------------------------------------
function zone_turnon( cp_num )
zone_on_outputs()
-- init scoring
AddSchedule( "period_init", DELAY_BEFORE_PERIOD_POINTS, init_scoring, team )
AddSchedule( "period_init_alarm", DELAY_BEFORE_PERIOD_POINTS - 1, init_scoring_alarm )
end
function zone_turnoff( cp_num )
zone_off_outputs()
-- stop scoring
zone_scoring = false
end
function oncap_nextphase()
draw_hud = true
update_zone_all( )
-- update objective icon
local attackers_objective = GetEntityByName( "zone"..phase )
UpdateTeamObjectiveIcon( GetTeam(attackers), attackers_objective )
UpdateTeamObjectiveIcon( GetTeam(defenders), nil )
end
-----------------------------------------------------------------------------
-- output functions
-----------------------------------------------------------------------------
function zone_on_outputs()
return
end
function zone_off_outputs()
return
end
function onswitch_bluetodef()
return
end
function onswitch_redtodef()
return
end
function onswitch()
return
end
function openstartdoor()
return
end
function oncap_outputs()
return
end
function oncap_outputs_nextphase()
return
end
function onreset_outputs()
return
end
-----------------------------------------------------------------------------
-- hud
-----------------------------------------------------------------------------
function update_zone_all( )
RemoveHudItemFromAll( "Zone_Status" )
RemoveHudItemFromAll( "Zone_Status_BG" )
RemoveHudItemFromAll( "Zone_Status_Points" )
RemoveHudItemFromAll( "Zone_Team"..attackers )
RemoveHudItemFromAll( "Zone_Team"..defenders )
RemoveHudItemFromAll( "Zone_Team_Text"..attackers )
RemoveHudItemFromAll( "Zone_Team_Text"..defenders )
if draw_hud then
AddHudIconToAll( "hud_statusbar_256.vtf", "Zone_Status_BG", -64, 36, 128, 16, 3 )
AddHudTextToTeam( GetTeam(attackers), "Zone_Team_Text"..attackers, "Attacking Zone "..phase, 33, 56, 4, 0 )
AddHudTextToTeam( GetTeam(defenders), "Zone_Team_Text"..defenders, "Defending Zone "..phase, 33, 56, 4, 0 )
AddHudTextToAll( "Zone_Status_Points", zone_points.." / "..zone_max_points, 40, 56, 2, 0 )
AddHudIconToTeam( GetTeam(attackers), "hud_offense.vtf", "Zone_Team"..attackers, -92, 38, 24, 24, 3 )
AddHudIconToTeam( GetTeam(defenders), "hud_defense.vtf", "Zone_Team"..defenders, -92, 38, 24, 24, 3 )
local max_width = 124
if zone_points > 0 then
bar_width = zone_points / zone_max_points * max_width
if zone_collection:Count() > 0 then
AddHudIconToAll( "hud_statusbar_"..ZONE_COLOR.."_active.vtf", "Zone_Status", -62, 36, bar_width, 16, 3 )
else
AddHudIconToAll( "hud_statusbar_"..ZONE_COLOR..".vtf", "Zone_Status", -62, 36, bar_width, 16, 3 )
end
end
end
end
function update_zone_player( player )
RemoveHudItem( player, "Zone_Status" )
RemoveHudItem( player, "Zone_Status_BG" )
RemoveHudItem( player, "Zone_Status_Points" )
RemoveHudItem( player, "Zone_Team"..attackers )
RemoveHudItem( player, "Zone_Team"..defenders )
RemoveHudItem( player, "Zone_Team_Text"..attackers )
RemoveHudItem( player, "Zone_Team_Text"..defenders )
if draw_hud then
AddHudIcon( player, "hud_statusbar_256.vtf", "Zone_Status_BG", -64, 36, 128, 16, 3 )
AddHudText( player, "Zone_Status_Points", zone_points.." / "..zone_max_points, 40, 56, 2, 0 )
if player:GetTeamId() == attackers then
AddHudIcon( player, "hud_offense.vtf", "Zone_Team"..attackers, -92, 38, 24, 24, 3 )
AddHudText( player, "Zone_Team_Text"..attackers, "Attacking Zone "..phase, 33, 56, 4, 0 )
else
AddHudIcon( player, "hud_defense.vtf", "Zone_Team"..defenders, -92, 38, 24, 24, 3 )
AddHudText( player, "Zone_Team_Text"..defenders, "Defending Zone "..phase, 33, 56, 4, 0 )
end
local max_width = 124
if zone_points > 0 then
bar_width = zone_points / zone_max_points * max_width
if zone_collection:Count() > 0 then
AddHudIcon( player, "hud_statusbar_"..ZONE_COLOR.."_active.vtf", "Zone_Status", -62, 36, bar_width, 16, 3 )
else
AddHudIcon( player, "hud_statusbar_"..ZONE_COLOR..".vtf", "Zone_Status", -62, 36, bar_width, 16, 3 )
end
end
end
end
-----------------------------------------------------------------------------
-- base_zone_trigger
-----------------------------------------------------------------------------
-- capture room
base_zone_trigger = trigger_ff_script:new({ phase = 0, pointstocap = DEFAULT_POINTS_TO_CAP })
zone1 = base_zone_trigger:new({phase=1})
zone2 = base_zone_trigger:new({phase=2})
zone3 = base_zone_trigger:new({phase=3})
zone4 = base_zone_trigger:new({phase=4})
zone5 = base_zone_trigger:new({phase=5})
zone6 = base_zone_trigger:new({phase=6})
zone7 = base_zone_trigger:new({phase=7})
zone8 = base_zone_trigger:new({phase=8})
-- registers attackers as they enter the cap room
function base_zone_trigger:ontouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
if phase ~= self.phase then return end
if player:GetTeamId() == defenders then return end
player:SetCloakable( false )
player:SetDisguisable( false )
update_zone_all( )
local playerid = player:GetId()
zone_collection:AddItem( player )
local team = GetTeam(attackers)
-- if it's the first touch, give points and stuff
if playerTouchedTable[playerid].touched == false then
team:AddScore( POINTS_PER_INITIAL_TOUCH )
player:AddFortPoints( FORT_POINTS_PER_INITIAL_TOUCH, "Initial Point Touch" )
zone_points = zone_points + POINTS_PER_INITIAL_TOUCH
update_zone_all( )
if zone_points >= self.pointstocap then
zone_cap( self.phase )
return
end
SmartTeamSound( GetTeam(defenders), "yourteam.flagreturn", "misc.doop" )
playerTouchedTable[playerid].touched = true
elseif zone_collection:Count() == 1 then
SmartTeamSound( GetTeam(defenders), "otherteam.drop", nil )
end
if zone_collection:Count() == 1 then
-- activate the cap point, bro
update_zone_all( )
zone_turnon( self.phase )
end
end
end
-- deregisters attackers as they enter the cap room. Checks to see if all attackers have left.
function base_zone_trigger:onendtouch( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
if player:GetTeamId() == defenders then return end
player:SetCloakable( true )
player:SetDisguisable( true )
zone_collection:RemoveItem( player )
local team = GetTeam(defenders)
if zone_collection:Count() == 0 then
update_zone_all( )
zone_turnoff( self.phase )
end
end
end
-- empties the collection if no-one in in the room. Shouldn't really be nessecary.
function base_zone_trigger:oninactive()
-- Clear out the flags in the collection
DeleteSchedule( "period_scoring" )
DeleteSchedule( "period_init" )
DeleteSchedule( "period_init_alarm" )
zone_collection:RemoveAllItems()
update_zone_status( false )
zone_turnoff( self.phase )
end
-----------------------------------------------------------------------------
-- scoring
-----------------------------------------------------------------------------
-- Adds points based on time inside cap room and number of attackers inside cap room
function period_scoring( )
if zone_scoring then
local team = GetTeam( attackers )
team:AddScore( POINTS_PER_PERIOD )
zone_points = zone_points + POINTS_PER_PERIOD
update_zone_all( )
SmartTeamSound( GetTeam(defenders), "yourteam.flagreturn", "misc.doop" )
for player in zone_collection.items do
player = CastToPlayer(player)
if player ~= nil then
player:AddFortPoints( FORT_POINTS_PER_PERIOD, "Touching the Point" )
else
ConsoleToAll("LUA ERROR: player_addfortpoints: Unable to find player")
end
end
end
-- cap zone if the points say to
if zone_points >= zone_max_points then
zone_cap( phase )
end
end
-- Initializes the period_scoring (allows for a delay after initial touch)
function init_scoring( team )
if zone_collection:Count() > 0 then
zone_scoring = true
end
end
-- Initializes the period_scoring (allows for a delay after initial touch)
function init_scoring_alarm( )
if zone_collection:Count() > 0 then
SmartTeamSound( GetTeam(defenders), "otherteam.drop", nil )
end
end
-- Adds points based on time inside cap room and number of attackers inside cap room
function defenders_scoring( )
local team = GetTeam( defenders )
team:AddScore( POINTS_PER_DEFENSE_PERIOD )
end
-----------------------------------------------------------------------------
-- misc functions
-----------------------------------------------------------------------------
-- Sends a message to all after the determined time
function schedulechangemessage( player, message )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
BroadCastMessageToPlayer( player, message )
end
end
-- reset everything
function RespawnAllPlayers()
ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips, AT.kAllowRespawn, AT.kReturnDroppedItems })
end
-- force a scout/med to switch to soli if they haven't
function forcechange( player )
if (player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic) and (player:GetTeamId() == defenders) then
ApplyToPlayer( player, { AT.kChangeClassSoldier, AT.kRespawnPlayers } )
end
end
-- Sends a message to all after the determined time
function schedulemessagetoall( message )
BroadCastMessage( message )
end
-- Plays a sound to all after the determined time
function schedulesound( sound )
BroadCastSound( sound )
end
function schedulecountdown( time )
BroadCastMessage( ""..time.."" )
SpeakAll( "AD_" .. time .. "SEC" )
end
-----------------------------------------------------------------------------
-- Entity definitions (flags/command points/backpacks etc.)
-----------------------------------------------------------------------------
-- respawns
base_attacker_spawn = info_ff_teamspawn:new({ phase = 0, validspawn = function(self,player)
return player:GetTeamId() == attackers and phase == self.phase
end })
base_defender_spawn = info_ff_teamspawn:new({ phase = 0, validspawn = function(self,player)
return player:GetTeamId() == defenders and phase == self.phase
end })
zone1_attacker = base_attacker_spawn:new({phase=1})
zone2_attacker = base_attacker_spawn:new({phase=2})
zone3_attacker = base_attacker_spawn:new({phase=3})
zone4_attacker = base_attacker_spawn:new({phase=4})
zone5_attacker = base_attacker_spawn:new({phase=5})
zone6_attacker = base_attacker_spawn:new({phase=6})
zone7_attacker = base_attacker_spawn:new({phase=7})
zone8_attacker = base_attacker_spawn:new({phase=8})
zone1_defender = base_defender_spawn:new({phase=1})
zone2_defender = base_defender_spawn:new({phase=2})
zone3_defender = base_defender_spawn:new({phase=3})
zone4_defender = base_defender_spawn:new({phase=4})
zone5_defender = base_defender_spawn:new({phase=5})
zone6_defender = base_defender_spawn:new({phase=6})
zone7_defender = base_defender_spawn:new({phase=7})
zone8_defender = base_defender_spawn:new({phase=8})
-- generic respawns
attacker_spawn = info_ff_teamspawn:new({ validspawn = function(self,player)
return player:GetTeamId() == attackers
end })
defender_spawn = info_ff_teamspawn:new({ validspawn = function(self,player)
return player:GetTeamId() == defenders
end })
-----------------------------------------------------------------------------
-- Generic Backpack
-----------------------------------------------------------------------------
genericbackpack = info_ff_script:new({
health = 0,
armor = 0,
grenades = 0,
shells = 0,
nails = 0,
rockets = 0,
cells = 0,
detpacks = 0,
mancannons = 0,
gren1 = 0,
gren2 = 0,
respawntime = 5,
model = "models/items/healthkit.mdl",
materializesound = "Item.Materialize",
touchsound = "HealthKit.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen}
})
function genericbackpack:dropatspawn() return false end
function genericbackpack:precache( )
-- precache sounds
PrecacheSound(self.materializesound)
PrecacheSound(self.touchsound)
-- precache models
PrecacheModel(self.model)
end
function genericbackpack:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
local dispensed = 0
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then dispensed = dispensed + player:AddHealth( self.health ) end
if self.armor ~= nil and self.armor ~= 0 then dispensed = dispensed + player:AddArmor( self.armor ) end
-- give player ammo
if self.nails ~= nil and self.nails ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren2, self.gren2) end
-- if the player took ammo, then have the backpack respawn with a delay
if dispensed >= 1 then
local backpack = CastToInfoScript(entity);
if backpack then
backpack:EmitSound(self.touchsound);
backpack:Respawn(self.respawntime);
end
end
end
end
function genericbackpack:materialize( )
entity:EmitSound(self.materializesound)
end
-- from http://www.lua.org/pil/14.1.html
function getfield (f)
local v = _G -- start with the table of globals
for w in string.gfind(f, "[%w_]+") do
v = v[w]
end
return v
end
function setfield (f, v)
local t = _G -- start with the table of globals
for w, d in string.gfind(f, "([%w_]+)(.?)") do
if d == "." then -- not last field?
t[w] = t[w] or {} -- create table if absent
t = t[w] -- get the table
else -- last field
t[w] = v -- do the assignment
end
end
end

View file

@ -0,0 +1,222 @@
-- base_location.lua
-----------------------------------------------------------------------------
-- Include this file to add base location functionality to your map
-- DO NOT ALTER THIS FILE
-----------------------------------------------------------------------------
location_info = trigger_ff_script:new({ text = "Unknown", team = Team.kUnassigned })
function location_info:ontouch( touch_entity )
-- set the location of the player
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
player:SetLocation(entity:GetId(), self.text, self.team)
end
end
-- Locations were randomly screwing up when you move between them. I removed this and it appears to have completely fixed it.
-- I am not familiar with all this though, so someone who knows btr should check it over please (caesium).
--function location_info:onendtouch( touch_entity )
-- remove the location from the player
-- if IsPlayer( touch_entity ) then
-- local player = CastToPlayer( touch_entity )
-- player:RemoveLocation(entity:GetId())
-- end
--end
-----------------------------------------------------------------------------
-- Some common locations
-- PREFIX locations with the word "location_" (or just follow the same style as below!)
-----------------------------------------------------------------------------
location_attic = location_info:new({ text = "#FF_LOCATION_ATTIC", team = Team.kUnassigned })
location_blue_attic = location_info:new({ text = "#FF_LOCATION_ATTIC", team = Team.kBlue })
location_red_attic = location_info:new({ text = "#FF_LOCATION_ATTIC", team = Team.kRed })
location_yellow_attic = location_info:new({ text = "#FF_LOCATION_ATTIC", team = Team.kYellow })
location_green_attic = location_info:new({ text = "#FF_LOCATION_ATTIC", team = Team.kGreen })
location_base = location_info:new({ text = "#FF_LOCATION_BASE", team = Team.kUnassigned })
location_blue_base = location_info:new({ text = "#FF_LOCATION_BASE", team = Team.kBlue })
location_red_base = location_info:new({ text = "#FF_LOCATION_BASE", team = Team.kRed })
location_yellow_base = location_info:new({ text = "#FF_LOCATION_BASE", team = Team.kYellow })
location_green_base = location_info:new({ text = "#FF_LOCATION_BASE", team = Team.kGreen })
location_balcony = location_info:new({ text = "#FF_LOCATION_BALCONY", team = Team.kUnassigned })
location_blue_balcony = location_info:new({ text = "#FF_LOCATION_BALCONY", team = Team.kBlue })
location_red_balcony = location_info:new({ text = "#FF_LOCATION_BALCONY", team = Team.kRed })
location_yellow_balcony = location_info:new({ text = "#FF_LOCATION_BALCONY", team = Team.kYellow })
location_green_balcony = location_info:new({ text = "#FF_LOCATION_BALCONY", team = Team.kGreen })
location_battlements = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kUnassigned })
location_blue_battlements = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kBlue })
location_red_battlements = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kRed })
location_yellow_battlements = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kYellow })
location_green_battlements = location_info:new({ text = "#FF_LOCATION_BATTLEMENTS", team = Team.kGreen })
location_bunker = location_info:new({ text = "#FF_LOCATION_BUNKER", team = Team.kUnassigned })
location_blue_bunker = location_info:new({ text = "#FF_LOCATION_BUNKER", team = Team.kBlue })
location_red_bunker = location_info:new({ text = "#FF_LOCATION_BUNKER", team = Team.kRed })
location_yellow_bunker = location_info:new({ text = "#FF_LOCATION_BUNKER", team = Team.kYellow })
location_green_bunker = location_info:new({ text = "#FF_LOCATION_BUNKER", team = Team.kGreen })
location_button = location_info:new({ text = "#FF_LOCATION_BUTTON", team = Team.kUnassigned })
location_blue_button = location_info:new({ text = "#FF_LOCATION_BUTTON", team = Team.kBlue })
location_red_button = location_info:new({ text = "#FF_LOCATION_BUTTON", team = Team.kRed })
location_yellow_button = location_info:new({ text = "#FF_LOCATION_BUTTON", team = Team.kYellow })
location_green_button = location_info:new({ text = "#FF_LOCATION_BUTTON", team = Team.kGreen })
location_cappoint = location_info:new({ text = "#FF_LOCATION_CAPPOINT", team = Team.kUnassigned })
location_blue_cappoint = location_info:new({ text = "#FF_LOCATION_CAPPOINT", team = Team.kBlue })
location_red_cappoint = location_info:new({ text = "#FF_LOCATION_CAPPOINT", team = Team.kRed })
location_yellow_cappoint = location_info:new({ text = "#FF_LOCATION_CAPPOINT", team = Team.kYellow })
location_green_cappoint = location_info:new({ text = "#FF_LOCATION_CAPPOINT", team = Team.kGreen })
location_elevator = location_info:new({ text = "#FF_LOCATION_ELEVATOR", team = Team.kUnassigned })
location_blue_elevator = location_info:new({ text = "#FF_LOCATION_ELEVATOR", team = Team.kBlue })
location_red_elevator = location_info:new({ text = "#FF_LOCATION_ELEVATOR", team = Team.kRed })
location_yellow_elevator = location_info:new({ text = "#FF_LOCATION_ELEVATOR", team = Team.kYellow })
location_green_elevator = location_info:new({ text = "#FF_LOCATION_ELEVATOR", team = Team.kGreen })
location_flagroom = location_info:new({ text = "#FF_LOCATION_FLAGROOM", team = Team.kUnassigned })
location_blue_flagroom = location_info:new({ text = "#FF_LOCATION_FLAGROOM", team = Team.kBlue })
location_red_flagroom = location_info:new({ text = "#FF_LOCATION_FLAGROOM", team = Team.kRed })
location_yellow_flagroom = location_info:new({ text = "#FF_LOCATION_FLAGROOM", team = Team.kYellow })
location_green_flagroom = location_info:new({ text = "#FF_LOCATION_FLAGROOM", team = Team.kGreen })
location_frontdoor = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kUnassigned })
location_blue_frontdoor = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kBlue })
location_red_frontdoor = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kRed })
location_yellow_frontdoor = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kYellow })
location_green_frontdoor = location_info:new({ text = "#FF_LOCATION_FRONTDOOR", team = Team.kGreen })
location_lift = location_info:new({ text = "#FF_LOCATION_LIFT", team = Team.kUnassigned })
location_blue_lift = location_info:new({ text = "#FF_LOCATION_LIFT", team = Team.kBlue })
location_red_lift = location_info:new({ text = "#FF_LOCATION_LIFT", team = Team.kRed })
location_yellow_lift = location_info:new({ text = "#FF_LOCATION_LIFT", team = Team.kYellow })
location_green_lift = location_info:new({ text = "#FF_LOCATION_LIFT", team = Team.kGreen })
location_loft = location_info:new({ text = "#FF_LOCATION_LOFT", team = Team.kUnassigned })
location_blue_loft = location_info:new({ text = "#FF_LOCATION_LOFT", team = Team.kBlue })
location_red_loft = location_info:new({ text = "#FF_LOCATION_LOFT", team = Team.kRed })
location_yellow_loft = location_info:new({ text = "#FF_LOCATION_LOFT", team = Team.kYellow })
location_green_loft = location_info:new({ text = "#FF_LOCATION_LOFT", team = Team.kGreen })
location_pit = location_info:new({ text = "#FF_LOCATION_PIT", team = Team.kUnassigned })
location_blue_pit = location_info:new({ text = "#FF_LOCATION_PIT", team = Team.kBlue })
location_red_pit = location_info:new({ text = "#FF_LOCATION_PIT", team = Team.kRed })
location_yellow_pit = location_info:new({ text = "#FF_LOCATION_PIT", team = Team.kYellow })
location_green_pit = location_info:new({ text = "#FF_LOCATION_PIT", team = Team.kGreen })
location_plank = location_info:new({ text = "#FF_LOCATION_PLANK", team = Team.kUnassigned })
location_blue_plank = location_info:new({ text = "#FF_LOCATION_PLANK", team = Team.kBlue })
location_red_plank = location_info:new({ text = "#FF_LOCATION_PLANK", team = Team.kRed })
location_yellow_plank = location_info:new({ text = "#FF_LOCATION_PLANK", team = Team.kYellow })
location_green_plank = location_info:new({ text = "#FF_LOCATION_PLANK", team = Team.kGreen })
location_ramp = location_info:new({ text = "#FF_LOCATION_RAMP", team = Team.kUnassigned })
location_blue_ramp = location_info:new({ text = "#FF_LOCATION_RAMP", team = Team.kBlue })
location_red_ramp = location_info:new({ text = "#FF_LOCATION_RAMP", team = Team.kRed })
location_yellow_ramp = location_info:new({ text = "#FF_LOCATION_RAMP", team = Team.kYellow })
location_green_ramp = location_info:new({ text = "#FF_LOCATION_RAMP", team = Team.kGreen })
location_ramp_bottom = location_info:new({ text = "#FF_LOCATION_RAMP_BOTTOM", team = Team.kUnassigned })
location_blue_ramp_bottom = location_info:new({ text = "#FF_LOCATION_RAMP_BOTTOM", team = Team.kBlue })
location_red_ramp_bottom = location_info:new({ text = "#FF_LOCATION_RAMP_BOTTOM", team = Team.kRed })
location_yellow_ramp_bottom = location_info:new({ text = "#FF_LOCATION_RAMP_BOTTOM", team = Team.kYellow })
location_green_ramp_bottom = location_info:new({ text = "#FF_LOCATION_RAMP_BOTTOM", team = Team.kGreen })
location_ramp_top = location_info:new({ text = "#FF_LOCATION_RAMP_TOP", team = Team.kUnassigned })
location_blue_ramp_top = location_info:new({ text = "#FF_LOCATION_RAMP_TOP", team = Team.kBlue })
location_red_ramp_top = location_info:new({ text = "#FF_LOCATION_RAMP_TOP", team = Team.kRed })
location_yellow_ramp_top = location_info:new({ text = "#FF_LOCATION_RAMP_TOP", team = Team.kYellow })
location_green_ramp_top = location_info:new({ text = "#FF_LOCATION_RAMP_TOP", team = Team.kGreen })
location_ramproom = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kUnassigned })
location_blue_ramproom = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kBlue })
location_red_ramproom = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kRed })
location_yellow_ramproom = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kYellow })
location_green_ramproom = location_info:new({ text = "#FF_LOCATION_RAMPROOM", team = Team.kGreen })
location_respawn = location_info:new({ text = "#FF_LOCATION_RESPAWN", team = Team.kUnassigned })
location_blue_respawn = location_info:new({ text = "#FF_LOCATION_RESPAWN", team = Team.kBlue })
location_red_respawn = location_info:new({ text = "#FF_LOCATION_RESPAWN", team = Team.kRed })
location_yellow_respawn = location_info:new({ text = "#FF_LOCATION_RESPAWN", team = Team.kYellow })
location_green_respawn = location_info:new({ text = "#FF_LOCATION_RESPAWN", team = Team.kGreen })
location_roof = location_info:new({ text = "#FF_LOCATION_ROOF", team = Team.kUnassigned })
location_blue_roof = location_info:new({ text = "#FF_LOCATION_ROOF", team = Team.kBlue })
location_red_roof = location_info:new({ text = "#FF_LOCATION_ROOF", team = Team.kRed })
location_yellow_roof = location_info:new({ text = "#FF_LOCATION_ROOF", team = Team.kYellow })
location_green_roof = location_info:new({ text = "#FF_LOCATION_ROOF", team = Team.kGreen })
location_security = location_info:new({ text = "#FF_LOCATION_SECURITY", team = Team.kUnassigned })
location_blue_security = location_info:new({ text = "#FF_LOCATION_SECURITY", team = Team.kBlue })
location_red_security = location_info:new({ text = "#FF_LOCATION_SECURITY", team = Team.kRed })
location_yellow_security = location_info:new({ text = "#FF_LOCATION_SECURITY", team = Team.kYellow })
location_green_security = location_info:new({ text = "#FF_LOCATION_SECURITY", team = Team.kGreen })
location_sniper_perch = location_info:new({ text = "#FF_LOCATION_SNIPER_PERCH", team = Team.kUnassigned })
location_blue_sniper_perch = location_info:new({ text = "#FF_LOCATION_SNIPER_PERCH", team = Team.kBlue })
location_red_sniper_perch = location_info:new({ text = "#FF_LOCATION_SNIPER_PERCH", team = Team.kRed })
location_yellow_sniper_perch = location_info:new({ text = "#FF_LOCATION_SNIPER_PERCH", team = Team.kYellow })
location_green_sniper_perch = location_info:new({ text = "#FF_LOCATION_SNIPER_PERCH", team = Team.kGreen })
location_spiral = location_info:new({ text = "#FF_LOCATION_SPIRAL", team = Team.kUnassigned })
location_blue_spiral = location_info:new({ text = "#FF_LOCATION_SPIRAL", team = Team.kBlue })
location_red_spiral = location_info:new({ text = "#FF_LOCATION_SPIRAL", team = Team.kRed })
location_yellow_spiral = location_info:new({ text = "#FF_LOCATION_SPIRAL", team = Team.kYellow })
location_green_spiral = location_info:new({ text = "#FF_LOCATION_SPIRAL", team = Team.kGreen })
location_switch = location_info:new({ text = "#FF_LOCATION_SWITCH", team = Team.kUnassigned })
location_blue_switch = location_info:new({ text = "#FF_LOCATION_SWITCH", team = Team.kBlue })
location_red_switch = location_info:new({ text = "#FF_LOCATION_SWITCH", team = Team.kRed })
location_yellow_switch = location_info:new({ text = "#FF_LOCATION_SWITCH", team = Team.kYellow })
location_green_switch = location_info:new({ text = "#FF_LOCATION_SWITCH", team = Team.kGreen })
location_t = location_info:new({ text = "#FF_LOCATION_T", team = Team.kUnassigned })
location_blue_t = location_info:new({ text = "#FF_LOCATION_T", team = Team.kBlue })
location_red_t = location_info:new({ text = "#FF_LOCATION_T", team = Team.kRed })
location_yellow_t = location_info:new({ text = "#FF_LOCATION_T", team = Team.kYellow })
location_green_t = location_info:new({ text = "#FF_LOCATION_T", team = Team.kGreen })
location_train_tunnel = location_info:new({ text = "#FF_LOCATION_TRAIN_TUNNEL", team = Team.kUnassigned })
location_blue_train_tunnel = location_info:new({ text = "#FF_LOCATION_TRAIN_TUNNEL", team = Team.kBlue })
location_red_train_tunnel = location_info:new({ text = "#FF_LOCATION_TRAIN_TUNNEL", team = Team.kRed })
location_yellow_train_tunnel = location_info:new({ text = "#FF_LOCATION_TRAIN_TUNNEL", team = Team.kYellow })
location_green_train_tunnel = location_info:new({ text = "#FF_LOCATION_TRAIN_TUNNEL", team = Team.kGreen })
location_underground = location_info:new({ text = "#FF_LOCATION_UNDERGROUND", team = Team.kUnassigned })
location_blue_underground = location_info:new({ text = "#FF_LOCATION_UNDERGROUND", team = Team.kBlue })
location_red_underground = location_info:new({ text = "#FF_LOCATION_UNDERGROUND", team = Team.kRed })
location_yellow_underground = location_info:new({ text = "#FF_LOCATION_UNDERGROUND", team = Team.kYellow })
location_green_underground = location_info:new({ text = "#FF_LOCATION_UNDERGROUND", team = Team.kGreen })
location_waterroute = location_info:new({ text = "#FF_LOCATION_WATERROUTE", team = Team.kUnassigned })
location_blue_waterroute = location_info:new({ text = "#FF_LOCATION_WATERROUTE", team = Team.kBlue })
location_red_waterroute = location_info:new({ text = "#FF_LOCATION_WATERROUTE", team = Team.kRed })
location_yellow_waterroute = location_info:new({ text = "#FF_LOCATION_WATERROUTE", team = Team.kYellow })
location_green_waterroute = location_info:new({ text = "#FF_LOCATION_WATERROUTE", team = Team.kGreen })
location_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kUnassigned })
location_blue_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kBlue })
location_red_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kRed })
location_yellow_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kYellow })
location_green_yard = location_info:new({ text = "#FF_LOCATION_YARD", team = Team.kGreen })
-- Generic Invade/Defend Locations
location_attackerspawn = location_info:new({ text = "#FF_LOCATION_ATTACKER_SPAWN", team = Team.kUnassigned })
location_defenderspawn = location_info:new({ text = "#FF_LOCATION_DEFENDER_SPAWN", team = Team.kUnassigned })
location_commandpointone = location_info:new({ text = "#FF_LOCATION_COMMAND_POINT_ONE", team = Team.kUnassigned })
location_commandpointtwo = location_info:new({ text = "#FF_LOCATION_COMMAND_POINT_TWO", team = Team.kUnassigned })
location_commandpointthree = location_info:new({ text = "#FF_LOCATION_COMMAND_POINT_THREE", team = Team.kUnassigned })
location_commandpointfour = location_info:new({ text = "#FF_LOCATION_COMMAND_POINT_FOUR", team = Team.kUnassigned })
location_detpack_hole = location_info:new({ text = "#FF_LOCATION_DETPACK_HOLE", team = Team.kUnassigned })

351
maps/includes/base_push.lua Normal file
View file

@ -0,0 +1,351 @@
-- base_push.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
IncludeScript("base_location");
IncludeScript("base_respawnturret");
BALL_THROW_SPEED = 512;
BALL_RETURN_TIME = 120;
-----------------------------------------------------------------------------
-- Some Global Stuff!
-----------------------------------------------------------------------------
function startup()
SetGameDescription( "Push" )
-- set up team limits on each team
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)
-- push maps generally don't have civilians, so override in map LUA file if you want 'em
local team = GetTeam( Team.kBlue )
team:SetClassLimit( Player.kCivilian, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
local team = GetTeam( Team.kRed )
team:SetClassLimit( Player.kCivilian, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
end
-- Give everyone a full resupply, but strip grenades
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 100 )
player:AddArmor( 300 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )
player:RemoveAmmo( Ammo.kGren1, 4 )
player:RemoveAmmo( Ammo.kGren2, 4 )
end
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- backpacks
-----------------------------------------------------------------------------
push_backpack = genericbackpack:new({
health = 25,
armor = 50,
touchsound = "ArmorKit.Touch",
respawntime = 10,
model = "models/items/backpack/backpack.mdl",
botgoaltype = Bot.kBackPack_Health
})
function push_backpack:dropatspawn() return false end
-----------------------------------------------------------------------------
-- base_ball
-----------------------------------------------------------------------------
base_ball = info_ff_script:new({
name = "base ball",
team = Team.kUnassigned,
model = "models/items/ball/ball.mdl",
modelskin = 0,
tosssound = "Flag.Toss",
dropnotouchtime = 2,
capnotouchtime = 2,
hudicon = "hud_ball",
hudx = 5,
hudy = 210,
hudwidth = 48,
hudheight = 48,
hudalign = 1,
hudstatusiconbluex = 60,
hudstatusiconbluey = 5,
hudstatusiconredx = 60,
hudstatusiconredy = 5,
hudstatusiconblue = "hud_ball.vtf",
hudstatusiconred = "hud_ball.vtf",
hudstatusiconw = 15,
hudstatusiconh = 15,
hudstatusiconbluealign = 2,
hudstatusiconredalign = 3,
touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen},
botgoaltype = Bot.kFlag
})
function base_ball:hasanimation() return true end
-- For when this object is carried, these offsets are used to place
-- the info_ff_script relative to the players feet
function base_ball:attachoffset()
-- x = forward/backward
-- y = left/right
-- z = up/down
local offset = Vector( 32, 0, 0 )
return offset
end
function base_ball:precache()
PrecacheSound(self.tosssound)
PrecacheSound("yourteam.flagstolen")
PrecacheSound("otherteam.flagstolen")
PrecacheSound("yourteam.drop")
PrecacheSound("otherteam.drop")
PrecacheSound("yourteam.flagreturn")
PrecacheSound("otherteam.flagreturn")
PrecacheSound("yourteam.flagcap")
PrecacheSound("otherteam.flagcap")
info_ff_script.precache(self)
end
function base_ball:spawn()
self.notouch = { }
info_ff_script.spawn(self)
end
function base_ball:addnotouch(player_id, duration)
self.notouch[player_id] = duration
AddSchedule(self.name .. "-" .. player_id, duration, self.removenotouch, self, player_id)
end
function base_ball.removenotouch(self, player_id)
self.notouch[player_id] = nil
end
function base_ball:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
-- pickup if they can
if self.notouch[player:GetId()] then return; end
if player:GetTeamId() ~= self.team then
-- let the teams know that the ball was picked up
SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
SmartSpeak(player, "CTF_YOUHAVEBALL", "CTF_TEAMHASBALL", "CTF_ENEMYHASBALL")
SmartMessage(player, "#FF_YOUHAVEBALL", "#FF_TEAMHASBALL", "#FF_ENEMYHASBALL", Color.kGreen, Color.kGreen, Color.kRed)
-- if the player is a spy, then force him to lose his disguise
player:SetDisguisable( false )
-- if the player is a spy, then force him to lose his cloak
player:SetCloakable( false )
-- note: this seems a bit backwards (Pickup verb fits Player better)
local ball = CastToInfoScript(entity)
ball:Pickup(player)
AddHudIcon( player, self.hudicon, ball:GetName(), self.hudx, self.hudy, self.hudwidth, self.hudheight, self.hudalign )
RemoveHudItemFromAll( "ball-icon-dropped" )
local team = player:GetTeamId()
if (team == Team.kBlue) then
AddHudIconToAll( self.hudstatusiconblue, "ball-icon-blue", self.hudstatusiconbluex, self.hudstatusiconbluey, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconbluealign )
elseif (team == Team.kRed) then
AddHudIconToAll( self.hudstatusiconred, "ball-icon-red", self.hudstatusiconredx, self.hudstatusiconredy, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconredalign )
end
end
end
end
function base_ball:onownerdie( owner_entity )
-- drop the ball
local ball = CastToInfoScript(entity)
ball:Drop(BALL_RETURN_TIME, 0.0)
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, ball:GetName() )
local team = player:GetTeamId()
if (team == Team.kBlue) then
RemoveHudItemFromAll( "ball-icon-blue" )
elseif (team == Team.kRed) then
RemoveHudItemFromAll( "ball-icon-red" )
end
end
end
function base_ball:ownerfeign( owner_entity )
-- drop the ball
local ball = CastToInfoScript(entity)
ball:Drop(BALL_RETURN_TIME, 0.0)
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, ball:GetName() )
local team = player:GetTeamId()
if (team == Team.kBlue) then
RemoveHudItemFromAll( "ball-icon-blue" )
elseif (team == Team.kRed) then
RemoveHudItemFromAll( "ball-icon-red" )
end
end
end
function base_ball:dropitemcmd( owner_entity )
-- throw the ball
local ball = CastToInfoScript(entity)
ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED)
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, ball:GetName() )
local team = player:GetTeamId()
if (team == Team.kBlue) then
RemoveHudItemFromAll( "ball-icon-blue" )
elseif (team == Team.kRed) then
RemoveHudItemFromAll( "ball-icon-red" )
end
end
end
function base_ball:ondrop( owner_entity )
if IsPlayer( owner_entity ) then
local player = CastToPlayer( owner_entity )
-- let the teams know that the flag was dropped
SmartSound(player, "yourteam.drop", "yourteam.drop", "otherteam.drop")
SmartMessage(player, "#FF_YOUBALLDROP", "#FF_TEAMBALLDROP", "#FF_ENEMYBALLDROP", Color.kYellow, Color.kYellow, Color.kYellow)
end
local ball = CastToInfoScript(entity)
ball:EmitSound(self.tosssound)
end
function base_ball:onloseitem( owner_entity )
if IsPlayer( owner_entity ) then
-- let the player that lost the ball put on a disguise
local player = CastToPlayer( owner_entity )
player:SetDisguisable(true)
player:SetCloakable( true )
self:addnotouch(player:GetId(), self.capnotouchtime)
end
end
function base_ball:onreturn( )
-- let the teams know that the ball was returned
BroadCastMessage("#FF_BALLRETURN", Color.kYellow)
BroadCastSound ( "yourteam.flagreturn" )
SpeakAll( "CTF_BALLRETURN" )
end
-- Define the ball
ball = base_ball:new({})
-----------------------------------------------------------------------------
-- Capture Points
-----------------------------------------------------------------------------
pushcap = trigger_ff_script:new({
health = 100,
armor = 300,
grenades = 200,
nails = 200,
shells = 200,
rockets = 200,
cells = 200,
detpacks = 1,
mancannons = 1,
gren1 = 0,
gren2 = 0,
item = "",
team = Team.kUnassigned,
botgoaltype = Bot.kFlagCap
})
function pushcap:allowed ( allowed_entity )
if IsPlayer( allowed_entity ) then
-- get the player and his team
local player = CastToPlayer( allowed_entity )
-- check if the player is on our team
if player:GetTeamId() ~= self.team then
return EVENT_DISALLOWED
end
if player:HasItem( self.item ) then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
function pushcap:ontrigger( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
-- check if the player is carrying the ball
if player:HasItem( self.item ) then
-- reward player for goal
player:AddFortPoints(FORTPOINTS_PER_CAPTURE, "#FF_FORTPOINTS_GOAL")
-- reward player's team for capture
local team = player:GetTeam()
team:AddScore(POINTS_PER_CAPTURE)
local ball = GetInfoScriptByName( "ball" )
-- return the ball
ball:Return()
-- Remove any hud icons
RemoveHudItem( player, ball:GetName() )
local team = player:GetTeamId()
if (team == Team.kBlue) then
RemoveHudItemFromAll( "ball-icon-blue" )
elseif (team == Team.kRed) then
RemoveHudItemFromAll( "ball-icon-red" )
end
-- let the teams know that a capture occured
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
SmartSpeak(player, "CTF_YOUSCORE", "CTF_TEAMSCORE", "CTF_THEYSCORE")
SmartMessage(player, "#FF_YOUSCORE", "#FF_TEAMSCORE", "#FF_ENEMYSCORE", Color.kGreen, Color.kGreen, Color.kRed)
ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips })
end
end
end
-- declare the elements
red_cap = pushcap:new({ team = Team.kRed, item = "ball" })
blue_cap = pushcap:new({ team = Team.kBlue, item = "ball" })
-----------------------------------------------------------------------------
-- Hurts
-----------------------------------------------------------------------------
hurt = trigger_ff_script:new({ team = Team.kUnassigned })
function hurt:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
hurt_blue = hurt:new({ team = Team.kBlue })
hurt_red = hurt:new({ team = Team.kRed })

View file

@ -0,0 +1,41 @@
-- base_turret handles some stuff for Respawn Turrets
-- Custom target selection should be handled in your map's .lua
-- file and not this one (so please do not mess with this file)!
----------------------------------------------------------------------------
-- Team assigned Respawn Turrets target players, dispensers, and sentryguns
-- that are not on the Respawn Turrets team as well as players, dispensers,
-- and sentryguns that are not on a team that is allied to the Respawn
-- Turrets team
----------------------------------------------------------------------------
base_respawnturret = baseclass:new({ team = Team.kUnassigned })
-- Note: GetObjectsTeam only works on players, dispensers, and sentryguns so
-- don't use it where an object could be anything except those 3 items
-- Note: IsTeam1AlliedToTeam2 will return true if team1 is allied to team2 or
-- if team1 is the same as team2
function base_respawnturret:validtarget( target_entity )
--local entity = GetEntity(ent_id)
return (AreTeamsAllied(self.team, target_entity:GetTeamId()) == false)
end
-- Turrets, by default, have a 2 second delay after they
-- spot a target and before they're deployed (opened)
function base_respawnturret:deploydelay( target_entity ) return 2.0 end
----------------------------------------------------------------------------
-- Generic Respawn Turret assigned to no team.
----------------------------------------------------------------------------
respawnturret = base_respawnturret:new({ team = Team.kUnassigned })
----------------------------------------------------------------------------
-- Team assigned Respawn Turrets
----------------------------------------------------------------------------
respawnturret_blue = base_respawnturret:new({ team = Team.kBlue })
respawnturret_red = base_respawnturret:new({ team = Team.kRed })
respawnturret_yellow = base_respawnturret:new({ team = Team.kYellow })
respawnturret_green = base_respawnturret:new({ team = Team.kGreen })

View file

@ -0,0 +1,193 @@
-- base_shutdown.lua
-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base");
IncludeScript("base_ctf");
IncludeScript("base_teamplay");
IncludeScript("base_location");
IncludeScript("base_respawnturret");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------
POINTS_PER_CAPTURE = 10;
FLAG_RETURN_TIME = 60;
-----------------------------------------------------------------------------
-- Buttons
-----------------------------------------------------------------------------
-- base button stuff (common functionality)
button_common = func_button:new({ team = Team.kUnassigned })
function button_common:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == self.team and player:IsAlive() then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
-- TODO this doesn't work
function button_common:onfailuse( use_entity )
if IsPlayer( use_entity ) then
local player = CastToPlayer( use_entity )
BroadCastMessageToPlayer( player, "#FF_NOTALLOWEDBUTTON" )
end
end
-----------------------------------------------------------------------------
-- Button inputs (touch, use, damage etc.)
-----------------------------------------------------------------------------
-- red button
--button_red = button_common:new({ team = Team.kBlue, sec_up = true })
button_red = button_common:new({
team = Team.kBlue,
sec_up = true,
sec_down_icon = "hud_secdown.vtf",
sec_up_icon = "hud_secup_red.vtf",
iconx = 60,
icony = 30,
iconw = 16,
iconh = 16,
iconalign = 3
})
-----------------------------------------------------------------------------
-- Button responses
-----------------------------------------------------------------------------
function button_red:onin()
BroadCastMessage( "#FF_RED_SECURITY_DEACTIVATED" )
SpeakAll( "SD_REDDOWN" )
self.sec_up = false
RemoveHudItemFromAll( "red-sec-up")
AddHudIconToAll( self.sec_down_icon, "red-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
LogLuaEvent(0, 0, "security_down", "team", "red")
end
function button_red:onout()
BroadCastMessage( "#FF_RED_SECURITY_ACTIVATED" )
SpeakAll( "SD_REDUP" )
self.sec_up = true
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( self.sec_up_icon, "red-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
LogLuaEvent(0, 0, "security_up", "team", "red")
end
-----------------------------------------------------------------------------
-- Button inputs (touch, use, damage etc.)
-----------------------------------------------------------------------------
-- blue button
--button_blue = button_common:new({ team = Team.kRed, sec_up = true })
button_blue = button_common:new({
team = Team.kRed,
sec_up = true,
sec_down_icon = "hud_secdown.vtf",
sec_up_icon = "hud_secup_blue.vtf",
iconx = 60,
icony = 30,
iconw = 16,
iconh = 16,
iconalign = 2
})
-----------------------------------------------------------------------------
-- Button responses
-----------------------------------------------------------------------------
function button_blue:onin()
BroadCastMessage( "#FF_BLUE_SECURITY_DEACTIVATED" )
SpeakAll( "SD_BLUEDOWN" )
self.sec_up = false
RemoveHudItemFromAll( "blue-sec-up")
AddHudIconToAll( self.sec_down_icon, "blue-sec-down", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
LogLuaEvent(0, 0, "security_down", "team", "blue")
end
function button_blue:onout()
BroadCastMessage( "#FF_BLUE_SECURITY_ACTIVATED" )
SpeakAll( "SD_BLUEUP" )
self.sec_up = true
RemoveHudItemFromAll( "blue-sec-down")
AddHudIconToAll( self.sec_up_icon, "blue-sec-up", self.iconx, self.icony, self.iconw, self.iconh, self.iconalign )
LogLuaEvent(0, 0, "security_up", "team", "blue")
end
-----------------------------------------------------------------------------
-- Hurts
-----------------------------------------------------------------------------
hurt = trigger_ff_script:new({ team = Team.kUnassigned })
function hurt:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
end
return EVENT_DISALLOWED
end
-- red lasers hurt blue and vice-versa
red_laser_hurt = hurt:new({ team = Team.kBlue })
blue_laser_hurt = hurt:new({ team = Team.kRed })
-- function precache()
-- precache sounds
-- PrecacheSound("vox.blueup")
-- PrecacheSound("vox.bluedown")
-- PrecacheSound("vox.redup")
-- PrecacheSound("vox.reddown")
-- end
-------------------------
-- flaginfo
-------------------------
--flaginfo runs whenever the player spawns or uses the flaginfo command.
--Right now it just refreshes the HUD items; this ensures that players who just joined the server have the right information
function flaginfo( player_entity )
flaginfo_base(player_entity) --see base_teamplay.lua
local player = CastToPlayer( player_entity )
RemoveHudItem( player, "red-sec-down" )
RemoveHudItem( player, "blue-sec-down" )
RemoveHudItem( player, "red-sec-up" )
RemoveHudItem( player, "blue-sec-up" )
if button_blue.sec_up == true then
AddHudIcon( player, button_blue.sec_up_icon, "blue-sec-up", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, button_blue.iconalign )
else
AddHudIcon( player, button_blue.sec_down_icon, "blue-sec-down", button_blue.iconx, button_blue.icony, button_blue.iconw, button_blue.iconh, button_blue.iconalign )
end
if button_red.sec_up == true then
AddHudIcon( player, button_red.sec_up_icon, "red-sec-up", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, button_red.iconalign )
else
AddHudIcon( player, button_red.sec_down_icon, "red-sec-down", button_red.iconx, button_red.icony, button_red.iconw, button_red.iconh, button_red.iconalign )
end
end

View file

@ -0,0 +1,111 @@
-- base_soldierarena
function startup()
local team = GetTeam(Team.kBlue)
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, 0 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team = GetTeam(Team.kRed)
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, 0 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team = GetTeam(Team.kYellow)
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, 0 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team = GetTeam(Team.kGreen)
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, 0 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
end
function player_spawn( player_id )
-- 400 for overkill. of course the values
-- get clamped in game code
local player = GetPlayer(player_id)
player:AddHealth( 400 )
player:AddArmor( 400 )
player:RemoveAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:RemoveAmmo( Ammo.kCells, 400 )
player:RemoveAmmo( Ammo.kDetpack, 1 )
player:RemoveAmmo( Ammo.kManCannon, 1 )
player:RemoveAmmo( Ammo.kGren1, 4 )
player:RemoveAmmo( Ammo.kGren2, 4 )
-- Players get 1 gren1
player:AddAmmo( Ammo.kGren1, 1 )
end
function player_ondamage( player, damageinfo )
if not player_entity then return end
if not damageinfo then return end
local attackerPlayer = CastToPlayer(damageinfo:GetAttacker())
if not attackerPlayer then return end
local weapon = damageinfo:GetInflictor():GetClassName()
local player = CastToPlayer(player_entity)
-- Don't take rocket, gl/pl damage from ourselves
if ( player:GetId() == attackerPlayer:GetId() ) then
if ( weapon == "ff_projectile_rocket" ) then
damageinfo:SetDamage(0);
-- green pipes
elseif ( weapon == "ff_projectile_pl" ) then
damageinfo:SetDamage(0);
-- blue pipes
elseif ( weapon == "ff_projectile_gl" ) then
damageinfo:SetDamage(0);
end
end
end
function player_killed( player_id )
-- If you kill someone, give your team a point
local killer = GetPlayer(killer)
local victim = GetPlayer(player_id)
if not (victim:GetTeamId() == killer:GetTeamId()) then
local killersTeam = killer:GetTeam()
killersTeam:AddScore(1)
end
end

View file

@ -0,0 +1,872 @@
-- base_teamplay.lua
-----------------------------------------------------------------------------
-- base_teamplay handles stuff for "normal" maps so this stuff doesn't need
-- to be replicated all over the place (like standard teamspawns,
-- doors, bags, and such)
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Globals
-----------------------------------------------------------------------------
if POINTS_PER_CAPTURE == nil then POINTS_PER_CAPTURE = 10; end
if FORTPOINTS_PER_CAPTURE == nil then FORTPOINTS_PER_CAPTURE = 1000; end
if FORTPOINTS_PER_INITIALTOUCH == nil then FORTPOINTS_PER_INITIALTOUCH = 100; end
if FLAG_RETURN_TIME == nil then FLAG_RETURN_TIME = 60; end
if FLAG_THROW_SPEED == nil then FLAG_THROW_SPEED = 330; end
redallowedmethod = function(self,player) return player:GetTeamId() == Team.kRed end
blueallowedmethod = function(self,player) return player:GetTeamId() == Team.kBlue end
yellowallowedmethod = function(self,player) return player:GetTeamId() == Team.kYellow end
greenallowedmethod = function(self,player) return player:GetTeamId() == Team.kGreen end
-- things for flags
teamskins = {}
teamskins[Team.kBlue] = 0
teamskins[Team.kRed] = 1
teamskins[Team.kYellow] = 2
teamskins[Team.kGreen] = 3
team_hudicons = {}
team_hudicons[Team.kBlue] = "hud_flag_blue_new.vtf"
team_hudicons[Team.kRed] = "hud_flag_red_new.vtf"
team_hudicons[Team.kGreen] = "hud_flag_green_new.vtf"
team_hudicons[Team.kYellow] = "hud_flag_yellow_new.vtf"
-----------------------------------------------------------------------------
-- Player spawn: give full health, armor, and ammo
-----------------------------------------------------------------------------
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 400 )
player:AddArmor( 400 )
player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
end
-----------------------------------------------------------------------------
-- No builds: area where you can't build
-----------------------------------------------------------------------------
nobuild = trigger_ff_script:new({})
function nobuild:onbuild( build_entity )
return EVENT_DISALLOWED
end
no_build = nobuild
-----------------------------------------------------------------------------
-- No grens: area where grens won't explode
-----------------------------------------------------------------------------
nogrens = trigger_ff_script:new({})
function nogrens:onexplode( explode_entity )
if IsGrenade( explode_entity ) then
return EVENT_DISALLOWED
end
return EVENT_ALLOWED
end
no_grens = nogrens
-----------------------------------------------------------------------------
-- No Fucking Annoyances
-----------------------------------------------------------------------------
noannoyances = trigger_ff_script:new({})
function noannoyances:onbuild( build_entity )
return EVENT_DISALLOWED
end
function noannoyances:onexplode( explode_entity )
if IsGrenade( explode_entity ) then
return EVENT_DISALLOWED
end
return EVENT_ALLOWED
end
function noannoyances:oninfect( infect_entity )
return EVENT_DISALLOWED
end
no_annoyances = noannoyances
spawn_protection = noannoyances
-----------------------------------------------------------------------------
-- Trigger_ff_clips
-----------------------------------------------------------------------------
-- these block all players except the team the clip "belongs to" (clip_red blocks all players not on the red team)
clip_blue = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipPlayersByTeam, ClipFlags.kClipTeamRed, ClipFlags.kClipTeamYellow, ClipFlags.kClipTeamGreen, ClipFlags.kClipAllNonPlayers} })
clip_red = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipPlayersByTeam, ClipFlags.kClipTeamBlue, ClipFlags.kClipTeamYellow, ClipFlags.kClipTeamGreen, ClipFlags.kClipAllNonPlayers} })
clip_yellow = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipPlayersByTeam, ClipFlags.kClipTeamBlue, ClipFlags.kClipTeamRed, ClipFlags.kClipTeamGreen, ClipFlags.kClipAllNonPlayers} })
clip_green = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipPlayersByTeam, ClipFlags.kClipTeamBlue, ClipFlags.kClipTeamRed, ClipFlags.kClipTeamYellow, ClipFlags.kClipAllNonPlayers} })
-- each of these block specific things
block_buildables = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllBuildables, ClipFlags.kClipAllBuildableWeapons} })
block_buildablepathing = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllBuildables} })
block_buildableweapons = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllBuildableWeapons} })
block_spawnturrets = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllSpawnTurrets} })
block_nonplayers = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllNonPlayers} })
block_players = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllPlayers} })
block_backpacks = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllBackpacks} })
block_flags = trigger_ff_clip:new({ clipflags = {ClipFlags.kClipAllInfoScripts} })
-----------------------------------------------------------------------------
-- Generic Backpack
-----------------------------------------------------------------------------
genericbackpack = info_ff_script:new({
health = 0,
armor = 0,
grenades = 0,
shells = 0,
nails = 0,
rockets = 0,
cells = 0,
detpacks = 0,
mancannons = 0,
gren1 = 0,
gren2 = 0,
respawntime = 5,
model = "models/items/healthkit.mdl",
materializesound = "Item.Materialize",
touchsound = "HealthKit.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen}
})
function genericbackpack:dropatspawn() return false end
function genericbackpack:precache( )
-- precache sounds
PrecacheSound(self.materializesound)
PrecacheSound(self.touchsound)
-- precache models
PrecacheModel(self.model)
end
function genericbackpack:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
local dispensed = 0
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then dispensed = dispensed + player:AddHealth( self.health ) end
if self.armor ~= nil and self.armor ~= 0 then dispensed = dispensed + player:AddArmor( self.armor ) end
-- give player ammo
if self.nails ~= nil and self.nails ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then dispensed = dispensed + player:AddAmmo(Ammo.kGren2, self.gren2) end
-- if the player took ammo, then have the backpack respawn with a delay
if dispensed >= 1 then
local backpack = CastToInfoScript(entity);
if backpack then
backpack:EmitSound(self.touchsound);
backpack:Respawn(self.respawntime);
end
end
end
end
function genericbackpack:materialize( )
entity:EmitSound(self.materializesound)
end
-----------------------------------------------------------------------------
-- Health Kit (backpack-based)
-----------------------------------------------------------------------------
healthkit = genericbackpack:new({
health = 25,
model = "models/items/healthkit.mdl",
materializesound = "Item.Materialize",
respawntime = 20,
touchsound = "HealthKit.Touch",
botgoaltype = Bot.kBackPack_Health
})
function healthkit:dropatspawn() return true end
-----------------------------------------------------------------------------
-- Armor Kit (backpack-based)
-----------------------------------------------------------------------------
armorkit = genericbackpack:new({
armor = 200,
cells = 150, -- mirv: armour in 2fort/rock2/etc gives 150 cells too
model = "models/items/armour/armour.mdl",
materializesound = "Item.Materialize",
touchsound = "ArmorKit.Touch",
botgoaltype = Bot.kBackPack_Armor
})
function armorkit:dropatspawn() return true end
-----------------------------------------------------------------------------
-- Ammo Kit (backpack-based)
-----------------------------------------------------------------------------
ammobackpack = genericbackpack:new({
grenades = 20,
nails = 50,
shells = 100,
rockets = 15,
cells = 70,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function ammobackpack:dropatspawn() return false end
-----------------------------------------------------------------------------
-- bigpack -- has a bit of everything (excluding grens) (backpack-based)
-----------------------------------------------------------------------------
bigpack = genericbackpack:new({
health = 150,
armor = 200,
grenades = 50,
nails = 150,
shells = 200,
rockets = 100,
cells = 200,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Ammo
})
function bigpack:dropatspawn() return false end
-----------------------------------------------------------------------------
-- Grenade Backpack
-----------------------------------------------------------------------------
grenadebackpack = genericbackpack:new({
mancannons = 1,
gren1 = 2,
gren2 = 2,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
respawntime = 30,
touchsound = "Backpack.Touch",
botgoaltype = Bot.kBackPack_Grenades
})
function grenadebackpack:dropatspawn() return false end
-----------------------------------------------------------------------------
-- Door Triggers
-----------------------------------------------------------------------------
respawndoor = trigger_ff_script:new({ team = Team.kUnassigned, allowdisguised=false })
function respawndoor:allowed( allowed_entity )
if IsPlayer( allowed_entity ) then
local player = CastToPlayer( allowed_entity )
if player:GetTeamId() == self.team then
return EVENT_ALLOWED
end
if self.allowdisguised then
if player:IsDisguised() and player:GetDisguisedTeam() == self.team then
return EVENT_ALLOWED
end
end
end
return EVENT_DISALLOWED
end
function respawndoor:onfailtouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
BroadCastMessageToPlayer( player, "#FF_NOTALLOWEDDOOR" )
end
end
bluerespawndoor = respawndoor:new({ team = Team.kBlue })
redrespawndoor = respawndoor:new({ team = Team.kRed })
greenrespawndoor = respawndoor:new({ team = Team.kGreen })
yellowrespawndoor = respawndoor:new({ team = Team.kYellow })
-----------------------------------------------------------------------------
-- Elevator Triggers
-----------------------------------------------------------------------------
elevator_trigger = respawndoor:new( {} )
function elevator_trigger:onfailtouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
BroadCastMessageToPlayer( player, "#FF_NOTALLOWEDELEVATOR" )
end
end
blue_elevator_trigger = elevator_trigger:new({ team = Team.kBlue })
red_elevator_trigger = elevator_trigger:new({ team = Team.kRed })
green_elevator_trigger = elevator_trigger:new({ team = Team.kGreen })
yellow_elevator_trigger = elevator_trigger:new({ team = Team.kYellow })
-----------------------------------------------------------------------------
-- Spawn functions
-----------------------------------------------------------------------------
redspawn = { validspawn = redallowedmethod }
bluespawn = { validspawn = blueallowedmethod }
greenspawn = { validspawn = greenallowedmethod }
yellowspawn = { validspawn = yellowallowedmethod }
-- aliases for people that like underscores
red_spawn = redspawn; blue_spawn = bluespawn;
green_spawn = greenspawn; yellow_spawn = yellowspawn
blue_respawndoor = bluerespawndoor; red_respawndoor = redrespawndoor;
green_respawndoor = greenrespawndoor; yellow_respawndoor = yellowrespawndoor
-----------------------------------------------------------------------------
-- Capture Points
-----------------------------------------------------------------------------
basecap = trigger_ff_script:new({
health = 100,
armor = 300,
grenades = 200,
shells = 200,
nails = 200,
rockets = 200,
cells = 200,
detpacks = 1,
mancannons = 1,
gren1 = 4,
gren2 = 4,
item = "",
team = 0,
-- teampoints and fortpoints are defined as functions here for backwards compatibility (to always get the current value of the global variable)
-- when defining capture points that inherit from basecap, teampoints and fortpoints can be set to numbers instead
teampoints = function(cap, team) return POINTS_PER_CAPTURE end,
fortpoints = function(cap, player) return FORTPOINTS_PER_CAPTURE end,
botgoaltype = Bot.kFlagCap,
})
bluerspawn = info_ff_script:new()
function basecap:allowed ( allowed_entity )
if IsPlayer( allowed_entity ) then
-- get the player and his team
local player = CastToPlayer( allowed_entity )
local team = player:GetTeam()
-- check if the player is on our team
if team:GetTeamId() ~= self.team then
return false
end
-- check if the player has the flag
for i,v in ipairs(self.item) do
local flag = GetInfoScriptByName(v)
-- Make sure flag isn't nil
if flag then
if player:HasItem(flag:GetName()) then
return true
end
end
end
end
return false
end
function basecap:ontrigger ( trigger_entity )
if IsPlayer( trigger_entity ) then
local player = CastToPlayer( trigger_entity )
-- player should capture now
for i,v in ipairs( self.item ) do
-- find the flag and cast it to an info_ff_script
local flag = GetInfoScriptByName(v)
-- Make sure flag isn't nil
if flag then
-- check if the player is carrying the flag
if player:HasItem(flag:GetName()) then
flag.status = 0
-- reward player for capture
local fortpoints = (type(self.fortpoints) == "function" and self.fortpoints(self, player) or self.fortpoints)
player:AddFortPoints(fortpoints, "#FF_FORTPOINTS_CAPTUREFLAG")
-- reward player's team for capture
local team = player:GetTeam()
local teampoints = (type(self.teampoints) == "function" and self.teampoints(self, team) or self.teampoints)
team:AddScore(teampoints)
LogLuaEvent(player:GetId(), 0, "flag_capture","flag_name",flag:GetName())
-- show on the deathnotice board
ObjectiveNotice( player, "captured the flag" )
-- clear the objective icon
UpdateObjectiveIcon( player, nil )
-- Remove any hud icons
RemoveHudItem( player, flag:GetName() )
-- return the flag
flag:Return()
--Cappin cures what ails ya
player:RemoveEffect(EF.kOnfire)
player:RemoveEffect(EF.kConc)
player:RemoveEffect(EF.kGas)
player:RemoveEffect(EF.kInfect)
player:RemoveEffect(EF.kRadiotag)
player:RemoveEffect(EF.kTranq)
player:RemoveEffect(EF.kLegshot)
player:RemoveEffect(EF.kRadiotag)
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then player:AddHealth(self.health) end
if self.armor ~= nil and self.armor ~= 0 then player:AddArmor(self.armor) end
-- give the player some ammo
if self.nails ~= nil and self.nails ~= 0 then player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then player:AddAmmo(Ammo.kGren2, self.gren2) end
self:oncapture( player, v )
end
end
end
end
end
function basecap:oncapture(player, item)
-- let the teams know that a capture occured
SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
SmartSpeak(player, "CTF_YOUCAP", "CTF_TEAMCAP", "CTF_THEYCAP")
SmartMessage(player, "#FF_YOUCAP", "#FF_TEAMCAP", "#FF_OTHERTEAMCAP", Color.kGreen, Color.kGreen, Color.kRed)
end
-----------------------------------------------------------------------------
-- Flag
-- status: 0 = home, 1 = carried, 2 = dropped
-----------------------------------------------------------------------------
baseflag = info_ff_script:new({
name = "base flag",
team = 0,
model = "models/flag/flag.mdl",
tosssound = "Flag.Toss",
modelskin = 1,
dropnotouchtime = 2,
capnotouchtime = 2,
botgoaltype = Bot.kFlag,
status = 0,
hudicon = "",
hudx = 5,
hudy = 114,
hudalign = 1,
hudstatusiconalign = 2,
hudstatusicon = "",
hudstatusiconx = 0,
hudstatusicony = 0,
hudstatusiconw = 50,
hudstatusiconh = 50,
allowdrop = true,
droppedlocation = "",
carriedby = "",
flagtoss = false,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen}
})
function baseflag:precache()
PrecacheSound(self.tosssound)
PrecacheSound("yourteam.flagstolen")
PrecacheSound("otherteam.flagstolen")
PrecacheSound("yourteam.drop")
PrecacheSound("otherteam.drop")
PrecacheSound("yourteam.flagreturn")
PrecacheSound("otherteam.flagreturn")
PrecacheSound("yourteam.flagcap")
PrecacheSound("otherteam.flagcap")
info_ff_script.precache(self)
end
function baseflag:spawn()
self.notouch = { }
info_ff_script.spawn(self)
local flag = CastToInfoScript( entity )
LogLuaEvent(0, 0, "flag_spawn","flag_name",flag:GetName())
self.status = 0
self:refreshStatusIcons(flag:GetName())
end
function baseflag:addnotouch(player_id, duration)
self.notouch[player_id] = duration
AddSchedule(self.name .. "-" .. player_id, duration, self.removenotouch, self, player_id)
end
function baseflag.removenotouch(self, player_id)
self.notouch[player_id] = nil
end
function baseflag:touch( touch_entity )
local player = CastToPlayer( touch_entity )
-- pickup if they can
if self.notouch[player:GetId()] then return; end
if player:GetTeamId() ~= self.team then
-- let the teams know that the flag was picked up
SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
RandomFlagTouchSpeak( player )
SmartMessage(player, "#FF_YOUPICKUP", "#FF_TEAMPICKUP", "#FF_OTHERTEAMPICKUP", Color.kGreen, Color.kGreen, Color.kRed)
-- if the player is a spy, then force him to lose his disguise
player:SetDisguisable( false )
-- if the player is a spy, then force him to lose his cloak
player:SetCloakable( false )
-- note: this seems a bit backwards (Pickup verb fits Player better)
local flag = CastToInfoScript(entity)
flag:Pickup(player)
AddHudIcon( player, self.hudicon, flag:GetName(), self.hudx, self.hudy, self.hudwidth, self.hudheight, self.hudalign )
-- show on the deathnotice board
--ObjectiveNotice( player, "grabbed the flag" )
-- log action in stats
LogLuaEvent(player:GetId(), 0, "flag_touch", "flag_name", flag:GetName(), "player_origin", (string.format("%0.2f",player:GetOrigin().x) .. ", " .. string.format("%0.2f",player:GetOrigin().y) .. ", " .. string.format("%0.1f",player:GetOrigin().z) ), "player_health", "" .. player:GetHealth());
local team = nil
-- get team as a lowercase string
if player:GetTeamId() == Team.kBlue then team = "blue" end
if player:GetTeamId() == Team.kRed then team = "red" end
if player:GetTeamId() == Team.kGreen then team = "green" end
if player:GetTeamId() == Team.kYellow then team = "yellow" end
-- objective icon pointing to the cap
UpdateObjectiveIcon( player, GetEntityByName( team.."_cap" ) )
-- 100 points for initial touch on flag
if self.status == 0 then player:AddFortPoints(FORTPOINTS_PER_INITIALTOUCH, "#FF_FORTPOINTS_INITIALTOUCH") end
self.status = 1
self.carriedby = player:GetName()
self:refreshStatusIcons(flag:GetName())
end
end
function baseflag:onownerdie( owner_entity )
-- drop the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, 0.0)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
self.status = 2
self.carriedby = ""
self.droppedlocation = player:GetLocation()
self:refreshStatusIcons(flag:GetName())
-- clear the objective icon
UpdateObjectiveIcon( player, nil )
end
function baseflag:ownercloak( owner_entity )
-- drop the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, 0.0)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
self.status = 2
self.carriedby = ""
self.droppedlocation = player:GetLocation()
self:refreshStatusIcons(flag:GetName())
-- clear the objective icon
UpdateObjectiveIcon( player, nil )
end
function baseflag:dropitemcmd( owner_entity )
if allowdrop == false then return end
--Used by logging
self.flagtoss = true
-- throw the flag
local flag = CastToInfoScript(entity)
flag:Drop(FLAG_RETURN_TIME, FLAG_THROW_SPEED)
-- remove flag icon from hud
local player = CastToPlayer( owner_entity )
RemoveHudItem( player, flag:GetName() )
self.status = 2
self.carriedby = ""
self.droppedlocation = player:GetLocation()
self:refreshStatusIcons(flag:GetName())
-- clear the objective icon
UpdateObjectiveIcon( player, nil )
end
function baseflag:ondrop( owner_entity )
local player = CastToPlayer( owner_entity )
-- let the teams know that the flag was dropped
SmartSound(player, "yourteam.drop", "yourteam.drop", "otherteam.drop")
SmartMessage(player, "#FF_YOUDROP", "#FF_TEAMDROP", "#FF_OTHERTEAMDROP", Color.kYellow, Color.kYellow, Color.kYellow)
local flag = CastToInfoScript(entity)
--Log a toss if drop was intentional. Otherwise, drop
if self.flagtoss == true then
LogLuaEvent(player:GetId(), 0, "flag_thrown","flag_name",flag:GetName(), "player_origin", (string.format("%0.2f",player:GetOrigin().x) .. ", " .. string.format("%0.2f",player:GetOrigin().y) .. ", " .. string.format("%0.1f",player:GetOrigin().z) ), "player_health", "" ..player:GetHealth());
self.flagtoss = false
else
LogLuaEvent(player:GetId(), 0, "flag_dropped", "flag_name", flag:GetName(), "player_origin", (string.format("%0.2f",player:GetOrigin().x) .. ", " .. string.format("%0.2f",player:GetOrigin().y) .. ", " .. string.format("%0.1f",player:GetOrigin().z) ));
end
flag:EmitSound(self.tosssound)
end
function baseflag:onloseitem( owner_entity )
local flag = CastToInfoScript( entity )
-- let the player that lost the flag put on a disguise
local player = CastToPlayer( owner_entity )
player:SetDisguisable(true)
-- let player cloak if he can
player:SetCloakable( true )
self.status = 0 --For some reason, the flag won't register as home when captured, unless I do this.
self.carriedby = ""
self:refreshStatusIcons(flag:GetName())
self:addnotouch(player:GetId(), self.capnotouchtime)
end
function baseflag:onownerforcerespawn( owner_entity )
local flag = CastToInfoScript( entity )
local player = CastToPlayer( owner_entity )
player:SetDisguisable( true )
player:SetCloakable( true )
RemoveHudItem( player, flag:GetName() )
flag:Drop(0, FLAG_THROW_SPEED)
self.status = 2
self.carriedby = ""
self.droppedlocation = player:GetLocation()
self:refreshStatusIcons(flag:GetName())
-- clear the objective icon
UpdateObjectiveIcon( player, nil )
end
function baseflag:onreturn( )
-- let the teams know that the flag was returned
local team = GetTeam( self.team )
SmartTeamMessage(team, "#FF_TEAMRETURN", "#FF_OTHERTEAMRETURN", Color.kYellow, Color.kYellow)
SmartTeamSound(team, "yourteam.flagreturn", "otherteam.flagreturn")
SmartTeamSpeak(team, "CTF_FLAGBACK", "CTF_EFLAGBACK")
local flag = CastToInfoScript( entity )
LogLuaEvent(0, 0, "flag_returned","flag_name",flag:GetName());
RemoveHudItemFromAll( flag:GetName() .. "location" )
self.status = 0
self.droppedlocation = ""
self:refreshStatusIcons(flag:GetName())
end
function baseflag:hasanimation() return true end
function baseflag:gettouchsize( mins, maxs )
mins.x = mins.x * 0.75
mins.y = mins.y * 0.75
maxs.x = maxs.x * 0.75
maxs.y = maxs.y * 0.75
mins.z = 0
maxs.z = maxs.z * 0.5
end
function baseflag:getphysicssize( mins, maxs )
mins.x = mins.x / 2
mins.y = mins.y / 2
maxs.x = maxs.x / 2
maxs.y = maxs.y / 2
mins.z = 0
maxs.z = 1
end
function baseflag:getbloatsize()
return 0
end
--All your flag HUD status needs in a convenient package (sort of)
function baseflag:refreshStatusIcons(flagname)
RemoveHudItemFromAll( flagname .. "_status" )
RemoveHudItemFromAll( flagname .. "location" )
RemoveHudItemFromAll( flagname .. "carrier" )
RemoveHudItemFromAll( flagname .. "timer" )
if self.status == 1 then
AddHudTextToAll( flagname .. "carrier", self.carriedby, self.hudstatusiconx, (self.hudstatusicony + self.hudstatusiconh), self.hudstatusiconalign )
AddHudIconToAll( self.hudstatusiconcarried, ( flagname .. "_status" ), self.hudstatusiconx, self.hudstatusicony, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconalign )
elseif self.status == 2 then
AddHudTextToAll( flagname .. "location", self.droppedlocation, self.hudstatusiconx + 24, (self.hudstatusicony + self.hudstatusiconh), self.hudstatusiconalign )
AddHudTimerToAll( flagname .. "timer", FLAG_RETURN_TIME+1, -1, self.hudstatusiconx, (self.hudstatusicony + self.hudstatusiconh), self.hudstatusiconalign )
AddHudIconToAll( self.hudstatusicondropped, ( flagname .. "_status" ), self.hudstatusiconx, self.hudstatusicony, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconalign )
else
AddHudIconToAll( self.hudstatusiconhome, ( flagname .. "_status" ), self.hudstatusiconx, self.hudstatusicony, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconalign )
end
end
-----------------------------------------------------------------------------
--flaginfo, basic version. If you override flaginfo in a map's lua, call this to get default functionality.
-----------------------------------------------------------------------------
function flaginfo_base( player_entity )
local player = CastToPlayer( player_entity )
local flag = GetInfoScriptByName("blue_flag")
if flag then
local flagname = flag:GetName()
RemoveHudItem( player, flagname .. "_status" )
RemoveHudItem( player, "blue_flagcarrier" )
RemoveHudItem( player, "blue_flaglocation" )
if flag:IsCarried() then
AddHudText( player, "blue_flagcarrier", blue_flag.carriedby, blue_flag.hudstatusiconx, (blue_flag.hudstatusicony + blue_flag.hudstatusiconh), blue_flag.hudstatusiconalign )
AddHudIcon( player, blue_flag.hudstatusiconcarried, ( flagname .. "_status" ), blue_flag.hudstatusiconx, blue_flag.hudstatusicony, blue_flag.hudstatusiconw, blue_flag.hudstatusiconh, blue_flag.hudstatusiconalign )
elseif flag:IsDropped() then
AddHudText( player, "blue_flaglocation", blue_flag.droppedlocation, blue_flag.hudstatusiconx + 24, (blue_flag.hudstatusicony + blue_flag.hudstatusiconh), blue_flag.hudstatusiconalign )
AddHudIcon( player, blue_flag.hudstatusicondropped, ( flagname .. "_status" ), blue_flag.hudstatusiconx, blue_flag.hudstatusicony, blue_flag.hudstatusiconw, blue_flag.hudstatusiconh, blue_flag.hudstatusiconalign )
else
AddHudIcon( player, blue_flag.hudstatusiconhome, ( flagname .. "_status" ), blue_flag.hudstatusiconx, blue_flag.hudstatusicony, blue_flag.hudstatusiconw, blue_flag.hudstatusiconh, blue_flag.hudstatusiconalign )
end
end
local flag = GetInfoScriptByName("red_flag")
if flag then
local flagname = flag:GetName()
RemoveHudItem( player, flagname .. "_status" )
RemoveHudItem( player, "red_flagcarrier" )
RemoveHudItem( player, "red_flaglocation" )
if flag:IsCarried() then
AddHudText( player, "red_flagcarrier", red_flag.carriedby, red_flag.hudstatusiconx, (red_flag.hudstatusicony + red_flag.hudstatusiconh), red_flag.hudstatusiconalign )
AddHudIcon( player, red_flag.hudstatusiconcarried, ( flagname .. "_status" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign )
elseif flag:IsDropped() then
AddHudText( player, "red_flaglocation", red_flag.droppedlocation, red_flag.hudstatusiconx + 24, (red_flag.hudstatusicony + red_flag.hudstatusiconh), red_flag.hudstatusiconalign )
AddHudIcon( player, red_flag.hudstatusicondropped, ( flagname .. "_status" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign )
else
AddHudIcon( player, red_flag.hudstatusiconhome, ( flagname .. "_status" ), red_flag.hudstatusiconx, red_flag.hudstatusicony, red_flag.hudstatusiconw, red_flag.hudstatusiconh, red_flag.hudstatusiconalign )
end
end
local flag = GetInfoScriptByName("yellow_flag")
if flag then
local flagname = flag:GetName()
RemoveHudItem( player, flagname .. "_status" )
RemoveHudItem( player, "yellow_flagcarrier" )
RemoveHudItem( player, "yellow_flaglocation" )
if flag:IsCarried() then
AddHudText( player, "yellow_flagcarrier", yellow_flag.carriedby, yellow_flag.hudstatusiconx, (yellow_flag.hudstatusicony + yellow_flag.hudstatusiconh), yellow_flag.hudstatusiconalign )
AddHudIcon( player, yellow_flag.hudstatusiconcarried, ( flagname .. "_status" ), yellow_flag.hudstatusiconx, yellow_flag.hudstatusicony, yellow_flag.hudstatusiconw, yellow_flag.hudstatusiconh, yellow_flag.hudstatusiconalign )
elseif flag:IsDropped() then
AddHudText( player, "yellow_flaglocation", yellow_flag.droppedlocation, yellow_flag.hudstatusiconx + 24, (yellow_flag.hudstatusicony + yellow_flag.hudstatusiconh), yellow_flag.hudstatusiconalign )
AddHudIcon( player, yellow_flag.hudstatusicondropped, ( flagname .. "_status" ), yellow_flag.hudstatusiconx, yellow_flag.hudstatusicony, yellow_flag.hudstatusiconw, yellow_flag.hudstatusiconh, yellow_flag.hudstatusiconalign )
else
AddHudIcon( player, yellow_flag.hudstatusiconhome, ( flagname .. "_status" ), yellow_flag.hudstatusiconx, yellow_flag.hudstatusicony, yellow_flag.hudstatusiconw, yellow_flag.hudstatusiconh, yellow_flag.hudstatusiconalign )
end
end
local flag = GetInfoScriptByName("green_flag")
if flag then
local flagname = flag:GetName()
RemoveHudItem( player, flagname .. "_status" )
RemoveHudItem( player, "green_flagcarrier" )
RemoveHudItem( player, "green_flaglocation" )
if flag:IsCarried() then
AddHudText( player, "green_flagcarrier", green_flag.carriedby, green_flag.hudstatusiconx, (green_flag.hudstatusicony + green_flag.hudstatusiconh), green_flag.hudstatusiconalign )
AddHudIcon( player, green_flag.hudstatusiconcarried, ( flagname .. "_status" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign )
elseif flag:IsDropped() then
AddHudText( player, "green_flaglocation", green_flag.droppedlocation, green_flag.hudstatusiconx + 24, (green_flag.hudstatusicony + green_flag.hudstatusiconh), green_flag.hudstatusiconalign )
AddHudIcon( player, green_flag.hudstatusicondropped, ( flagname .. "_status" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign )
else
AddHudIcon( player, green_flag.hudstatusiconhome, ( flagname .. "_status" ), green_flag.hudstatusiconx, green_flag.hudstatusicony, green_flag.hudstatusiconw, green_flag.hudstatusiconh, green_flag.hudstatusiconalign )
end
end
end
-----------------------------------------------------------------------------
-- Dettable triggers. Use this to make triggers that respond to a detpack explosion.
-----------------------------------------------------------------------------
detpack_trigger = trigger_ff_script:new({ team = Team.kUnassigned, team_name = "neutral" })
function detpack_trigger:onexplode( explosion_entity )
if IsDetpack( explosion_entity ) then
local detpack = CastToDetpack( explosion_entity )
if detpack:GetTeamId() ~= self.team then
-- Generic 'trigger' output for use with logic_ entities.
OutputEvent( self.team_name .. "_det_relay", "trigger" )
end
end
return EVENT_ALLOWED
end
red_detpack_trigger = detpack_trigger:new({ team = Team.kRed, team_name = "red" })
blue_detpack_trigger = detpack_trigger:new({ team = Team.kBlue, team_name = "blue" })
green_detpack_trigger = detpack_trigger:new({ team = Team.kGreen, team_name = "green" })
yellow_detpack_trigger = detpack_trigger:new({ team = Team.kYellow, team_name = "yellow" })
-----------------------------------------------------------------------------
-- backpack entity setup
-----------------------------------------------------------------------------
function build_backpacks(tf)
return healthkit:new({touchflags = tf}),
armorkit:new({touchflags = tf}),
ammobackpack:new({touchflags = tf}),
bigpack:new({touchflags = tf}),
grenadebackpack:new({touchflags = tf})
end
blue_healthkit, blue_armorkit, blue_ammobackpack, blue_bigpack, blue_grenadebackpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kBlue})
red_healthkit, red_armorkit, red_ammobackpack, red_bigpack ,red_grenadebackpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kRed})
yellow_healthkit, yellow_armorkit, yellow_ammobackpack, yellow_bigpack, yellow_grenadebackpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kYellow})
green_healthkit, green_armorkit, green_ammobackpack, green_bigpack, green_grenadebackpack = build_backpacks({AllowFlags.kOnlyPlayers,AllowFlags.kGreen})
-----------------------------------------------------------------------------
-- plays random flag touched sounds to avoid repetition
-- use instead of: SmartSpeak(player, "CTF_YOUGOTFLAG", "CTF_GOTFLAG", "CTF_LOSTFLAG")
-----------------------------------------------------------------------------
function RandomFlagTouchSpeak( player )
local rnd = RandomInt(1,4)
if rnd == 1 then SmartSpeak(player, "CTF_YOUGOTFLAG", "CTF_GOTFLAG", "CTF_LOSTFLAG")
elseif rnd == 2 then SmartSpeak(player, "CTF_YOUGOTFLAG2", "CTF_GOTFLAG2", "CTF_LOSTFLAG2")
elseif rnd == 3 then SmartSpeak(player, "CTF_YOUGOTFLAG3", "CTF_GOTFLAG3", "CTF_LOSTFLAG3")
else SmartSpeak(player, "CTF_YOUGOTFLAG4", "CTF_GOTFLAG4", "CTF_LOSTFLAG4") end
end

View file

@ -0,0 +1,5 @@
ConsoleToAll("base_test loaded!");
function tick()
ConsoleToAll("Tick");
end

View file

@ -0,0 +1,658 @@
-- base_training.lua
-- contains common useful functionality for maps that include training elements.
IncludeScript("base_teamplay")
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- helper functions
-----------------------------------------------------------------------------
function restoreEntityByName(name)
local e = GetInfoScriptByName(name)
if e ~= nil then e:Restore() end
end
-----------------------------------------------------------------------------
-- glass
-----------------------------------------------------------------------------
breakable_glass = info_ff_script:new({ })
function breakable_glass:spawn() end
function breakable_glass:OnBreak()
if self.BotSignal ~= nil then
bot.signal(self.BotSignal.."_OnBreak")
end
end
function breakable_glass:ondamage() end
-----------------------------------------------------------------------------
-- Class specific trainer spawns
-----------------------------------------------------------------------------
training_spawn = info_ff_script:new({
name="Trainer",
model="",
botteam=Team.kYellow,
botclass=0,
botgoaltype=Bot.kTrainerSpawn,
})
function training_spawn:spawn()
info_ff_script.spawn(self)
local info = CastToInfoScript(entity)
info:SpawnBot(self.name, self.botteam, self.botclass);
end
scout_trainer = training_spawn:new({ name="Scout Instructor", botclass=Player.kScout, })
sniper_trainer = training_spawn:new({ name="Sniper Instructor", botclass=Player.kSniper, })
soldier_trainer = training_spawn:new({ name="Soldier Instructor", botclass=Player.kSoldier, })
demoman_trainer = training_spawn:new({ name="Demo-man Instructor", botclass=Player.kDemoman, })
medic_trainer = training_spawn:new({ name="Medic Instructor", botclass=Player.kMedic, })
hwguy_trainer = training_spawn:new({ name="HwGuy Instructor", botclass=Player.kHwguy, })
pyro_trainer = training_spawn:new({ name="Pyro Instructor", botclass=Player.kPyro, })
engineer_trainer = training_spawn:new({ name="Engineer Instructor", botclass=Player.kEngineer, })
spy_trainer = training_spawn:new({ name="Spy Instructor", botclass=Player.kSpy, })
civilian_trainer = training_spawn:new({ name="Civilian Instructor", botclass=Player.kCivilian, })
random_target = training_spawn:new({ name="Target", botclass=Player.kRandom, })
-----------------------------------------------------------------------------
-- Training buttons
-----------------------------------------------------------------------------
train_button = func_button:new({})
function train_button:allowed() return true end
function train_button:ondamage() end
function train_button:ontouch() end
function train_button:onuse()
if self.restoreentity ~= nil then
local e = GetInfoScriptByName(self.restoreentity)
if e ~= nil then
e:Restore()
else
ConsoleToAll("Could not restore " .. self.restoreentity)
end
end
bot.signal(entity:GetName())
ConsoleToAll(entity:GetName() .. " onuse")
end
function train_button:onfailuse()
ConsoleToAll("button failuse")
end
-----------------------------------------------------------------------------
-- Fake weapon pickups
-----------------------------------------------------------------------------
fakeweapon_spawn = info_ff_script:new({
model = "models/items/backpack/backpack.mdl",
weaponname = "ff_weapon_crowbar",
ammo = {},
touchsound = "HealthKit.Touch",
materializesound = "Item.Materialize",
respawntime = 5,
removeOnSpawn = false,
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen}
})
function fakeweapon_spawn:spawn()
-- temporary override
--self.model = "models/items/backpack/backpack.mdl"
info_ff_script.spawn(self)
local info = CastToInfoScript(entity)
if self.removeOnSpawn then
info:Remove()
end
end
function fakeweapon_spawn:precache( )
PrecacheSound(self.materializesound)
PrecacheSound(self.touchsound)
--PrecacheModel(self.model)
end
function fakeweapon_spawn:materialize( )
entity:EmitSound(self.materializesound)
end
function fakeweapon_spawn:touch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
local dispensed = 0
if self.weaponclass ~= nil and not player:OwnsWeaponType(self.weaponclass) then
player:GiveWeapon(self.weaponclass)
dispensed = dispensed + 1
end
if self.weaponclass2 ~= nil and not player:OwnsWeaponType(self.weaponclass2) then
player:GiveWeapon(self.weaponclass2)
dispensed = dispensed + 1
end
-- give player some health and armor
if self.health ~= nil and self.health ~= 0 then player:AddHealth(self.health) end
if self.armor ~= nil and self.armor ~= 0 then player:AddArmor(self.armor) end
-- give the player some ammo
if self.nails ~= nil and self.nails ~= 0 then player:AddAmmo(Ammo.kNails, self.nails) end
if self.shells ~= nil and self.shells ~= 0 then player:AddAmmo(Ammo.kShells, self.shells) end
if self.rockets ~= nil and self.rockets ~= 0 then player:AddAmmo(Ammo.kRockets, self.rockets) end
if self.cells ~= nil and self.cells ~= 0 then player:AddAmmo(Ammo.kCells, self.cells) end
if self.detpacks ~= nil and self.detpacks ~= 0 then player:AddAmmo(Ammo.kDetpack, self.detpacks) end
if self.mancannons ~= nil and self.mancannons ~= 0 then player:AddAmmo(Ammo.kManCannon, self.mancannons) end
if self.gren1 ~= nil and self.gren1 ~= 0 then player:AddAmmo(Ammo.kGren1, self.gren1) end
if self.gren2 ~= nil and self.gren2 ~= 0 then player:AddAmmo(Ammo.kGren2, self.gren2) end
if dispensed > 0 then
local item = CastToInfoScript(entity);
item:EmitSound(self.touchsound)
-- Do this or don't call Respawn?
--item:SetStartOrigin(item:GetOrigin())
--item:SetStartAngles(item:GetAngles())
--item:Remove()
--item:Respawn(self.respawntime);
end
end
end
function fakeweapon_spawn:add_weapon( weaponname )
ConsoleToAll("fakeweapon_spawn:add_weapon " .. weaponname)
self.weaponclass2 = weaponname
end
-----------------------------------------------------------------------------
-- Weapon pickup variations.
-----------------------------------------------------------------------------
weapon_assaultcannon = fakeweapon_spawn:new({ model = "models/weapons/assaultcannon/w_assaultcannon.mdl", weaponclass = "ff_weapon_assaultcannon", shells = 400 })
weapon_autorifle = fakeweapon_spawn:new({ model = "models/weapons/autorifle/w_autorifle.mdl", weaponclass = "ff_weapon_autorifle", shells = 400 })
weapon_crowbar = fakeweapon_spawn:new({ model = "models/weapons/crowbar/w_crowbar.mdl", weaponclass = "ff_weapon_crowbar", })
weapon_flamethrower = fakeweapon_spawn:new({ model = "models/weapons/flamethrower/w_flamethrower.mdl", weaponclass = "ff_weapon_flamethrower", cells = 400 })
weapon_grenadelauncher = fakeweapon_spawn:new({ model = "models/weapons/grenadelauncher/w_grenadelauncher.mdl", weaponclass = "ff_weapon_grenadelauncher", rockets = 400 })
weapon_incendiarycannon = fakeweapon_spawn:new({ model = "models/weapons/incendiarycannon/w_incendiarycannon.mdl", weaponclass = "ff_weapon_ic", rockets = 400 })
weapon_knife = fakeweapon_spawn:new({ model = "models/weapons/knife/w_knife.mdl", weaponclass = "ff_weapon_knife" })
weapon_medkit = fakeweapon_spawn:new({ model = "models/weapons/medkit/w_medkit.mdl", weaponclass = "ff_weapon_medkit" })
weapon_nailgun = fakeweapon_spawn:new({ model = "models/weapons/nailgun/w_nailgun.mdl", weaponclass = "ff_weapon_nailgun", nails = 400 })
weapon_pipelauncher = fakeweapon_spawn:new({ model = "models/weapons/pipelauncher/w_pipelauncher.mdl", weaponclass = "ff_weapon_pipelauncher", rockets = 400 })
weapon_railgun = fakeweapon_spawn:new({ model = "models/weapons/railgun/w_railgun.mdl", weaponclass = "ff_weapon_railgun", nails = 400 })
weapon_rpg = fakeweapon_spawn:new({ model = "models/weapons/rpg/w_rpg.mdl", weaponclass = "ff_weapon_rpg", rockets = 400 })
weapon_shotgun = fakeweapon_spawn:new({ model = "models/weapons/shotgun/w_shotgun.mdl", weaponclass = "ff_weapon_shotgun", shells = 400 })
weapon_sniperrifle = fakeweapon_spawn:new({ model = "models/weapons/sniperrifle/w_sniperrifle.mdl", weaponclass = "ff_weapon_sniperrifle", nails = 400 })
weapon_spanner = fakeweapon_spawn:new({ model = "models/weapons/spanner/w_spanner.mdl", weaponclass = "ff_weapon_spanner" })
weapon_supernailgun = fakeweapon_spawn:new({ model = "models/weapons/supernailgun/w_supernailgun.mdl", weaponclass = "ff_weapon_supernailgun", nails = 400 })
weapon_supershotgun = fakeweapon_spawn:new({ model = "models/weapons/supershotgun/w_supershotgun.mdl", weaponclass = "ff_weapon_supershotgun", shells = 400 })
weapon_tommygun = fakeweapon_spawn:new({ model = "models/weapons/tommygun/w_tommygun.mdl", weaponclass = "ff_weapon_tommygun", shells = 400 })
weapon_tranq = fakeweapon_spawn:new({ model = "models/weapons/tranq/w_tranq.mdl", weaponclass = "ff_weapon_tranq", nails = 400 })
weapon_umbrella = fakeweapon_spawn:new({ model = "models/weapons/umbrella/w_umbrella.mdl", weaponclass = "ff_weapon_umbrella" })
grenade_pack = fakeweapon_spawn:new({ model = "models/items/backpack/backpack.mdl", gren1 = 4, gren2 = 4 })
weapon_sentry = fakeweapon_spawn:new({ weaponclass = "ff_weapon_deploysentrygun" })
weapon_dispenser = fakeweapon_spawn:new({ weaponclass = "ff_weapon_deploydispenser" })
-----------------------------------------------------------------------------
-- class scanner triggers
-----------------------------------------------------------------------------
function perform_player_scan(player, expectedclass, respawnturret)
if expectedclass ~= player:GetClass() then
BroadCastMessage("Wrong Class")
respawnturret.killplayer = true
else
--BroadCastMessage("Wrong Class")
end
end
scanner_class = trigger_ff_script:new({ })
function scanner_class:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local p = CastToPlayer( touch_entity )
if not p:IsBot() then
AddSchedule("perform_player_scan", 0, perform_player_scan, p, self.class, self.turret)
end
end
end
function scanner_class:onendtouch()
RemoveSchedule("perform_player_scan")
end
scout_scanner = scanner_class:new({ class=Player.kScout, })
sniper_scanner = scanner_class:new({ class=Player.kSniper, })
soldier_scanner = scanner_class:new({ class=Player.kSoldier, })
demoman_scanner = scanner_class:new({ class=Player.kDemoman, })
medic_scanner = scanner_class:new({ class=Player.kMedic, })
hwguy_scanner = scanner_class:new({ class=Player.kHwguy, })
pyro_scanner = scanner_class:new({ class=Player.kPyro, })
engineer_scanner = scanner_class:new({ class=Player.kEngineer, })
spy_scanner = scanner_class:new({ class=Player.kSpy, })
civilian_scanner = scanner_class:new({ class=Player.kCivilian, })
-----------------------------------------------------------------------------
-- class turrets
-----------------------------------------------------------------------------
scanner_turret = respawnturret:new({ team = Team.kGreen })
function scanner_turret:deploydelay( target_entity ) return 0.5 end
function scanner_turret:validtarget( target_entity )
--local entity = GetEntity(ent_id)
if self.killplayer then
local player = CastToPlayer( target_entity )
if player ~= nil and not player:IsBot() then
return true
end
end
if not AreTeamsAllied(self.team, target_entity:GetTeamId()) then return true end
return false
end
scout_turret = scanner_turret:new({ class=Player.kScout, })
sniper_turret = scanner_turret:new({ class=Player.kSniper, })
soldier_turret = scanner_turret:new({ class=Player.kSoldier, })
demoman_turret = scanner_turret:new({ class=Player.kDemoman, })
medic_turret = scanner_turret:new({ class=Player.kMedic, })
hwguy_turret = scanner_turret:new({ class=Player.kHwguy, })
pyro_turret = scanner_turret:new({ class=Player.kPyro, })
engineer_turret = scanner_turret:new({ class=Player.kEngineer, })
spy_turret = scanner_turret:new({ class=Player.kSpy, })
civilian_turret = scanner_turret:new({ class=Player.kCivilian, })
-----------------------------------------------------------------------------
-- class holograms
-----------------------------------------------------------------------------
base_hologram = info_ff_script:new({ model = "models/player/pyro/pyro.mdl", renderfx = RenderFx.kHologram })
scout_hologram = base_hologram:new({ model = "models/player/scout/scout.mdl" })
sniper_hologram = base_hologram:new({ model = "models/player/sniper/sniper.mdl" })
soldier_hologram = base_hologram:new({ model = "models/player/soldier/soldier.mdl" })
demoman_hologram = base_hologram:new({ model = "models/player/demoman/demoman.mdl" })
medic_hologram = base_hologram:new({ model = "models/player/medic/medic.mdl" })
hwguy_hologram = base_hologram:new({ model = "models/player/hwguy/hwguy.mdl" })
pyro_hologram = base_hologram:new({ model = "models/player/pyro/pyro.mdl" })
engineer_hologram = base_hologram:new({ model = "models/player/engineer/engineer.mdl" })
spy_hologram = base_hologram:new({ model = "models/player/spy/spy.mdl" })
-----------------------------------------------------------------------------
-- Beams
-----------------------------------------------------------------------------
base_beam = baseclass:new({ startstate="on",startcolor="0 255 0" })
function base_beam:spawn()
if startstate == "on" then
OutputEvent( entity:GetName(), "TurnOn" )
else
OutputEvent( entity:GetName(), "TurnOff" )
end
if startstate ~= nil then
OutputEvent( entity:GetName(), "Color", startcolor )
end
end
function base_beam:turnon()
OutputEvent( entity:GetName(), "TurnOn" )
end
function base_beam:turnoff()
OutputEvent( entity:GetName(), "TurnOff" )
end
function base_beam:setcolor(newcolor)
if newcolor ~= nil then
OutputEvent( entity:GetName(), "Color", newcolor )
end
end
-----------------------------------------------------------------------------
-- training room triggers
-----------------------------------------------------------------------------
training_room = trigger_ff_script:new({ })
function training_room:allowed()
-- if self.restrictClass ~= nil then
-- entity:EmitSound(self.speakOnceOnEnter)
-- end
return EVENT_ALLOWED
end
function training_room:ontrigger()
--ConsoleToAll("training_room:ontrigger() ")
end
function training_room:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local p = CastToPlayer( touch_entity )
if not p:IsBot() then
bot.signal(entity:GetName())
end
end
------------------
ConsoleToAll(entity:GetName() .. " ontouch")
------------------
end
function training_room:onendtouch()
------------------
ConsoleToAll(entity:GetName() .. " onendtouch")
------------------
end
function training_room:onfailtouch()
end
function training_room:onexplode()
return EVENT_ALLOWED
end
function training_room:onbuild()
return EVENT_ALLOWED
end
function training_room:onfailuse()
end
function training_room:onuse()
end
function training_room:onactive()
end
function training_room:oninactive()
end
function training_room:onremoved()
end
function training_room:onrestored()
end
function training_room:spawn()
end
-----------------------------------------------------------------------------
-- current training status
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- bot helper functions
-----------------------------------------------------------------------------
function restore_entity(entname)
local info = GetInfoScriptByName(entname)
if info ~= nil then
info:Restore()
end
end
function remove_entity(entname)
local info = GetInfoScriptByName(entname)
if info ~= nil then
info:Remove()
end
end
function update_grenadecount(entname, g1, g2)
local info = GetInfoScriptByName(entname)
if info ~= nil then
info.gren1 = tonumber(g1)
info.gren2 = tonumber(g2)
end
end
function vec_tostring(v)
return string.format("%f %f %f", v.x, v.y, v.z)
end
bot = {}
bot.spawnAtEntity = function(spawnent, name, team, class)
local info = GetInfoScriptByName(spawnent)
if info ~= nil then
info:SpawnBot(name, team, class);
end
end
bot.sendMsg = function(botname, msg, d1, d2, d3)
local p = GetPlayerByName(botname)
if p ~= nil then
p:SendBotMessage(msg, d1, d2, d3)
else
ConsoleToAll("bot.sendMsg: player not found: " .. botname)
end
end
bot.signal = function(signalname)
SendBotSignal(signalname)
end
bot.moveTo = function(botname, targetentity)
local e = GetEntityByName(targetentity)
if e ~= nil then
local epos = e:GetOrigin()
local eface = e:GetAbsFacing()
-- convert epos to string
bot.sendMsg(botname, "run_to", vec_tostring(epos), vec_tostring(eface))
end
end
bot.setIdlePoint = function(botname, targetentity)
local e = GetEntityByName(targetentity)
if e ~= nil then
local epos = e:GetOrigin()
local eface = e:GetAbsFacing()
-- convert epos to string
bot.sendMsg(botname, "set_idle_position", vec_tostring(epos), vec_tostring(eface))
end
end
bot.leaveGame = function(botname)
bot.sendMsg(botname, "leave_game")
end
-- teleportTo(botname, targetEntName)
-- local p = GetPlayerByName(botname)
-- local e = GetEntityByName(targetentity)
-- if p ~= nil and e ~= nil then
-- p:SetOrigin(e:GetOrigin())
-- p:SetAngles(e:GetAngles())
-- else
-- ConsoleToAll("teleportTo: player not found: " .. botname)
-- end
-- end
function player_giveweapon(weaponname, as)
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
local autoselect = false
if as == "true" then autoselect = true end
player:GiveWeapon(weaponname, autoselect)
end
end
function player_giveammo(ammoname, amount)
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
if ammoname == "nails" then player:AddAmmo(Ammo.kNails, tonumber(amount)) end
if ammoname == "shells" then player:AddAmmo(Ammo.kShells, tonumber(amount)) end
if ammoname == "rockets" then player:AddAmmo(Ammo.kRockets, tonumber(amount)) end
if ammoname == "cells" then player:AddAmmo(Ammo.kCells, tonumber(amount)) end
if ammoname == "detpack" then player:AddAmmo(Ammo.kDetpack, tonumber(amount)) end
if ammoname == "mancannon" then player:AddAmmo(Ammo.kManCannon, tonumber(amount)) end
if ammoname == "gren1" then player:AddAmmo(Ammo.kGren1, tonumber(amount)) end
if ammoname == "gren2" then player:AddAmmo(Ammo.kGren2, tonumber(amount)) end
end
end
function player_removeweapon(weaponname)
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
player:RemoveWeapon(weaponname)
end
end
function player_givedetpack()
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
player:AddAmmo(Ammo.kDetpack, 1)
end
end
function player_givemancannon()
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
player:AddAmmo(Ammo.kManCannon, 1)
end
end
function player_givegren1()
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
player:AddAmmo(Ammo.kGren1, 4)
end
end
function player_givegren2()
local c = Collection()
c:GetByFilter({ CF.kHumanPlayers })
for temp in c.items do
local player = CastToPlayer( temp )
player:AddAmmo(Ammo.kGren2, 4)
end
end
function player_removehealth(playername, amt)
p = GetPlayerByName(playername)
if p ~= nil then
p:AddHealth(-tonumber(amt))
else
ConsoleToAll("player_removehealth: Unable to find " .. playername)
end
end
function player_removearmor(playername, amt)
p = GetPlayerByName(playername)
if p ~= nil then
p:RemoveArmor(tonumber(amt))
else
ConsoleToAll("player_removehealth: Unable to find " .. playername)
end
end
function player_forcerespawn(playername, amt)
p = GetPlayerByName(playername)
if p ~= nil then
ApplyToPlayer(p, { AT.kRespawnPlayers })
else
ConsoleToAll("player_forcerespawn: Unable to find " .. playername)
end
end
function broadcast_message(message)
BroadCastMessage(message)
end
function training_intro(classname)
if classname == "Scout" then
BroadCastSound("training.fem_scout_ovr")
elseif classname == "Sniper" then
BroadCastSound("training.fem_sniper_ovr")
elseif classname == "Soldier" then
BroadCastSound("training.fem_soldier_ovr")
elseif classname == "Demoman" then
BroadCastSound("training.fem_demo_ovr")
elseif classname == "Medic" then
BroadCastSound("training.fem_medic_ovr")
elseif classname == "HwGuy" then
BroadCastSound("training.fem_hwguy_ovr")
elseif classname == "Pyro" then
BroadCastSound("training.fem_pyro_ovr")
elseif classname == "Spy" then
BroadCastSound("training.fem_spy_ovr")
elseif classname == "Engineer" then
BroadCastSound("training.fem_engy_ovr")
end
end
function section_complete(sectionname, room)
BroadCastSound("training.section_complete")
end
function training_complete(classname)
if classname == "Scout" then
BroadCastSound("training.fem_scout_comp")
elseif classname == "Sniper" then
BroadCastSound("training.fem_sniper_comp")
elseif classname == "Soldier" then
BroadCastSound("training.fem_soldier_comp")
elseif classname == "Demoman" then
BroadCastSound("training.fem_demo_comp")
elseif classname == "Medic" then
BroadCastSound("training.fem_medic_comp")
elseif classname == "HwGuy" then
BroadCastSound("training.fem_hwguy_comp")
elseif classname == "Pyro" then
BroadCastSound("training.fem_pyro_comp")
elseif classname == "Spy" then
BroadCastSound("training.fem_spy_comp")
elseif classname == "Engineer" then
BroadCastSound("training.fem_engy_comp")
end
end
function training_classname(classId)
if classId == Player.kScout then return "Scout" end
if classId == Player.kSniper then return "Sniper" end
if classId == Player.kSoldier then return "Soldier" end
if classId == Player.kDemoman then return "Demoman" end
if classId == Player.kMedic then return "Medic" end
if classId == Player.kHwguy then return "HwGuy" end
if classId == Player.kPyro then return "Pyro" end
if classId == Player.kSpy then return "Spy" end
if classId == Player.kEngineer then return "Engineer" end
if classId == Player.kCivilian then return "Civilian" end
end

Some files were not shown because too many files have changed in this diff Show more