Random Actor type spawn

ForteForte Member, PRO Posts: 297
edited November -1 in Working with GS (Mac)
Hello everyone,

Who has a good line of code that will choose between certain actors and spawn them by their own choice?

Cheers, Dragokillz

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    In the spawner actor, create an integer attribute called "randomNumber".

    And a Change Attribute behavior and a Rule, like this:

    Change Attribute: self.randomNumber To: random(1, [total number of actors])

    Rule
    When all conditions are valid:
    self.randomNumber = 1
    -----Spawn Actor: [actor 1]
    otherwise
    -----Rule
    -----When all conditions are valid:
    -----self.randomNumber = 2
    ----------Spawn Actor: [actor 2]
    -----otherwise
    ----------Rule
    ----------When all conditions are valid:
    ----------self.randomNumber = 3
    ---------------Spawn Actor: [actor 3]

    etc., etc...
  • ForteForte Member, PRO Posts: 297
    OK cool thanks firemaplegames! I can always count on you!
Sign In or Register to comment.