Difference between revisions of "Map Template:Security"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} =Introduction= This 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 rela...)
 
Line 8: Line 8:
 
*<b>red_secup_relay</b> (logic_relay): This relay gets fired when security reactivates.
 
*<b>red_secup_relay</b> (logic_relay): This relay gets fired when security reactivates.
 
=Lua Script=
 
=Lua Script=
<pre>IncludeScript("base");
+
<pre>-- security_test.lua
 +
IncludeScript("base");
 +
IncludeScript("base_ctf");
  
 
-- security is active to start
 
-- security is active to start
redsecurty = true
+
redsecurity = true
  
 
red_sec = trigger_ff_script:new()
 
red_sec = trigger_ff_script:new()
  
 
function red_sec:ontouch( touch_entity )
 
function red_sec:ontouch( touch_entity )
 +
ConsoleToAll("moooo?")
 
if IsPlayer( touch_entity ) then
 
if IsPlayer( touch_entity ) then
 
local player = CastToPlayer( touch_entity )
 
local player = CastToPlayer( touch_entity )
 
-- can only be deactivated by blue players
 
-- can only be deactivated by blue players
 
if player:GetTeamId() == Team.kBlue then
 
if player:GetTeamId() == Team.kBlue then
 +
ConsoleToAll("caaaa")
 
if redsecurity then
 
if redsecurity then
 +
ConsoleToAll("ummm")
 
redsecurity = false
 
redsecurity = false
 
AddSchedule("secup10red",50,secup10red)
 
AddSchedule("secup10red",50,secup10red)
Line 47: Line 52:
 
-- Give a 10 second warning that security will reactivate
 
-- Give a 10 second warning that security will reactivate
 
BroadCastMessage("Red Security Online in 10 Seconds")
 
BroadCastMessage("Red Security Online in 10 Seconds")
end
+
end</pre>
</pre>
 
 
&nbsp;
 
&nbsp;
 
[[Category:Map Templates]] [[Category:Mapping]]
 
[[Category:Map Templates]] [[Category:Mapping]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Revision as of 05:47, 29 August 2009


Introduction

This 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

  • red_sec (trigger_ff_script): Trigger which deactivates security when touched.
  • red_secdown_relay (logic_relay): This relay gets fired when security gets deactivated.
  • red_secup_relay (logic_relay): This relay gets fired when security reactivates.

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 )
	ConsoleToAll("moooo?")
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		-- can only be deactivated by blue players
		if player:GetTeamId() == Team.kBlue then
			ConsoleToAll("caaaa")
			if redsecurity then
				ConsoleToAll("ummm")
				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