Data Realms Fan Forums
http://45.55.195.193/

Running a Script That Causes A WIN
http://45.55.195.193/viewtopic.php?f=73&t=30694
Page 1 of 1

Author:  Pantera1993 [ Wed Mar 14, 2012 4:27 am ]
Post subject:  Running a Script That Causes A WIN

So I'm trying to run a script that causes the activity to make you win once the actor it's attached to spawns into the scene out of a dropship/rocket. Right now I've got this...


Code:
function Create(self)
   
   self.winTimer = Timer();
   
end

function Update(self)
   
   if self.winTimer:IsPastSimMS(150) then
      if self.CPUTeam == Activity.NOTEAM then
         if self.playertally == 1 then
            for i = 1, #self.playerlist do
               if self.playerlist[i] == true then
                  self.WinnerTeam = i;
                  ActivityMan:EndActivity();
               end
            end
         end
      else
         if self.playertally == 0 then
            self.WinnerTeam = self.CPUTeam;
            ActivityMan:EndActivity();
         end
      end
   end
end


...attached to a Coalition Light. It's slightly altered from the skirmish defence win/lose conditions code. Right now it doesn't do anything. I was hoping for some guidance in the right direction!

Author:  TheLastBanana [ Wed Mar 14, 2012 5:59 am ]
Post subject:  Re: Running a Script That Causes A WIN

You're not setting self.playertally at any point, so nothing is happening.

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