Map Template:Security
From Fortress Forever Wiki
|
IntroductionThis is how to set up security doors and lasers in a map. The doors, lasers, trigger_hurt's, lights and sounds are all controlled by two logic relays. The relays are triggered by the lua. Entities
Lua Script-- security_test.lua
IncludeScript("base");
IncludeScript("base_ctf");
-- security is active to start
redsecurity = true
red_sec = trigger_ff_script:new()
function red_sec:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
local player = CastToPlayer( touch_entity )
-- can only be deactivated by blue players
if player:GetTeamId() == Team.kBlue then
if redsecurity then
redsecurity = false
AddSchedule("secup10red",50,secup10red)
AddSchedule("secupred",60,secupred)
OutputEvent("red_secdown_relay", "Trigger" )
BroadCastMessage("Red Security Deactivated for 60 Seconds")
SpeakAll( "SD_REDDOWN" )
RemoveHudItemFromAll( "red-sec-up" )
AddHudIconToAll( "hud_secdown.vtf", "red-sec-down", 60, 25, 16, 16, 3 )
end
end
end
end
function secupred()
-- This function reactivates security
redsecurity = true
OutputEvent("red_secup_relay", "Trigger" )
BroadCastMessage("Red Security Online")
SpeakAll( "SD_REDUP" )
RemoveHudItemFromAll( "red-sec-down" )
AddHudIconToAll( "hud_secup_red.vtf", "red-sec-up", 60, 25, 16, 16, 3 )
end
function secup10red()
-- Give a 10 second warning that security will reactivate
BroadCastMessage("Red Security Online in 10 Seconds")
end
|