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.