View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:52 am



Reply to topic  [ 2 posts ] 
 Script loads without error, but does nothing. 
Author Message
User avatar

Joined: Fri Apr 10, 2009 10:22 pm
Posts: 18
Reply with quote
Post Script loads without error, but does nothing.
Code:
function Create(self)
   self.MyGun_Timer = Timer();
   self.PPTargetPosition = Vector (0,0);
   self.PPOverheatTimer = Timer();
   self.WaveEffect = 0;
   self.PPNumberOfAEmitters = 0;
   self.PPFireDistance = 0
end

function Update(self)
      if self.owner:GetController():IsState(Controller.WEAPON_FIRE) then
      local PPTheta = self.owner:GetAimAngle(true);
      self.PPFireDistance = Sceneman:CastObstacleRay(self.pos , Vector(math.cos(PPTheta)*200 , math.sin(PPTheta)*-200) , Vector(0,0) , Vector(0,0) , 0 , 0 , 0);
      if self.PPFireDistance < 0 then
         self.PPFireDistance = 200;
      end
      self.PPNumberOfAEmitters = (self.PPFireDistance/20);
      for i = 1, self.PPNumberOfAEmitters, 1 do
         if i ==1 then
            self.PPEmitter = {CreateAEmitter("MyGun Middle Line Burst")};
         else
            table.insert (self.PPEmitter , CreateAEmitter("MyGun Middle Line Burst"));
         end
         self.WaveEffect = math.random (-4,4);
         self.PPEmitter[i].Pos = (self.pos+Vector(math.cos(PPTheta)*(i*20),math.sin(PPTheta)*-(i*20))+Vector(math.cos(PPTheta)*(self.WaveEffect * -1),math.sin(PPTheta)*-(self.WaveEffect)));
         
      end
      self.PPEndEmitter = {CreateAEmitter("MyGun End Burst")};
      self.PPEndEmitter.pos = (self.pos+Vector(math.cos(PPTheta)*(self.PPFireDistance),math.sin(PPTheta)*-(self.PPFireDistance)));
      for i = 1, (self.PPNumberOfAEmitters - 1), 1 do
         self.PPEmitter[i].RotAngle = (math.tan((self.PPEmitter[i].Pos.Y-self.PPEmitter[(i+1)].Pos.Y)/(self.PPEmitter[i].Pos.X-self.PPEmitter[(i+1)].Pos.X)));
      end
   end
end


Some of the var and AEmitter names were changed. This is a mod contest project, so I guess I can't tell anyone what it is yet.

As said, the script loads no problems, but performs no action when the gun is fired. The script is linked to the HDFirearm, not any MOPixel or Emitter.


Tue Oct 20, 2009 4:41 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Script loads without error, but does nothing.
linking a script to a HDFirearm doesnt work, as it is an attachable. self.owner is not defined at any point. two large problems.


Tue Oct 20, 2009 5:22 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.038s | 13 Queries | GZIP : Off ]