View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:55 am



Reply to topic  [ 10 posts ] 
 Particle equivalent of: for actor in MovableMan.Actors do 
Author Message
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Particle equivalent of: for actor in MovableMan.Actors do
The subject says it all really.
Something like particle in MovableMan.Particles?

HURP DERP


Last edited by Petethegoat on Sat Sep 25, 2010 4:53 pm, edited 1 time in total.



Sat Sep 25, 2010 4:43 pm
Profile WWW
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Particle equivalent of: for actor in MovableMan.Actors do
Ya we figured it out, it's MovableMan.Particles.
LOL


Sat Sep 25, 2010 4:52 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Mon Sep 27, 2010 12:36 am
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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'


Mon Sep 27, 2010 1:10 am
Profile WWW

Joined: Fri Dec 17, 2010 4:17 am
Posts: 5
Reply with quote
Post 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.


Sat Dec 18, 2010 3:14 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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.


Sat Dec 18, 2010 7:13 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Sat Dec 18, 2010 7:17 am
Profile

Joined: Fri Dec 17, 2010 4:17 am
Posts: 5
Reply with quote
Post 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.


Sat Dec 18, 2010 7:35 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post 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.


Sun Dec 19, 2010 2:09 am
Profile

Joined: Fri Dec 17, 2010 4:17 am
Posts: 5
Reply with quote
Post 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.


Tue Dec 21, 2010 1:52 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

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.110s | 14 Queries | GZIP : Off ]