Function question

CrestwoodCrestwood Member Posts: 80
edited May 2012 in Working with GS (Mac)
If I have a stationary actor, that spawns random actors, how would I go about seyting up a random function.

Example.

Alien Actor
if att. touchcounter=2
chang att. reward=random(1,100)
destroy actor

Now to spawning the reward

if att reward=1 through 40
spawn actor health+25
if att reward=41 through 60
spawn actor health+40
if att reward=61 throuhg 80
spawn actor coin+10
if att reward=81 through 95
spawn actor coin+20
if arr reward=96 though 100
spawn actor coin+50

I know I can't have a function "96 through 100", but I can't seem to find a simple range function.

Does this exist?

Thanks!

Crestwood

Best Answer

Answers

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    In a rule you can hit the plus sign to add a new condition to it. And make sure its set to when all conditions are valid.

    Then you can do when reward is greater then or equal to 96 but less then or equal to 100
    -do whatever
  • CrestwoodCrestwood Member Posts: 80
    I tried the greater than or equal to approach and it still would not work.


    if att.reward >=1 + <=25
    spawn actor health+25



    If i set an exact value

    ex.
    Alien Actor
    if att. touchcounter=2
    chang att. reward=1
    destroy actor

    reward
    if att reward=1
    spawn actor health+25


    this works fine.

    just stumped.

    I have an actor that spawns both the Alien and Health depending on the conditions met, but getting a random reward to spawn when an actor is destroyed.

    since I am using a stationary actor to spawn the aliens, should I have a separate actor spawn the rewards?
  • CrestwoodCrestwood Member Posts: 80
    not sure what this is --->if att.reward >=1 + <=25<br />spawn actor health+25
    it should read

    if att.reward >=1 + < = 25
    spawn actor health+25
Sign In or Register to comment.