Difference between revisions of "Lua:ff miniturret"

From Fortress Forever Wiki
Jump to navigationJump to search
m
Line 1: Line 1:
 +
info_ff_teamspawn
 
ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua.
 
ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua.
  

Revision as of 13:53, 13 April 2010

info_ff_teamspawn ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua.

ff_miniturret:validtarget(target_entity)

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.

Example

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


ff_miniturret:deploydelay(target_entity)

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.

Example

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