Difference between revisions of "Lua:SetTeamClassLimit"

From Fortress Forever Wiki
Jump to navigationJump to search
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Hi
+
{{Infobox manual/Header}}
 +
==SetTeamClassLimit==
 +
 
 +
SetTeamClassLimit is used to set the class limits for a team. This means telling a team which classes are allowed as well as the number of that class allowed. It must be placed in your map's startup() function and gets passed 3 parameters:
 +
<pre>SetTeamClassLimit( team, class, limit )</pre>
 +
 
 +
<pre>
 +
team  - team to set limits on
 +
class - class to set a limit on
 +
limit - how many are allowed (0 = infinite, -1 = none)
 +
</pre>
 +
 
 +
In this example, we will make red only have 2 snipers and blue not have any soldiers:
 +
 
 +
===Example .LUA startup() function===
 +
<pre>
 +
function startup()
 +
    -- Limit red to 2 snipers
 +
    SetTeamClassLimit( RED_TEAM, CLASS_SNIPER, 2 )
 +
 
 +
    -- Remove soldiers from blue team
 +
    SetTeamClassLimit( BLUE_TEAM, CLASS_SOLDIER, -1 )
 +
end
 +
</pre>
 +
 
 +
Every other class will be allowed an infinite number of players.
 +
 
 +
[[Category:Lua_Commands]]
 +
{{Infobox manual/Footer}}

Latest revision as of 16:41, 31 December 2007


SetTeamClassLimit

SetTeamClassLimit is used to set the class limits for a team. This means telling a team which classes are allowed as well as the number of that class allowed. It must be placed in your map's startup() function and gets passed 3 parameters:

SetTeamClassLimit( team, class, limit )
team  - team to set limits on
class - class to set a limit on
limit - how many are allowed (0 = infinite, -1 = none)

In this example, we will make red only have 2 snipers and blue not have any soldiers:

Example .LUA startup() function

function startup()
     -- Limit red to 2 snipers
     SetTeamClassLimit( RED_TEAM, CLASS_SNIPER, 2 )

     -- Remove soldiers from blue team
     SetTeamClassLimit( BLUE_TEAM, CLASS_SOLDIER, -1 )
end

Every other class will be allowed an infinite number of players.