View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:07 pm



Reply to topic  [ 5 posts ] 
 Kill quota 
Author Message
User avatar

Joined: Thu Jul 08, 2010 10:24 pm
Posts: 185
Location: Big Applesauce
Reply with quote
Post 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.


Wed Dec 29, 2010 5:18 pm
Profile
User avatar

Joined: Tue Dec 21, 2010 4:46 pm
Posts: 13
Reply with quote
Post 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


Last edited by Raseri on Wed Dec 29, 2010 5:49 pm, edited 2 times in total.



Wed Dec 29, 2010 5:22 pm
Profile ICQ
User avatar

Joined: Thu Jul 08, 2010 10:24 pm
Posts: 185
Location: Big Applesauce
Reply with quote
Post Re: Kill quota
So I need to make the two conditions seperate?


Wed Dec 29, 2010 5:34 pm
Profile
User avatar

Joined: Tue Dec 12, 2006 3:10 pm
Posts: 495
Location: Uncertain quantum state
Reply with quote
Post 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.


Wed Dec 29, 2010 5:43 pm
Profile
User avatar

Joined: Thu Jul 08, 2010 10:24 pm
Posts: 185
Location: Big Applesauce
Reply with quote
Post Re: Kill quota
Thanks for the help guys.


Wed Dec 29, 2010 6:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.193s | 13 Queries | GZIP : Off ]