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?