Difference between revisions of "Category:Utility functions"

From Fortress Forever Wiki
Jump to navigationJump to search
m
m
Line 2: Line 2:
 
{{Infobox mapping}}
 
{{Infobox mapping}}
 
These global functions are useful for getting your scripts working.
 
These global functions are useful for getting your scripts working.
{| border="1" cellspacing="2" cellpadding="5"
+
{| border="1" cellspacing="2" cellpadding="2"
 
! General Technical Functions !! Description
 
! General Technical Functions !! Description
 
|-
 
|-
Line 22: Line 22:
 
|-
 
|-
 
| [[Lua:OutputEvent|OutputEvent]]( entity, input, parameter, delay, x ) || Triggers any named entity in the map using Source's [http://developer.valvesoftware.com/wiki/Inputs_and_Outputs#Inputs I/O system].
 
| [[Lua:OutputEvent|OutputEvent]]( entity, input, parameter, delay, x ) || Triggers any named entity in the map using Source's [http://developer.valvesoftware.com/wiki/Inputs_and_Outputs#Inputs I/O system].
 +
|-
 +
| [[Lua:SetConvar|SetConvar]]( player, var, value ) || sets a player's [http://developer.valvesoftware.com/wiki/Console_Command_List console variable] to a specified value.
 
|-
 
|-
 
! Player information !!
 
! Player information !!
Line 33: Line 35:
 
! Server Info !!
 
! Server Info !!
 
|-
 
|-
| [[Lua:GetServerTime|GetServerTime]]()  ||  
+
| float [[Lua:GetServerTime|GetServerTime]]()  || Returns the number of seconds the map has been running.
 
|-
 
|-
 
| [[Lua:AreTeamsAllied|AreTeamsAllied]]( team1, team2 ) || Returns true if they are.
 
| [[Lua:AreTeamsAllied|AreTeamsAllied]]( team1, team2 ) || Returns true if they are.
Line 39: Line 41:
 
| [[Lua:NumPlayers|NumPlayers]]() || gets the number of players.
 
| [[Lua:NumPlayers|NumPlayers]]() || gets the number of players.
 
|-
 
|-
| [[Lua:GetConvar|GetConvar]]( cvar ) || returns the value of a console variable on the server(cvar).
+
| [[Lua:GetConvar|GetConvar]]( cvar ) || returns the value of a [http://developer.valvesoftware.com/wiki/Console_Command_List console variable] on the server(cvar).
 
|-
 
|-
 
! Server Effects !!
 
! Server Effects !!
Line 54: Line 56:
 
| [[Lua:ResetMap|ResetMap]]() || resets map.
 
| [[Lua:ResetMap|ResetMap]]() || resets map.
 
|-
 
|-
| [[Lua:SetConvar|SetConvar]]( player, var, value ) || sets a players console variable to set value
+
| [[Lua:set_cvar|set_cvar]](cvar, value) || Sets a [http://developer.valvesoftware.com/wiki/Console_Command_List console variable] on the server
 
|-
 
|-
 
| [[Lua:ApplyToAll|ApplyToAll]]( effect ) || pass this a list of [[Lua:Flags#AT | AT flags]] to apply global effects to the server.
 
| [[Lua:ApplyToAll|ApplyToAll]]( effect ) || pass this a list of [[Lua:Flags#AT | AT flags]] to apply global effects to the server.

Revision as of 14:24, 7 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

These global functions are useful for getting your scripts working.

General Technical Functions Description
IncludeScript(string) This function loads the contents of another lua file, located in FortresForever\maps\includes.
ConsoleToAll( message ) sends a message to server console. Inaccurately named--players will not see this.
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.
OutputEvent( entity, input, parameter, delay, x ) Triggers any named entity in the map using Source's I/O system.
SetConvar( player, var, value ) sets a player's console variable to a specified value.
Player information
GetPacketloss( playerentity ) gets a player's packet loss. Woo?
GetPing( playerentity )
GetSteamID( playerentity )
Server Info
float GetServerTime() Returns the number of seconds the map has been running.
AreTeamsAllied( team1, team2 ) Returns true if they are.
NumPlayers() gets the number of players.
GetConvar( cvar ) returns the value of a console variable on the server(cvar).
Server Effects
SetGameDescription( name ) Changes what appears in the game column of the server browser (it is appended to "FF ")

For use in startup().

RespawnAllPlayers( ) Respawns everyone immediately.
KillAndRespawnAllPlayers() obvious!
GoToIntermission( ) Sends all players to the info_intermission entity and shows them the scoreboard. Then, the map ends.
ResetMap() resets map.
set_cvar(cvar, value) Sets a console variable on the server
ApplyToAll( effect ) pass this a list of AT flags to apply global effects to the server.
ApplyToTeam( effect, team ) pass this a team id and a list of AT flags to apply effects to players on a team.
ApplyToPlayer( effect, player ) pass this a player id and a list of AT flags to apply effects to a player.
HasGameStarted( ) Returns false if the map is in prematch mode.
Game Rules
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 class limits for the entire team.
SetTeamAllies( team , bits ) used to ally one team to another.
SetTeamClassLimit( team, class, limit )
SetTeamName( team, name ) Set a custom name for a team: appears on the scoreboard and team selection screen.
SetTeamPlayerLimit( team, limit )

Pages in category "Utility functions"

The following 7 pages are in this category, out of 7 total.