Data Realms Fan Forums
http://45.55.195.193/

Particle equivalent of: for actor in MovableMan.Actors do
http://45.55.195.193/viewtopic.php?f=73&t=19801
Page 1 of 1

Author:  Petethegoat [ Sat Sep 25, 2010 4:43 pm ]
Post subject:  Particle equivalent of: for actor in MovableMan.Actors do

The subject says it all really.
Something like particle in MovableMan.Particles?

HURP DERP

Author:  Lizardheim [ Sat Sep 25, 2010 4:52 pm ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

Ya we figured it out, it's MovableMan.Particles.
LOL

Author:  Grif [ Mon Sep 27, 2010 12:36 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

Also, just for reference, the 'particle' or 'actor' is entirely inconsequential. It's just defining a reference; it can be whatever the hell you feel like.

Author:  411570N3 [ Mon Sep 27, 2010 1:10 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

One of my friends likes to do his for loops with type of baked food items. 'For Pie In SeriousArray(5) Do'

Author:  FlamingHilt [ Sat Dec 18, 2010 3:14 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

I know I'm necroing this topic a bit, but I figured it was relevant and not worth a new topic anyways.

Since you can call the object anything you want (IE "Pie"), I take it you can only ask for objects from a list?

For example,
for actor in MovableMan.Actors do

Could be written as
for pie in MovableMan.Actors do

Since MovableMan.Actors is a list of actors, correct?

My question then is, how do I get a list of an actor's emitters? I have tried
for AEmitter in actor.AEmitters do

to no avail (throws a nil reference error).

Any help appreciated.

Author:  CaveCricket48 [ Sat Dec 18, 2010 7:13 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

I don't think you can do that.

However, I believe that there is a table that stores emitters, but I'm not sure if emitters on actors can be accessed with this table.

Author:  Grif [ Sat Dec 18, 2010 7:17 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

pairs(Emitters) is an automatically maintained list of all scripted emitters currently on the scene.

However, actor-attached emitters (as in, wounds) are treated as attachables, and are therefore impossible to work with.

Author:  FlamingHilt [ Sat Dec 18, 2010 7:35 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

Yea, I was going through the documentation, and it doesn't look like there is any good way to access attachables.

Thoughts on giving the actor a list of emitters?

I have plenty of Java under my belt and figuring out this Lua madness is both frustrating and exhilarating.

Author:  mail2345 [ Sun Dec 19, 2010 2:09 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

You can get SORT OF access to MO attachables by iterating though the MO index(set i to one, increase it, grab mo, until you hit the number of moids).
This allows you to change scale(scale = 0 makes it invisible), delete(I think), and a handful of other things.

Author:  FlamingHilt [ Tue Dec 21, 2010 1:52 am ]
Post subject:  Re: Particle equivalent of: for actor in MovableMan.Actors do

Well, emitters have an EnableEmission method, so that's no problem. They also have IsAttachedTo, which takes an actor, so that's no problem. The question now is, how do I get to all the emitters?

I hate to ask for actual code but I'm not sure what you mean but iterating through the MO index. I know how to iterate of course, but what am I looking for? Something like this?:

Code:
for i = 1, MovableMan:GetMOIDCount()-1
  if (MovableMan:GetMOFromID(i).IsEmitter()) then
    dostuff
  end
end


As I said in my first paragraph, if I can get to a list of emitters then it's no problem.

Code:
if (emitter.IsAttachedTo(actor)) then
  if (emitter.IsEmitting() == 1) then
    emitter.EnableEmission(0)
  end
end


That is, assuming IsEmitting and EnableEmission return and take indices instead of booleans. It didn't say in the documentation -- anybody know?

Thanks.

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