Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 08-29-2009, 04:16 AM   #1
Credge
FF Loremaster
Beta Tester
 
Join Date: Sep 2007
Posts Rated Helpful 4 Times
Kill lasers a-la Aardvark

Or really, any other map that has them. I'm using the aardvark LUA for a basis of my maps LUA because it has things pretty close to what I want from my map anyway.

However, I'm having some problems with getting the kill lasers to work. From the Aardvark LUA:

Code:
-----------------------------------------------------------------------------
-- 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 })
I'm not entirely sure what I need to name my entity to get this to work. Any help?
__________________
"The nine most terrifying words in the English language are: 'I'm from the government and I'm here to help.'"

Ronald Reagan
Credge is offline   Reply With Quote


Old 08-29-2009, 04:29 AM   #2
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Code:
kill_trigger = trigger_ff_script:new({team = Team.kUnassigned})
red_spawn = kill_trigger:new({team = Team.kRed})
blue_spawn = kill_trigger:new({team = Team.kBlue})

function kill_trigger:allowed(activator)
	if IsPlayer(activator) then
		local player = CastToPlayer(activator)
		if player:GetTeamId() == self.team then
			return EVENT_ALLOWED
		end
	end
	return EVENT_DISALLOWED
end
Make a trigger brush guarding the red spawn, for example. Texture it with the trigger texture. Tie this brush to trigger_hurt. Name it 'red_spawn' in the entity options. Set the damage to something like '99999'.
Bridget is offline   Reply With Quote


Old 08-29-2009, 03:13 PM   #3
Sidd
Lua Team
 
Join Date: Mar 2007
Posts Rated Helpful 1 Times
The actual lasers are just env_laser's that don't do any damage. The damage is done by a trigger_hurt called blue_slayer or sec_red_slayer.

The variables bluesecstatus and redsecstatus determine if the trigger_hurt do any damage. The visible lasers need to be turned on and off by logic relays in your map.

don't call a trigger hurt "red_spawn". That name is taken for spawn points
Sidd is offline   Reply With Quote


Old 08-29-2009, 05:36 PM   #4
Credge
FF Loremaster
Beta Tester
 
Join Date: Sep 2007
Posts Rated Helpful 4 Times
Thanks to the two of you. Got it working.
__________________
"The nine most terrifying words in the English language are: 'I'm from the government and I'm here to help.'"

Ronald Reagan
Credge is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:30 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.