PDA

View Full Version : Kill lasers a-la Aardvark


Credge
08-29-2009, 03:16 AM
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:

-----------------------------------------------------------------------------
-- 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?

Bridget
08-29-2009, 03:29 AM
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'.

Sidd
08-29-2009, 02:13 PM
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

Credge
08-29-2009, 04:36 PM
Thanks to the two of you. Got it working.