Data Realms Fan Forums
http://45.55.195.193/

Adding an object as a gib with lua.
http://45.55.195.193/viewtopic.php?f=73&t=16789
Page 1 of 1

Author:  CrazyMLC [ Mon Oct 12, 2009 8:12 am ]
Post subject:  Adding an object as a gib with lua.

How do you or can you do that?

Author:  piipu [ Mon Oct 12, 2009 1:36 pm ]
Post subject:  Re: Adding an object as a gib with lua.

Code:
function Destroy(self)
  local particle = CreateMOSRotating("blah")
  particle.Pos = self.Pos
  particle.Vel = self.Vel
  MovableMan:AddParticle(particle)
end
Though this happens also upon settling and Lifetime running out.

Author:  CrazyMLC [ Tue Oct 13, 2009 2:53 am ]
Post subject:  Re: Adding an object as a gib with lua.

Can you do this?
Code:
function Update(self)
  self.somevariable = whatever
end

function Destroy(self)
  local particle = CreateMOSRotating("self.somevariable blah")
  particle.Pos = self.Pos
  particle.Vel = self.Vel
  MovableMan:AddParticle(particle)
end

Or would it be (self.somevariable "blah")?

Author:  TheLastBanana [ Tue Oct 13, 2009 3:00 am ]
Post subject:  Re: Adding an object as a gib with lua.

It would be:
Code:
self.somevariable .. "blah"

The ".." operator is a concatenation operator, otherwise known as "put that onto the end of this".

Author:  CrazyMLC [ Tue Oct 13, 2009 3:07 am ]
Post subject:  Re: Adding an object as a gib with lua.

So the preset would be "blah whatever" if (self.somevariable .. "blah") in that case, right?

Author:  Duh102 [ Tue Oct 13, 2009 3:08 am ]
Post subject:  Re: Adding an object as a gib with lua.

It's like addition. Whatever is to the left of the concat operator is what the part on the right is added to,
"Bleh" .. "Blah" = "BlehBlah"

Author:  CrazyMLC [ Tue Oct 13, 2009 3:14 am ]
Post subject:  Re: Adding an object as a gib with lua.

Ooooh, I see. Thats very useful.

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