Data Realms Fan Forums
http://45.55.195.193/

Kill quota
http://45.55.195.193/viewtopic.php?f=73&t=20958
Page 1 of 1

Author:  Mingebag7 [ Wed Dec 29, 2010 5:18 pm ]
Post subject:  Kill quota

I made this snippet of code for a scene, everything else works but this:
Code:
   if self:GetTeamDeathCount(Activity.TEAM_2) >= 30 then
      self.WinnerTeam = Activity.TEAM_1;
   elseif self:GetTeamDeathCount(Activity.TEAM_1) >= 30 then
      self.WinnerTeam = Activity.TEAM_2;
      ActivityMan:EndActivity();
   end


I just made the number low to test it, but the scene never registers the win/lose condition.

Author:  Raseri [ Wed Dec 29, 2010 5:22 pm ]
Post subject:  Re: Kill quota

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

Author:  Mingebag7 [ Wed Dec 29, 2010 5:34 pm ]
Post subject:  Re: Kill quota

So I need to make the two conditions seperate?

Author:  findude [ Wed Dec 29, 2010 5:43 pm ]
Post subject:  Re: Kill quota

Mingebag7 wrote:
Code:
   if self:GetTeamDeathCount(Activity.TEAM_2) >= 30 then
      self.WinnerTeam = Activity.TEAM_1;
   elseif self:GetTeamDeathCount(Activity.TEAM_1) >= 30 then
      self.WinnerTeam = Activity.TEAM_2;
      ActivityMan:EndActivity();
   end


In english;

If team2 has 30 or more deaths, make team1 winner.
If this is not the case and team1 has 30 or more deaths, make team2 the winner and end the mission.

Yeah, the activity isnt ended if team1 wins.

Author:  Mingebag7 [ Wed Dec 29, 2010 6:50 pm ]
Post subject:  Re: Kill quota

Thanks for the help guys.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/