Data Realms Fan Forums http://45.55.195.193/ |
|
Script loads without error, but does nothing. http://45.55.195.193/viewtopic.php?f=73&t=16900 |
Page 1 of 1 |
Author: | StealthArcher [ Tue Oct 20, 2009 4:41 am ] |
Post subject: | 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. |
Author: | Geti [ Tue Oct 20, 2009 5:22 am ] |
Post subject: | 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. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |