How can I assign a unique ID number to an actor when it is spawned?

rab127rab127 Member, PRO Posts: 47
edited January 2012 in Working with GS (Mac)
Hi all

i am wondering how I can assign a unique Id number to an actor when it is spawned.

I am also wondering how to identify when it is then say hit by another actor.

I am also wondering if an ID system would work when multiple versions of the same monster are on the screen. i am making an rpg test and am trying to figure out the easiest way to spawn monsters made of three actors; animation actor, attack collision mask, and move to player/attack range mask. When the monster is killed I want all three masks to be destroyed. Found self attributes won't let me kill off all the masks.


Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    make a game Index Attribute

    on spawner … just before the spawn
    changeAttribute: game.IndexActor# To: game.IndexActor# +1
    Spawn behavior

    on the actor you are spawning:
    an Index attribute: my#
    the 1st behavior:
    change.Attribute my# To: game.IndexActor#

    then:
    Rule: when
    Attribute: my#=1
    do this and that
    Rule: when
    Attribute: my#=2
    do this and that
    etc.

    and stop the spawning by enclosing the all spawn behaviors in:
    Rule: when
    Attribute: game.IndexActor# ≤ 10

    you can also do with Replicate

    MH
Sign In or Register to comment.