Data Realms Fan Forums
http://45.55.195.193/

Finicky scripts and errors?
http://45.55.195.193/viewtopic.php?f=73&t=31607
Page 1 of 1

Author:  Arcalane [ Mon Aug 20, 2012 9:37 pm ]
Post subject:  Finicky scripts and errors?

I am having some weirdness with a script. More specifically, a script I know normally works, but is throwing up errors all of a sudden;

Code:
function Create(self)
   self.ExplosiveName = "EXPLOSIVENAME"; --the name of the AEmitter used for the explosion effect
   self.acc = 0; --the relative acceleration of the bolt per second
   
   self.Vel = self.Vel.Normalized*self.Velocity;     
end

function Update(self)
   self.Vel = self.Vel.Normalized*(self.Vel.Magnitude*(1+(self.acc*TimerMan.DeltaTimeSecs)));
   local ray = SceneMan:CastMORay(self.Pos , self.Vel*1*TimerMan.DeltaTimeSecs*FrameMan.PPM , self.ID ,self.Team, 0, false , 0);
   if ray ~= 255 or self.Vel.Magnitude < 6 or self.ToDelete == true then
         local ray2 = SceneMan:CastObstacleRay(self.Pos , self.Vel*1*TimerMan.DeltaTimeSecs*FrameMan.PPM, Vector() , Vector() , 255 , 0 , 0 , 0);
      local lr = CreateAEmitter(self.ExplosiveName);
          lr.Pos = self.Pos;
         lr.Vel = self.Vel;
         lr.Team = self.Team;
         lr.IgnoresTeamHits = true;
         MovableMan:AddMO(lr);
      self.ToDelete = true;
   end
end


Ignoring the generic EXPLOSIVENAME, the problem is thus; the script spams the following error into console;

Code:
ERROR: no overload of  'Vector:__mul' matched the arguments (Vector, nil)
candidates are:
Vector:__mul(lua_State*, const Vector&, custom [float])


I have a two essentially identical scripts that I know work without causing errors, but if I try modifying them (simply changing the EXPLOSIVENAME and CreateAEmitter/CreateMOSRotating accordingly), they cause the above error.

Anyone have any idea which line might be causing this? :???:

Author:  TheLastBanana [ Mon Aug 20, 2012 9:45 pm ]
Post subject:  Re: Finicky scripts and errors?

Arcalane wrote:
Code:
self.Vel = self.Vel.Normalized*self.Velocity;

self.Velocity doesn't seem to be defined anywhere.

Author:  Arcalane [ Tue Aug 21, 2012 12:50 am ]
Post subject:  Re: Finicky scripts and errors?

Ugh, I figured it'd read it off the bullets (since setting it in the Create defines the shot speed... :???: ) instead of needing it to be defined. :roll:

Switched to a simpler system, anyway. Less of a headache in the end.

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