Function question
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
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
-
tenrdrmer Posts: 9,934
To get your range you need to set 2 conditions for the rule and make sure it is set to check ALL conditions
greater than or equal to 1 and
Less than or equal to 40
Greater than or equal to 41 and
Less than or equal to 60
Etc….
Answers
Then you can do when reward is greater then or equal to 96 but less then or equal to 100
-do whatever
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?
it should read
if att.reward >=1 + < = 25
spawn actor health+25