Re: Yet Another Implementation Issue - now with added crashing
Oh yes, I forgot to mention that you are creating the emitter (and MOPixel) once, and using the same reference multiple times. Another invalid pointer issue...so that error message is what you get when you try to do that.
Using your last pastebin link:
http://pastebin.com/ChyRsiDGHere are the problems:
Line 2: self.targetpaintergood = CreateAEmitter("Target Painter Good"); ------debug relatedLine 5: self.beamparticle = CreateMOPixel("Arcing Energy Particle");Line 64: MovableMan:AddParticle(self.targetpaintergood);Line 77: MovableMan:AddParticle(self.beamparticle);So in short, you can't reuse pointers with Add functions. Which are what Create functions return to you.
About the agetimer thing:
Delete this line: Line 4:
self.Agetimer = Timer();Replace this code: Line 34:
self.Agetimer > self.maxtime == true with this:
self.Age > self.maxtimeReplace this code: Line 49:
self.Agetimer > self.maxtime == false with this:
self.Age < self.maxtimeReplace this code: Line 50:
self.timeleft = self.maxtime / 1000 - self.Agetimer/1000; with this:
self.timeleft = self.maxtime / 1000 - self.Age/1000;(you can't do
self.Agetimer/1000 with timers anyway as far as i know, or any other of those operations)
You don't need to use
== true or
== false with
X < Y because
X < Y itself is (evaluates to) true or false. It might also cause confusion on operator precedence. It's a good idea to use parentheses then.
PhantomAGN wrote:
I do not know what the alternative is for line 27's redundancy.
I meant that you ToActored it twice.
Now at line 21:
self.angle = ToActor(self.parent):GetAimAngle(true); ---- Redundant?I meant to replace line 21 with this:
self.angle = self.parent:GetAimAngle(true);Because you already did this:
Line 19: self.parent = ToActor(actor);Btw, would ValidMO work with held guns instead of IsDevice? Haven't tried, and I have to get some sleep now so I won't try now. But i bet somebody has some code where they do that check. I don't have more time now to tell you how to fix that AddParticle issue. It would help if you explain how you want the logic to work?