private function VictorySurvivors takes nothing returns nothing
call CustomVictoryBJ(GetEnumPlayer(), true, true )
endfunction
// Hero dies
private function HeroDies takes nothing returns boolean
local player owningPlayer = GetOwningPlayer(GetDyingUnit())
local mapcontrol playerController = GetPlayerController(owningPlayer)
local integer index = 0
local integer team = -1
local boolean differentTeams = false
if playerController == MAP_CONTROL_USER or playerController == MAP_CONTROL_COMPUTER then
if AllowVictoryDefeat( PLAYER_GAME_RESULT_DEFEAT ) then
call RemovePlayer( owningPlayer, PLAYER_GAME_RESULT_DEFEAT )
call DisplayTimedTextFromPlayer(owningPlayer, 0, 0, 60, GetLocalizedString( "PLAYER_DEFEATED" ) )
// UI only needs to be displayed to users.
if (GetPlayerController(owningPlayer) == MAP_CONTROL_USER) then
call CustomDefeatDialogBJ( owningPlayer, "Defeat!" )
endif
call ForceRemovePlayer(survivingPlayers, owningPlayer)
// Check surviving players
loop
if IsPlayerInForce(Player(index), survivingPlayers) then
if team == -1 then
set team = GetPlayerTeam(Player(index))
else
set differentTeams = GetPlayerTeam(Player(index)) != team
endif
endif
set index = index + 1
exitwhen differentTeams or index == bj_MAX_PLAYER_SLOTS
endloop
if not differentTeams then
call ForForce(survivingPlayers, function VictorySurvivors)
endif
endif
endif
set owningPlayer = null
set playerController = null
return false
endfunction