Game level IDs to Spawned Actors?

RocketBrainRocketBrain Member, PRO Posts: 269
Is it possible to assign game level IDs to spawned actors?

Comments

  • RocketBrainRocketBrain Member, PRO Posts: 269
    Basically i'm trying to learn to make a TD game. All i can find template wise is a really old one where you have to create each actor while making the game.

    what i'd like is when i drag in a new actor called "tower", each one has a new ID or name like Tower1, Tower2, Tower3, Tower4...etc.

    or am i going at this all wrong?
  • ericzingelerericzingeler Member Posts: 334
    edited March 2013
    You can create a unique ID in a couple ways:

    Option 1:

    game.NewID (index attribute)

    (In actor that will spawn tower)
    On spawn:
    Change game attribute game.NewID to game.NewID+1
    Spawn Tower

    (In spawned actor)

    myID (index attribute)

    Outside of rules at very top:
    Change myID to game.NewID

    Option 2:

    (In spawned actor)

    myID (real attribute)

    Outside of rules at very top:
    Change myID to game.Time

    Option 2 doesn't require you to manage the ID's as its based on game time, but option 1 may be more useful as you're also creating a running count of towers.
  • RocketBrainRocketBrain Member, PRO Posts: 269
    thanks, gonna play with that.
Sign In or Register to comment.