A little help with areas?
I've got a script where it checks if there are any CPU actors in a given area and if there aren't it generates some, but it isn't doing this. I've only been messing around with Lua and CC modding today but I've figured out some of the basics and get the impression I'm just missing something obvious.
Here is what checks for CPU units.
Code:
for actor in MovableMan.Actors do
if actor.Team == Activity.TEAM_2 and self.SpawnZone:IsInside(actor.Pos) then
self.SpawnZone = false;
end
end
I wont post my whole file as its rather lengthy. It starts by setting self.SpawnZone = true. Then it loops through all actors and if there are any in team 2 and who are inside the given area it sets self.SpawnZone = false. If after this self.SpawnZone == true then it creates a new squad of Dummies. If that makes sense.
The console throws up an error on line:
Code:
if actor.Team == Activity.TEAM_2 and self.SpawnZone:IsInside(actor.Pos) then
Quote:
attempt to index field 'SpawnZone'(a nil value)
Can anyone see where I'm going wrong?