Lua:ff miniturret

From Fortress Forever Wiki
Revision as of 22:42, 13 May 2012 by Crazycarl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Mapping for FF
The Basics

Setting up Hammer
Getting Started With Lua
Releasing a map

FF-specific Entities

Lua location system

Map Templates
FF Lua Documentation

Entity Typing
Entity Collections


Spawn Turrets

ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua. However, basic team-oriented turrets can be defined by placing the turret entity and naming it appropriately.

  • respawnturret_blue
  • respawnturret_red
  • respawnturret_yellow
  • respawnturret_green

The code for this functionality is located in includes/base_respawnturret.lua. Insert this line into your lua file:


Turrets are typically embedded into a ceiling, with just the bottom cap sticking out. Unlike TFC's turrets, they cannot be floor-mounted.



Respawn turrets will target players, sentries, and dispensers. Use this to define what is a valid target. Returning true makes the turret shoot at the entity in question. Within the scope of this callback, the keyword entity refers to the turret.


-- 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(, target_entity:GetTeamId()) == false)



When a turret finds a valid target, it deploys after a two second delay. Use this callback to change this response time. Within the scope of this callback, the keyword entity refers to the turret.


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