Difference between revisions of "Category:Lua Commands"

From Fortress Forever Wiki
Jump to navigationJump to search
m
Line 10: Line 10:
 
  AddHudTimer(player, "timer", 300, -1, 0, 70, 4)
 
  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.
 
This global function is not a player function, though it takes a player object as a parameter.
== Casting Commands ==
+
==[[Lua:Entity_typing#Casting_Commands|Casting Commands]]==
These functions cast game objects into different data types. See [[Lua:Entity_typing]]
+
These functions cast game objects into different data types. See [[Lua:Entity_typing]].
  
{| border="1" cellspacing="0"
+
==[[Lua:Entity_typing#Entity_Checking|Entity Checks]]==
! LUA Command !! Description
+
These commands are used to check if the specified entity is a game entity of a specific type. See [[Lua:Entity_typing]].
|-
 
| [[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 the specified 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 ) ||
 
|}
 
  
 
==[[:Category:Messages | Player messaging and sounds]]==
 
==[[:Category:Messages | Player messaging and sounds]]==

Revision as of 00:02, 2 May 2010


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.

Other Commands

Other misc commands not lumped into any group as of yet.

LUA Command Description
ConsoleToAll( message ) sends a message to server console. Inaccurately named--players will not see this.
SetGameDescription( name ) Changes what appears in the game column of the server browser (it is appended to "FF ")

For use in startup().

HasGameStarted( ) Returns false if the map is in prematch mode.
GetConvar( cvar ) checks the value of a console variable (cvar)
GetEntity( index ) gets an entity by its index.
GetEntityByName( name ) obvious?
GetInfoScriptById( id ) gets an info_ff_script's information by its id.
GetInfoScriptByName( name ) obvious?
GetGrenade() ??
GetPacketloss( playerentity ) gets a player's packet loss. Woo?
GetPing( playerentity )
GetPlayer( playerentity )
GetPlayerByID( id )
GetServerTime()
GetSteamID( playerentity )
GetTeam( playerentity )
GetTriggerScriptByName( name )
GoToIntermission( ) ???
IncludeScript( luafile ) used to include Lua files found in /includes/ such as base_teamplay or base_ctf.
ApplyToAll( effect )
ApplyToTeam( effect, team )
ApplyToPlayer( effect, player )
AreTeamsAllied( team1, team2 ) obvious?
KillAndRespawnAllPlayers() obvious!
NumPlayers() gets the number of players.
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
PrecacheModel( modelfile ) loads a given model into memory for use later.
PrecacheSound( soundfile ) as above.
PrintBool , &FFLib::PrintBool
RandomFloat( min, max ) generates a random float.
RandomInt( min, max ) generates a random integer
RemoveEntity( ent_id ) removes entity.
RespawnAllPlayers( ) respawns everyone.
ResetMap() resets map.
SetGlobalRespawnDelay( time ) enforces a respawn delay.
SetPlayerLimit( team , # ) used to set player limit per team.
SetPlayerLimits( #, # )
SmartClassLimits( team, #scout, #sniper, #soldier, #demoman, #medic, #hwguy, #pyro, #spy, #engineer, #civilian ) sets smart class limits instead of using individual commands.
SetConvar( player, var, value ) sets a players cvar to set value
SetTeamAllies( team , bits ) used to ally one team to another.
SetTeamClassLimit( team, class, limit )
SetTeamName( team, name )
SetTeamPlayerLimit( team, limit )
SetTeamPlayerLimit( team, limit )

Object functions

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

  • Buildable -- Sentries, dispensers, etc.
  • Damageinfo-- An object that is created every time someone/something gets hurt in the game.
  • info_ff_script -- A generic 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.