How to set actor values?

goatsoup

  • Posts: 20
In design mode you can "get actor value 'text' for 'Choose Actor'" (and set as well).

Do actor values have to be set in this way (i.e. using design mode or code)?  I would have thought that in the actor editor I would be able to give actors properties.

Have I missed something?  I'm new here.

Hectate

  • *
  • Posts: 4645
You can use the Actor editor to assign values to attributes - but it has to be done via the behaviors that are attached to the actor.

For example, I could create a behavior that manages all my enemies health; Enemy Health. Now, not all enemies have the same health value - how can I use the same behavior for all of them?!

Simple, when I create my "Health Value" number attribute in my Enemy Health behavior, I do NOT mark the attribute as "Hidden". Then, whenever I assign this behavior to my enemies, I have the ability to set that number to whatever I want for that enemy just by looking at the Behavior tab of the Actor Editor and changing the number for that actor type.

One behavior, reused over many actors, very handy.

Additionally, if you use Actor Instance Customization in the Scene Designer, you could even have specific actors with a Health Value that is different from all the other enemies of it's type!
:
:
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.

Epic428

  • Posts: 1118
He isn't talking about non/hidden attributes. More specifically he is talking about Actor Values which are attributes specifically related to the actor instance and accessible by any behavior referencing the actor.

I could see why you would think that Actor Values would be customize-able in the Actor editor, though unfortunately they are not. They are only created with the use of behaviors, using the blocks above.

My conclusion is they are either dynamically generated during run-time (basically placed into an array of some sort), or SW recognizes the use of actor values and creates them in some top level class for the actor during compile time(highly unlikely), I'm leaning more toward the former.

An example of creating an actor value is basically using the block [for [actor] set [actor value] to [value]]  - this block will create the value that you will later check for.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

Joe

  • *
  • Posts: 2480
Welcome to Stencyl, goatsoup!

Hectate, I believe goatsoup is referring to Actor Properties, which are Actor-level (rather than Behavior-level) Attributes.

The answer to your question is, yes, property values need to be set like that using blocks or code. They are created and managed at runtime, not ahead of time like Behavior and Game Attributes.

Let us know if you're still confused.

Edit: ninja'd

Epic428

  • Posts: 1118
lol. Thanks for the confirmation on my theory about how Actor Values are created, Joe.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

goatsoup

  • Posts: 20
Thanks for the replies, I think Hectate's suggestion will solve what I am trying to do.  I'll have to try it over the weekend - at work now  :(