Data Realms Fan Forums
http://forums.datarealms.com/

MOSParticle problems
http://forums.datarealms.com/viewtopic.php?f=1&t=46229
Page 1 of 1

Author:  grave accent [ Thu Dec 14, 2017 3:12 am ]
Post subject:  MOSParticle problems

So, I have this MOSParticle i'm trying to get to work, but I have two issues.

1. it's not animating.

2. -1 LifeTime isn't preventing it from disappearing.

code:
Code:
AddEffect = MOSParticle
   PresetName = Water Surface
   AddToGroup = Water
   Buyable = 1
   GoldValue = 0
   Mass = 0
   GlobalAccScalar = 0
   RestThreshold = -1
   LifeTime = -1
   AirResistance = 0
   Sharpness = 0
   HitsMOs = 0
   GetsHitByMOs = 0
   SpriteFile = ContentFile
      FilePath = GraveWaters.rte/Shared/Wripple.bmp
   FrameCount = 8
   Framerate = 9999
   SpriteOffset = Vector
      X = 0
      Y = 0
   AngularVel = 0
   Atom = Atom
      Material = Material
         CopyOf = Water
      TrailLength = 0


(it's buyable so that I can test it.)

Author:  CaveCricket48 [ Thu Dec 14, 2017 3:28 am ]
Post subject:  Re: MOSParticle problems

I might be misremembering, but I think MOSParticles specifically animate based on how long they last - first frame when they spawn, and they animate through their lifetime, last frame appearing when they die. Your MOSParticle might not be animating because it has an endless LifeTime.

Try putting a script on your particle that's just

Code:
function Update(self)
  self.ToDelete = false;
end


Or have a single script handle multiple particles. Which can also handle animating by manually spawning particles with specific frames at the right time.

Author:  grave accent [ Thu Dec 14, 2017 3:39 am ]
Post subject:  Re: MOSParticle problems

CaveCricket48 wrote:
I might be misremembering, but I think MOSParticles specifically animate based on how long they last - first frame when they spawn, and they animate through their lifetime, last frame appearing when they die. Your MOSParticle might not be animating because it has an endless LifeTime.

Try putting a script on your particle that's just

Code:
function Update(self)
  self.ToDelete = false;
end


Or have a single script handle multiple particles. Which can also handle animating by manually spawning particles with specific frames at the right time.


Well, that's my second problem, -1 lifetime isn't preventing it from death.

Edit: and now i've tried giving it a lifetime, but it still didn't animate.

Author:  CaveCricket48 [ Thu Dec 14, 2017 3:41 am ]
Post subject:  Re: MOSParticle problems

Did you try a script or something

Author:  grave accent [ Thu Dec 14, 2017 3:48 am ]
Post subject:  Re: MOSParticle problems

Well, the script worked, it doesn't delete anymore.

Still can't get it to animate, though.

Author:  CaveCricket48 [ Thu Dec 14, 2017 3:53 am ]
Post subject:  Re: MOSParticle problems

Give the particles a lifetime that's the length you want the animation to be. Give the script a Destroy() block that spawns a particle in its place. That way when it dies, it creates a new particle, and accomplishes animation.

Author:  grave accent [ Thu Dec 14, 2017 3:55 am ]
Post subject:  Re: MOSParticle problems

Well, I gave it a lifetime of 4000 before you gave me the script, and it still didn't animate.

Author:  CaveCricket48 [ Thu Dec 14, 2017 3:57 am ]
Post subject:  Re: MOSParticle problems

Try setting the Framerate to 0

Author:  grave accent [ Thu Dec 14, 2017 4:01 am ]
Post subject:  Re: MOSParticle problems

Well, that appears to have done it. Thanks cave.

Now I just gotta make it respawn, as it currently hangs on the final frame cause of the deletion prevention.

Author:  CaveCricket48 [ Thu Dec 14, 2017 4:13 am ]
Post subject:  Re: MOSParticle problems

Code:
function Create(self)
  self.animTimer = Timer();
end

function Update(self)
  self.ToDelete = false;
  if self.animTimer:IsPastSimMS(4000) then
    self.ToDelete = true;
  end
end

function Destroy(self)
  local water = CreateMOSParticle("Water Surface");
  water.Pos = self.Pos;
  MovableMan:AddParticle(water);
end


or something

Author:  grave accent [ Thu Dec 14, 2017 4:24 am ]
Post subject:  Re: MOSParticle problems

WOO, that did it. Cave, you're a modsaver

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/