Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 03-15-2009, 03:46 PM   #1
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
A few more questions.

I need (if possible) a lua function that:
  1. Forces all players to spectator team.
  2. Picks one random spectator, forces him to blue team.

Second, how do I check the player-count for a team?
Last, how do I move a single player to another team?

Thanks in advance.
Bridget is offline   Reply With Quote


Old 03-15-2009, 08:59 PM   #2
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Forces all players to spectator:
Code:
ApplyToAll({ AT.kChangeTeamSpectator })
Forces one random player from spec to blue:
Code:
local c = Collection()

c:GetByFilter( {CF.kPlayers, CF.kTeamSpectator} )

local count = c:Count()
local randomplayer = math.random(1, count)

local player = c:Element( randomplayer )

ApplyToPlayer( player, { AT.kChangeTeamBlue } )
Player count for a team:
Code:
local team = GetTeam( Team.kBlue )

local numplayers = team:GetNumPlayers()
Single player to another team (with respawn):
Code:
ApplyToPlayer( player, { AT.kChangeTeamBlue, AT.kRespawnPlayers } )
Not sure if they are all working.
__________________
#FF.Pickup ยค Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.