View unanswered posts | View active topics It is currently Fri Nov 01, 2024 12:08 am



Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4
 Detached attachables being deleted 
Author Message
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Detached attachables being deleted
CaveCricket48 wrote:
MaximDude wrote:
Anyway, a thought came in mind.
If the emitters are lua attached, it means the forces they generate do not apply to the ds, am I correct?
If I am, then how would I make those forces get applied?

Forces via Lua!

Alright, i'll check that out.
CaveCricket48 wrote:
Also,
MaximDude wrote:
I did 'ToAEmitter(blah).ToDelte = false'.
No effect.
Must be ini.

It's 'ToAEmitter(blah).ToDelete = false' not
'ToAEmitter(blah).ToDelte = false'.

Bah just a typo in mah post, it's correct in the script.


Sat Jun 26, 2010 6:34 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Detached attachables being deleted
Check to see if the object is gibbing. Also, make sure you're setting "emitterpointer.ToDelete = false" every frame, not just in the Create() function.


Sat Jun 26, 2010 7:24 am
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Detached attachables being deleted
Shouldn't be gibbing with 'GibImpulseLimit' of 9000000000....

Shouldn't be the trigger code either...
Here it is

Code:
   if (self:IsPlayerControlled()) and self:GetController():IsState(Controller.BODY_JUMP) then
      self.Trigger = 1;
   end
   if self.Trigger == 1 then
      local curdist = 220;
      for jetemitter in MovableMan.Particles do
         local avgx = jetemitter.Pos.X - self.Pos.X;
         local avgy = jetemitter.Pos.Y - self.Pos.Y;
         local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
         if dist < curdist then
            if jetemitter.PresetName == "Secondary Engine Emitter Left" or jetemitter.PresetName == "Secondary Engine Emitter Right" then
               if ToAEmitter(jetemitter):IsEmitting() == false then
                  ToAEmitter(jetemitter).ToDelete = false;
                  ToAEmitter(jetemitter):EnableEmission(true);
               end
            end
         end
      end
   elseif self.Trigger == 1 and (self:IsPlayerControlled()) and self:GetController():IsState(Controller.BODY_JUMP) then
      self.Trigger = 0;
   end
   if self.Trigger == 0 then
      local curdist = 220;
      for jetemitter in MovableMan.Particles do
         local avgx = jetemitter.Pos.X - self.Pos.X;
         local avgy = jetemitter.Pos.Y - self.Pos.Y;
         local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
         if dist < curdist then
            if jetemitter.PresetName == "Secondary Engine Emitter Left" or jetemitter.PresetName == "Secondary Engine Emitter Right" then
               if ToAEmitter(jetemitter):IsEmitting() == true then
                  ToAEmitter(jetemitter).ToDelete = false;
                  ToAEmitter(jetemitter):EnableEmission(false);
               end
            end
         end
      end
   end


It's weird because it triggers for about 10ms before completely vanishing...


Sat Jun 26, 2010 8:22 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Detached attachables being deleted
Is that in Update or Create? The ToDelete = false needs to be in the same block as the thruster positioning stuff.

Also, is that script chunk in Update or Create? It should look something like:
Code:
function Create(self)

   for i = 1,MovableMan:GetMOIDCount()-1 do
      self.part = MovableMan:GetMOFromID(i);
      if self.part.PresetName == "Blah da Blah" and self.part.ClassName == "AEmitter" then
         self.firstengine = self.part;
      elseif self.part.PresetName == "Blah da Blah second" and self.part.ClassName == "AEmitter" then
         self.secondengine = self.part;
      end
   end

end

function Update(self)

   if self.firstengine ~= nil and self.firstengine.ID ~= 255 then
      self.firstengine.Pos = self.Pos + Vector(10,4):RadRotate(self.RotAngle)
      self.firstengine.Vel = self.Vel;
      self.firstengine.ToDelete = false; ------------ "ToDelete = false" here
   end

   if self.secondengine ~= nil and self.secondengine.ID ~= 255 then
   --   <blah>
   end

   if self.controlledthingy == UP or whatever then
      if self.firstengine ~= nil and self.firstengine.ID ~= 255 then
         <force application>
      end
      if self.secondengine ~= nil and self.secondengine.ID ~= 255 then
         <force application>
      end
   end

end


Sat Jun 26, 2010 7:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 49 posts ]  Go to page Previous  1, 2, 3, 4

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.030s | 13 Queries | GZIP : Off ]