Difference between revisions of "Category:Lua Commands"

From Fortress Forever Wiki
Jump to navigationJump to search
m (2.42)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Infobox manual/Header}}
 
{{Infobox manual/Header}}
LUA commands that require further explanation.
+
{{Infobox mapping}}
 +
LUA commands that are specific for Fortress Forever. This list is incomplete and will be replaced eventually, and everything put into categories.
  
= Global Events =
+
=Global Functions=
These are functions that are called by the engine that do not belong inside any class. Simply declare them as globals in the lua namespace.
+
Global functions are not confined to any object type. They can be called alone, from just about anywhere in the script.
  
{| border="1" cellspacing="0"
+
'''Example:'''
! LUA Command !! Description
+
local player = CastToPlayer( player_entity )
|-
+
AddHudTimer(player, "timer", 300, -1, 0, 70, 4)
| [[Lua:Tick|tick]]() || This function is called every second by the engine.
+
This global function is not a player function, though it takes a player object as a parameter.
|-
+
==[[Lua:Entity_typing#Casting_Commands|Casting Commands]]==
| [[Lua:Precache|precache]]() || This function is called when the map starts, before entities have been initialized.
+
These functions cast game objects into different data types. See [[Lua:Entity_typing]].
|-
 
| [[Lua:Startup|startup]]() || This function is called when the map starts, after all the entities have been initialized, also used to set map properties.  
 
|-
 
| [[Lua:Flaginfo|flaginfo]]() ||
 
|}
 
  
== Player Triggered Commands ==
+
==[[Lua:Entity_typing#Entity_Checking|Entity Checks]]==
 +
These commands are used to check if the specified entity is a game entity of a specific type. See [[Lua:Entity_typing]].
  
These commands are triggered when a event with a player happens in-game.
+
==[[:Category:Messages | Player messaging and sounds]]==
 +
These are used to send text messages and sounds to players.
  
{| border="1" cellspacing="0"
+
==[[:Category:Schedules | Schedules]]==
! LUA Command !! Description
+
Schedules are a way to delay the effects of a script for a specific length of time.
|-
 
| [[Lua:player_spawn|player_spawn]]( player ) || triggers when a player spawns.
 
|-
 
| [[Lua:player_killed|player_killed]]( player, killer ) ||  triggers when a player is killed.
 
|-
 
| [[Lua:player_onconc|player_onconc]]( player, inflictor ) || triggers when a player is conced.
 
conc_duration -- duration of conc
 
  
conc_iconduration -- duration of conced icon on HUD
+
==[[:Category:HUD_Items | HUD Items]]==
|-
+
Through Lua, a map can display information on a player's screen.
| [[Lua:player_ondamage|player_ondamage]]( player ) || triggers is called whenever a player takes damage.
 
|-
 
| [[Lua:player_ontranq|player_ontranq]]( player, inflictor ) || triggers when a player is tranq'd.
 
tranq_duration -- duration of tranq.
 
  
tranq_speed -- speed of tranq'd player.
+
==[[:Category:Objective Icons | Objective Icons]]==
|-
+
Objective icons help guide the player to where they are supposed to be.
| [[Lua:player_ongas|player_ongas]]( player, inflictor ) || triggers when a player is gassed.
 
gas_duration
 
  
gas_iconduration
+
==[[:Category:Utility functions | Utility]]==
|-
+
These lua functions are useful for getting your scripts working.
| [[Lua:player_oninfect|player_oninfect]]( player, inflictor ) ||
 
infection_duration
 
  
infect_iconduration
+
=Object functions=
|-
+
Each class of entity will have its own set of functions. These are listed in the links below:
| [[Lua:player_onradiotag|player_onradiotag]]( player, inflictor ) ||
+
* [[:Category:Damageinfo functions|Damageinfo]]-- An object that is created every time someone/something gets hurt in the game.
radiotag_duration
+
* [[:Category:Entity_Functions|Entity]] --A generic game entity from which all of the below are derived.
radiotag_iconduration
+
* [[:Category:Buildable_functions|Buildable]] -- Sentries, dispensers, etc.
|-
+
* [[Lua:info_ff_script|info_ff_script]] -- A FF game object. These are most often used as flags or other objectives.
| [[Lua:player_onheadshot|player_onheadshot]]( player, inflictor ) ||
+
* [[:Category:Player functions|Player]] -- Anyone that's connected to a server.
|-
+
* [[:Category:Team functions|Team]] -- A team is a group of folks who don't like other groups of folks.
| [[Lua:player_onlegshot|player_onlegshot]]( player, inflictor ) ||
 
legshot_duration
 
 
 
legshot_iconduration
 
 
 
legshot_speed
 
|-
 
| [[Lua:player_oncaltrop|player_oncaltrop]]( player, inflictor ) ||
 
caltrop_duration
 
 
 
caltrop_iconduration
 
 
 
caltrop_speed
 
|-
 
| [[Lua:player_onacspinup|player_onacspinup]]( player, inflictor ) ||
 
acspinup_duration
 
 
 
acspinup_speed
 
|-
 
| [[Lua:player_onsniperrifle|player_onsniperrifle]]( player, inflictor ) ||
 
sniperrifle_speed
 
|-
 
| [[Lua:player_onspeedluaX|player_onspeedluaX]]( player, inflictor ) || these are for various speed settings, like CZ2's flags. You can have up to ten, they're defined here.
 
speedlua_speed
 
|-
 
|}
 
 
 
= Casting Commands =
 
 
 
These functions cast game objects into different data types. See [[Lua:Entity_typing]]
 
 
 
{| border="1" cellspacing="0"
 
! LUA Command !! Description
 
|-
 
| [[Lua:CastToBeam|CastToBeam]]( ent_id ) || tries to cast the entity to a beam (to see if whatever triggered the event was a laser beam, a la SD2). If it fails, it returns null.
 
|-
 
| [[Lua:CastToPlayer|CastToPlayer]]( ent_id ) || used to cast the passed in entity to a player, often used for touch commands.
 
|-
 
| [[Lua:CastToInfoScript|CastToInfoScript]]( ent_id ) ||
 
|-
 
| [[Lua:CastToTriggerScript|CastToTriggerScript]]( ent_id ) ||
 
|-
 
| [[Lua:CastToTriggerClip|CastToTriggerClip]]( ent_id ) ||
 
|-
 
| [[Lua:CastToGrenade|CastToGrenade]]( ent_id ) ||
 
|-
 
| [[Lua:CastToDispenser|CastToDispenser]]( ent_id ) ||
 
|-
 
| [[Lua:CastToSentrygun|CastToSentrygun]]( ent_id ) ||
 
|-
 
| [[Lua:CastToDetpack|CastToDetpack]]( ent_id ) ||
 
|}
 
 
 
 
 
= Entity Checks =
 
these commands are used to Check if a passed in entity is a game entity of a specific type
 
 
 
{| border="1" cellspacing="0"
 
! LUA Command !! Description
 
|-
 
| [[Lua:IsPlayer|IsPlayer]]( ent_id ) || used to see if a passed in entity is a player to before actions are performed on said player.
 
|-
 
| [[Lua:IsDispenser|IsDispenser]]( ent_id ) ||
 
|-
 
| [[Lua:IsSentrygun|IsSentrygun]]( ent_id ) ||
 
|-
 
| [[Lua:IsDetpack|IsDetpack]]( ent_id ) ||
 
|-
 
| [[Lua:IsGrenade|IsGrenade]]( ent_id ) ||
 
|-
 
| [[Lua:IsTurret|IsTurret]]( ent_id ) ||
 
|}
 
 
 
= Player messaging and sounds =
 
these are used to send text messages and sounds to players.
 
 
 
{| border="1" cellspacing="0"
 
! LUA Command !! Description
 
|-
 
| [[Lua:BroadCastMessage|BroadCastMessage]]( message ) || broadcasts a given message to all players.
 
|-
 
| [[Lua:BroadCastMessageToPlayer|BroadCastMessageToPlayer]]( player, message ) || broadcasts message to one player.
 
|-
 
| [[Lua:BroadCastSound|BroadCastSound]]( sound ) ||
 
|-
 
| [[Lua:BroadCastSoundToPlayer|BroadCastSoundToPlayer]]( player, sound ) ||
 
|-
 
| [[Lua:ConsoleToAll|ConsoleToAll]]( message ) || sends a message to server console. Inaccurately named.
 
|}
 
 
 
= Other Commands =
 
other misc commands not lumped into any group as of yet.
 
 
 
{| border="1" cellspacing="0"
 
! LUA Command !! Description
 
|-
 
| [[Lua:AddSchedule|AddSchedule]]("name", time, function[, param1 ... param4]) || Schedules function to go off with time second delay. Optional parameters are applied to the function.
 
|-
 
| [[Lua:AddScheduleRepeating|AddScheduleRepeating]]("name", time, function[, param1 ... param4]) || Adds a schedule that repeats function constantly every time seconds.
 
|-
 
| [[Lua:AddScheduleRepeatingNotInfinitely|AddScheduleRepeatingNotInfinitely]]("name", time, function, counts[, param1 ... param4]) || Adds a schedule that repeats function counts times every time seconds.
 
|-
 
| [[Lua:AddHudIcon|AddHudIcon]]( player, HudIconType, NameOfHudIcon, X, Y, Width, Height, Align ) || adds HUD icon to given player of given type. Name is generally taken from the flag entity to apply the right kind. X, Y, W, H, and A are all standard.
 
|-
 
| [[Lua:AddHudIconToAll|AddHudIconToAll]]( HudIconType, NameOfHudUcon, X, Y, W, H, A ) || adds HUD icon to all players like those used for flag info.
 
|-
 
| [[Lua:DeleteSchedule|DeleteSchedule]]( schedulename ) || deletes an existing schedule.
 
|-
 
| [[Lua:RemoveSchedule|RemoveSchedule]]( schedulename ) || same as delete.
 
|-
 
| [[Lua:GetConvar|GetConvar]]( cvar ) || checks the value of a console variable (cvar)
 
|-
 
| [[Lua:GetEntity|GetEntity]]( index ) || gets an entity by its index.
 
|-
 
| [[Lua:GetEntityByName|GetEntityByName]]( name ) || obvious?
 
|-
 
| [[Lua:GetInfoScriptById|GetInfoScriptById]]( id ) || gets an info_ff_script's information by its id.
 
|-
 
| [[Lua:GetInfoScriptByName|GetInfoScriptByName]]( name ) || obvious?
 
|-
 
| [[Lua:GetGrenade|GetGrenade]]() || ??
 
|-
 
| [[Lua:GetPacketloss|GetPacketloss]]( playerentity ) || gets a player's packet loss. Woo?
 
|-
 
| [[Lua:GetPing|GetPing]]( playerentity ) ||
 
|-
 
| [[Lua:GetPlayer|GetPlayer]]( playerentity ) ||
 
|-
 
| [[Lua:GetPlayerByID|GetPlayerByID]]( id ) ||
 
|-
 
| [[Lua:GetServerTime|GetServerTime]]()  ||
 
|-
 
| [[Lua:GetSteamID|GetSteamID]]( playerentity ) ||
 
|-
 
| [[Lua:GetTeam|GetTeam]]( playerentity ) ||
 
|-
 
| [[Lua:GetTriggerScriptByName|GetTriggerScriptByName]]( name ) ||
 
|-
 
| [[Lua:GoToIntermission|GoToIntermission]]( ) || ???
 
|-
 
| [[Lua:IncludeScript|IncludeScript]]( luafile ) || used to include Lua files found in /includes/ such as base_teamplay or base_ctf.
 
|-
 
| [[Lua:ApplyToAll|ApplyToAll]]( effect ) ||
 
|-
 
| [[Lua:ApplyToTeam|ApplyToTeam]]( effect, team ) ||
 
|-
 
| [[Lua:ApplyToPlayer|ApplyToPlayer]]( effect, player ) ||
 
|-
 
| [[Lua:AreTeamsAllied|AreTeamsAllied]]( team1, team2 ) || obvious?
 
|-
 
| [[Lua:KillAndRespawnAllPlayers|KillAndRespawnAllPlayers]]() || obvious!
 
|-
 
| [[Lua:NumPlayers|NumPlayers]]() || gets the number of players.
 
|-
 
| [[Lua:OutputEvent|OutputEvent]]( event, ent_id[, param1, param2, etc.] ) || tells an entity to fire the given output.
 
|-
 
| OutputEvent , void * const char* , const char* , const char* , float , unsigned int &FFLib::FireOutput  ||
 
|-
 
| [[Lua:PrecacheModel|PrecacheModel]]( modelfile ) || loads a given model into memory for use later.
 
|-
 
| [[Lua:PrecacheSound|PrecacheSound]]( soundfile ) || as above.
 
|-
 
| PrintBool , &FFLib::PrintBool  ||
 
|-
 
| [[Lua:RandomFloat|RandomFloat]]( min, max ) || generates a random float.
 
|-
 
| [[Lua:RandomInt|RandomInt]]( min, max ) || generates a random integer
 
|-
 
| [[Lua:RemoveEntity|RemoveEntity]]( ent_id ) || removes entity.
 
|-
 
| [[Lua:RemoveHudItem|RemoveHudItem]]( player, hudiconid ) || removes hud icon.
 
|-
 
| [[Lua:RemoveHudItemFromAll|RemoveHudItemFromAll]]( hudiconid ) ||
 
|-
 
| [[Lua:RespawnAllPlayers|RespawnAllPlayers]]( ) || respawns everyone.
 
|-
 
| [[Lua:ResetMap|ResetMap]]() || resets map.
 
|-
 
| [[Lua:SetGlobalRespawnDelay|SetGlobalRespawnDelay]]( time ) || enforces a respawn delay.
 
|-
 
| [[Lua:SetPlayerLimit|SetPlayerLimit]]( team , # ) || used to set player limit per team.
 
|-
 
| [[Lua:SetPlayerLimits|SetPlayerLimits]]( #, # ) ||
 
|-
 
| [[Lua:SmartClassLimits|SmartClassLimits]]( team, #scout, #sniper, #soldier, #demoman, #medic, #hwguy, #pyro, #spy, #engineer, #civilian ) || sets smart class limits instead of using individual commands.
 
|-
 
| [[Lua:SetConvar|SetConvar]]( player, var, value ) || sets a players cvar to set value
 
|-
 
| [[Lua:SetTeamAllies|SetTeamAllies]]( team , bits ) || used to ally one team to another.
 
|-
 
| [[Lua:SetTeamClassLimit|SetTeamClassLimit]]( team, class, limit ) ||
 
|-
 
| [[Lua:SetTeamName|SetTeamName]]( team, name ) ||
 
|-
 
| [[Lua:SetTeamPlayerLimit|SetTeamPlayerLimit]]( team, limit ) ||
 
|-
 
| [[Lua:SetTeamPlayerLimit|SetTeamPlayerLimit]]( team, limit ) ||
 
|-
 
| SmartMessage , &FFLib::SmartMessage ||
 
|-
 
| SmartSound , &FFLib::SmartSound ||
 
|-
 
| SmartTeamMessage , &FFLib::SmartTeamMessage ||
 
|-
 
| SmartTeamSound , &FFLib::SmartTeamSound ||
 
|-
 
| SpeakAll , &FFLib::SpeakAll ||
 
|-
 
| SpeakPlayer , &FFLib::SpeakPlayer ||
 
|-
 
| SpeakTeam , &FFLib::SpeakTeam ||
 
|}
 
  
 
[[Category:Lua]]
 
[[Category:Lua]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Latest revision as of 21:06, 25 June 2011


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

LUA commands that are specific for Fortress Forever. This list is incomplete and will be replaced eventually, and everything put into categories.

Global Functions

Global functions are not confined to any object type. They can be called alone, from just about anywhere in the script.

Example:

local player = CastToPlayer( player_entity )
AddHudTimer(player, "timer", 300, -1, 0, 70, 4)

This global function is not a player function, though it takes a player object as a parameter.

Casting Commands

These functions cast game objects into different data types. See Lua:Entity_typing.

Entity Checks

These commands are used to check if the specified entity is a game entity of a specific type. See Lua:Entity_typing.

Player messaging and sounds

These are used to send text messages and sounds to players.

Schedules

Schedules are a way to delay the effects of a script for a specific length of time.

HUD Items

Through Lua, a map can display information on a player's screen.

Objective Icons

Objective icons help guide the player to where they are supposed to be.

Utility

These lua functions are useful for getting your scripts working.

Object functions

Each class of entity will have its own set of functions. These are listed in the links below:

  • Damageinfo-- An object that is created every time someone/something gets hurt in the game.
  • Entity --A generic game entity from which all of the below are derived.
  • Buildable -- Sentries, dispensers, etc.
  • info_ff_script -- A FF game object. These are most often used as flags or other objectives.
  • Player -- Anyone that's connected to a server.
  • Team -- A team is a group of folks who don't like other groups of folks.