View unanswered posts | View active topics It is currently Tue Apr 23, 2024 5:19 pm



Reply to topic  [ 4 posts ] 
 A little help with areas? 
Author Message

Joined: Mon Sep 08, 2008 5:49 am
Posts: 8
Reply with quote
Post 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?


Sat May 16, 2009 2:14 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: A little help with areas?
EDIT:
Oops, misread.


Sat May 16, 2009 5:28 am
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: A little help with areas?
Because I don't have the entirety of your code, I don't know(http://pastebin.com).

But the error is coming from SpawnZone not existing.


Sat May 16, 2009 7:31 am
Profile

Joined: Mon Sep 08, 2008 5:49 am
Posts: 8
Reply with quote
Post Re: A little help with areas?
Cheers Daman it seems the problem was me writing when tired, woke up this morning realising I had two different names for the same area... ah well, it works fine now.


Sat May 16, 2009 9:59 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.045s | 15 Queries | GZIP : Off ]