Code:
if self:GetTeamDeathCount(Activity.TEAM_2) > 29 then
self.WinnerTeam = Activity.TEAM_1;
ActivityMan:EndActivity();
end
if self:GetTeamDeathCount(Activity.TEAM_1) > 29 then
self.WinnerTeam = Activity.TEAM_2;
ActivityMan:EndActivity();
end
Another way.
You can create a counter, which will increase if spawn troops.
Example:
Code:
-- enemy landing
if self.TimerRA:IsPastSimMS(20000) then
local ship = CreateACRocket("Drop Crate","Dummy.rte");
ship:SetControllerMode(Controller.CIM_AI, -1);
ship.Team = 1;
ship.Pos = Vector(500, -20);
local soldier = CreateAHuman("Robot 1","Base.rte");
soldier:AddInventoryItem(CreateHDFirearm("Pistol","Coalition.rte"));
soldier.Team = 1;
soldier.AIMode = Actor.AIMODE_BRAINHUNT;
ship:AddInventoryItem(soldier);
MovableMan:AddActor(ship);
self.TimerRA:Reset();
self.Counter = self.Counter + 1;
end
Now check how many soldiers alive (and how many died):
Code:
local actor;
self.EnSoldAlive = 0;
for actor in MovableMan.Actors do
if (actor.Team = Activity.TEAM_2) and (actor:IsInGroup("Actors")) then
self.EnSoldAlive = self.EnSoldAlive + 1;
end
end
if (self.Counter - self.EnSoldAlive) > 29 then
self.WinnerTeam = Activity.TEAM_1;
ActivityMan:EndActivity();
end