Warcraft III resources & community, 2003–2006 · archived

TeamForce

not rated
Submitted by PepparVariable Change0 downloads
Returns a force which includes all the players belonging to the specified team. Team 0 is the first team.

Example: You have Players 1, 2 and 3 in Team 1 and players 4, 5 and 6 in Team 2

TeamForce(0) returns a force with players 1, 2 and 3
TeamForce(1) returns a force with players 4, 5 and 6

Reminder: Destroy the force if don't intend to keep it. Use DestroyForce or ForceMakeTemporary.

Source

function TeamForce takes integer whichTeam returns force
    local force team = CreateForce()
    local integer i = 0
    loop
        exitwhen i >= bj_MAX_PLAYERS
        if GetPlayerTeam(Player(i)) == whichTeam then
            call ForceAddPlayer(team, Player(i))
        endif
        set i = i + 1
    endloop
    return team
endfunction

Comments

0

No comments.