how to set an actor attribute to a specific actor

Reider12

  • Posts: 12
i'm just starting to get the hang of this program and i like it a lot. there's one thing i've continuously tried to find workarounds for as i cannot figure out how to actually implement it properly. when i create an actor-type attribute, how do i set it to a specific actor, say an actor named "player", if this actor is not the last created actor, the last collided actor, or self?
basically i want the equivalent of this:

_attributename = "player";

i'm sure i'm just missing something obvious. any help is appreciated.

Justin

  • *
  • Posts: 4513
An Actor attribute can only be set from within a scene itself. If you double click on an actor that has a behavior with an actor attribute, you can enable instance customization and set the actor from there.

If you just want the player actor, there's a really handy snippet for that in Design Mode. Just put this in any behavior where you need the actor attribute.


« Last Edit: November 11, 2012, 12:36:56 am by Justin »
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Reider12

  • Posts: 12
oh wow, i didn't know you could replace that drop down box with something like "the actor". thanks for the help.

psypol

  • Posts: 61
Hello

i have a similar problem. i started using stencyl and it looks amazing and promising.

here is what i'm trying to do (the behavior is on the player's avatar actor)


i have a list of gems called "game_gems"
when gems are over the player avatar i want to add them to "game_gems_overplayer"
then i want to change the gem actor animation from its default animation to "Highlighted" animation

i just dont know how i can get rid of that drop down box in my big boolean and in "switch animation to Highlighted for ...."
instead of created/colided/self/attribute i simply want to put "current item"!

no drag&dropping works.

in the previous solution Justin recommends to use "for each actor of type skeleton"
the way i'm trying to do the trick is not valid ? i have to use types (pink rectangle)?

thanks for your help