Spawn actor with parameters.

Omegas7Omegas7 Member Posts: 37
edited November -1 in Working with GS (Mac)
Let's say I want to spawn actor with a specific task.

How will that actor know that task? Well, I would use an attribute.
I would spawn the actor and at the same time I give it a parameter (attribute) which the actor will use.

Like this:

spawn_actor(parameter here)

The actor spawns, plus a self attribute which value is the parameter given...

I know this sounds confusing...

For instance, some programming languages do that.
Like Ruby, it has methods that can be called with a parameter.

Comments

  • JGary321JGary321 Member Posts: 1,246
    When you spawn an actor, you only pick direction & where. The actor itself contains the parameter for whatever task you want it to accomplish.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Make a game attribute called parameter.

    When you spawn an actor, set that game attribute.

    In your spawnee prototype, have an attribute called myParameter and use Change Attribute to give it the value in the game.parameter.
  • Omegas7Omegas7 Member Posts: 37
    I just want to pass on values, not use the game.parameter thing since... That's what I am doing lol.
    There can be who-knows-how-many amount of these spawned actors...
  • JGary321JGary321 Member Posts: 1,246
    Pass what kind of values? The more detailed/specific you are the more help we can give.

    -JGary
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Well you just need the one game parameter as a temporary storage of the data passed to the spawned actor, as the spawned actor copies that value and keeps it in its own attribute so it knows what to do.
Sign In or Register to comment.