Data Realms Fan Forums
http://forums.datarealms.com/

Killing all enemy actors when their brain dies + Music woes
http://forums.datarealms.com/viewtopic.php?f=73&t=25633
Page 1 of 1

Author:  Squeegy Mackpy [ Sat Sep 24, 2011 4:17 am ]
Post subject:  Killing all enemy actors when their brain dies + Music woes

I feel im making a really simple mistake here. Below is the game over code copied from the dummy assault mission with a few bits added to it.

Code:
   -- Game over, show the appropriate messages until a certain time
   elseif not self.GameOverTimer:IsPastSimMS(self.GameOverPeriod) then
      for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
         if self:PlayerActive(player) and self:PlayerHuman(player) then
            local team = self:GetTeamOfPlayer(player)
            -- TODO: make more appropriate messages here for run out of funds endings
            if team == self.WinnerTeam then
               FrameMan:SetScreenText("Congratulations, you've destroyed the computer and ended the virus!", player, 0, -1, false)
////////////////////////////////////////////
               for actor in MovableMan.AddedActors do      --Make all the robots die.
                  if actor.Team == 1 then
                     actor.Health = 0
                  end
               end
               AudioMan:PlayMusic("RETARDS.rte/Victory.ogg", 0, -1);
////////////////////////////////////////////
            else
               FrameMan:SetScreenText("Your brain has been lost!", player, 0, -1, false)
            end
         end
      end
   end


The loop ive added works when it's put out in the open inside either the update or start function, but while its where it is the conditions for killing don't seem to be satisfied. Is this because team values are changed to stop the actors killing each other?

Another minor issue:
The music does play, but only after a 5 second delay. Should I be doing something else with Audioman?

Author:  weegee [ Thu Sep 29, 2011 11:12 am ]
Post subject:  Re: Killing all enemy actors when their brain dies + Music woes

I think you should search in MovableMan.Actors.

Author:  Squeegy Mackpy [ Thu Sep 29, 2011 5:45 pm ]
Post subject:  Re: Killing all enemy actors when their brain dies + Music woes

Yep, that works. None of the original enemy actors are left in the game by that point.

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