That code isn't going to work very well, either. The main issue is in how you're using GetPlayerBrain. In missions, it's simply called by self:GetPlayerBrain, because self refers to the activity. Outside of activities, you need to get the activity first, so you call it with ActivityMan:GetActivity():GetPlayerBrain.
Secondly, that function takes a number as an argument, not an actor. The number represents which team to check. You want to check the enemy team, so you have to check first of all which team this actor is on.
Here is some working code:
Code:
function Create(self)
self.scud = CreateAHuman("scud")
-- Do things to self.scud here, like setting Velocity, Position, etc. Can move to function Update(self) if needed.
end
function Update(self)
local enemyTeam = -1;
if self.Team == Activity.TEAM_1 then
enemyTeam = 1;
elseif self.Team == Activity.TEAM_2 then
enemyTeam = 0;
end
if MovableMan:IsActor(ActivityMan:GetActivity():GetPlayerBrain(enemyTeam)) == false then
MovableMan:AddActor(self.scud);
self:GibThis();
end
end
You'll notice the FlashWhite was taken out of there. The reason is that it won't have any effect - you were originally telling it to flash for half a second, but explode immediately after it starts the flash. It won't be visible.