Data Realms Fan Forums http://45.55.195.193/ |
|
Parent http://45.55.195.193/viewtopic.php?f=73&t=15261 |
Page 1 of 1 |
Author: | Mind [ Mon Jun 08, 2009 9:23 pm ] |
Post subject: | Parent |
My problem: Code: function Create(self) local curdist = 100; local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < curdist then curdist = dist; self.parent = actor; end end function Update(self) for actor in MovableMan.actors do if actor.ID ~= self.parent.ID then <---------- blah blah end end end says trying to index parent on that line, and parent is nil. Any help? Don't worry about the tabbing. |
Author: | Grif [ Mon Jun 08, 2009 9:30 pm ] |
Post subject: | Re: Parent |
for actor in MovableMan.actors do Needs to go after curdist line but before avgx and avgy. |
Author: | mail2345 [ Mon Jun 08, 2009 11:38 pm ] |
Post subject: | Re: Parent |
Along with an end statement. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |