Difference between revisions of "Lua:ff miniturret"

From Fortress Forever Wiki
Jump to navigationJump to search
m
m
Line 1: Line 1:
 
{{Infobox_mapping}}
 
{{Infobox_mapping}}
ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua.
+
==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.
  
==ff_miniturret:validtarget(target_entity)==
+
* respawnturret_blue
 +
* respawnturret_red
 +
* respawnturret_yellow
 +
* respawnturret_green
 +
 
 +
Turrets are typically embedded into a ceiling, with just the bottom cap sticking out. Unlike TFC's turrets, they cannot be floor-mounted.
 +
 
 +
==validtarget==
 +
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.
 
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.
Line 16: Line 25:
  
  
==ff_miniturret:deploydelay(target_entity)==
+
==deploydelay==
 +
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.
 
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.

Revision as of 23:39, 13 May 2012

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

Commands
Callbacks

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

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

validtarget

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


deploydelay

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