[Solved] Method for: "For each member of group (EXCEPT SELF)"?

MeToo

  • Posts: 338
It's fairly often I need to do that, and I feel like the ways I'm doing it are probably more convoluted than they could be. Does anyone have any good ideas?

« Last Edit: July 14, 2013, 10:02:32 pm by MeToo »

Alexin

  • *
  • Posts: 3130
How are you doing it?

Check if the current member of the group is equal to 'self' and react accordingly.
"Find the fun"
alexin@stencyl.com

MeToo

  • Posts: 338
I have been using a Boolean to apply a temporary immunity to the effect upon self, then the effect happens for all members of the group if they don't have the temporary invulnerability. I've tried a "check if it is self" mechanism but I think I must be using the wrong blocks for it because Stencyl objects to it. Which ones do I use? Where can I find them? Thank you!

Alexin

  • *
  • Posts: 3130
I haven't used Stencyl for quite a while now so I'm not sure, but I guess the (in)equality block should work properly.

Pseudocode:
Code: [Select]
for each member of group
  if member != self
    do stuff
"Find the fun"
alexin@stencyl.com

MeToo

  • Posts: 338
Specifically, which block can I use to represent "self"

MeToo

  • Posts: 338
That's sort of the problem,I'm facing, I'm not aware of a block that I can insert in an IF statement to check IF ______ is self.

froz

  • Posts: 250
It's a block in the Scene>actors part of palette. You can use it also to point to "last created actor", "last collided actor" or an actor attribute.

MeToo

  • Posts: 338

MeToo

  • Posts: 338
I believe I'm running into a problem this way where every member of the group is checking if itself is itself, to which the answer is always yes.


Tuo

  • *
  • Posts: 2469
This should get around that issue.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

MeToo

  • Posts: 338
Thank you for showing me that Tuo. I'm glad to see that one is the one that works. I tried it before, but I have so many complicated behaviors stacked up at this point that I was getting interference that made me think it wasn't working.

It does work when on it's own, I'll just have to hunt around and find what behavior is interfering with it. Great help here guys, and sorry for the slow traction on it!