Data Realms Fan Forums
http://45.55.195.193/

CastMORay: attempt to index Ray failed?
http://45.55.195.193/viewtopic.php?f=73&t=29674
Page 1 of 1

Author:  blargiefarg [ Wed Jan 25, 2012 3:05 am ]
Post subject:  CastMORay: attempt to index Ray failed?

Mmk, so I'm making a slightly clunky weapon to try my hand at some of this attachable scripting. I've got almost everything finished, but also being my first attempt at casting a MORay, I seem to have encountered a problem.
Code:
      if not self.Parent.HFlipped then
         self.XVect = Vector(100, 0);
         self.Ray = SceneMan:CastMORay(self.Pos,self.XVect,0,0,true,2);
         if self.Ray:IsOfActor() and self.Ray ~= 255 then --error occurs here
            self.Target = self.Ray:GetRootMOID();
            if self.Target.Team ~= self.Team and self.Ray ~= 255 then
               hit.Pos = self.Target.Pos;
               MovableMan:AddParticle(hit);
            end
         end

This is the problem code. An error occurs at the line with the comment. "Attempt to index field 'Ray''" Any insight?

Author:  Coops [ Wed Jan 25, 2012 3:09 am ]
Post subject:  Re: CastMORay: attempt to index Ray failed?

Code:
MovableMan:IsOfActor(self.Ray)


instead of

Code:
self.Ray:IsOfActor()


Same thing with your

Code:
self.Ray:GetRootMOID()

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/