View unanswered posts | View active topics It is currently Thu Apr 18, 2024 3:26 pm



Reply to topic  [ 3 posts ] 
 Finicky scripts and errors? 
Author Message
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post 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? :???:


Mon Aug 20, 2012 9:37 pm
Profile YIM
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Finicky scripts and errors?
Arcalane wrote:
Code:
self.Vel = self.Vel.Normalized*self.Velocity;

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


Mon Aug 20, 2012 9:45 pm
Profile WWW
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post 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.


Tue Aug 21, 2012 12:50 am
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.048s | 15 Queries | GZIP : Off ]