How do I refer to another actor

InFecTioN

  • Posts: 21
Ok, so I want to be able to check if a certain actor is in a region, but I'm only allowed to use Last Created, Last Collided, Attribute, and Self. None of these allow me to specifically single out a certain actor though. I'm sure it's possible through code, um just unaware how. Any tips?

KungFuFurby

  • *
  • Posts: 487
Try For Actor of Each Type (it'll work quite well if you have one actor of a particular type). It's under the "Scene" category. Then, you can get "the actor" of type and do it that way.
Hi, all! I'm KungFuFurby, music composer. If you're looking for some music for your game, just PM me.
My Works List for Non-Stencyl Games
My Works List for Stencyl Games

Hectate

  • *
  • Posts: 4643
Another option would be to create an Actor attribute, and then assign the correct actor to that attribute once the behavior is added to the scene - or for an actor behavior, an actor with that behavior is assigned to the scene and customized.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

InFecTioN

  • Posts: 21
Try For Actor of Each Type (it'll work quite well if you have one actor of a particular type). It's under the "Scene" category. Then, you can get "the actor" of type and do it that way.

Tried that already, it doesn't allow me to check if the actor's within the region though.

Hectate

  • *
  • Posts: 4643
What you're trying to do is assign the specific actor you want to an attribute first. LATER you can then check to see if it's within the region. They're separate tasks.

1. Assign the actor to an attribute.
2. Check if that attribute (type actor) is within the region.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

InFecTioN

  • Posts: 21
I'm well aware of that, that's pretty much my original question, how do I set the attribute to a specific actor when the actor wasn't the last created or last collided?

Greg

  • *
  • Posts: 1259
Use this:

Try For Actor of Each Type (it'll work quite well if you have one actor of a particular type). It's under the "Scene" category. Then, you can get "the actor" of type and do it that way.

And then put your attribute setter block within that - and drag the "the actor" block into it.  Should be in the same place you got the "For each actor of type [ ]" block. 

InFecTioN

  • Posts: 21
thank you! I never realized I could put "the actor" there. It finally works, thank you all for your great help!

dubealex

  • Posts: 26
You could also have created a code block to access the actor ID, which is unique in the scene.

I created a custom block that return the ID of an actor, which you could use in the For Each Actor In Region blocks to store those IDs in a actorCache list (which is an array of actor IDs.)