Expression Editor to check value help

johng747johng747 Member Posts: 2
edited November -1 in Working with GS (Mac)
Thanks if anyone can help... In a nut shell... random(1,5)
if what ever rnd value is selected it goes to that rule

Example:
rule 1 would be if x1=10
rule 2 would be if x2=20
rule 3 would be if x3=40
rule 4 would be if x4=50

The CPU will RND select a number for example #1
Now I need x1 to check if its holds the higher value then the other x2,x3,x4 value
if x1 is not the higher value I need the CPU to know this and random select another # until
it is the higher value..

In the example above x4 holds the higher value but I need x1 to know that it is the lower value and to
choose x4..

Hope I explained this ok.. Any ideas? in the expression editor ive tried a few things like

attribue game.x1 > game.x2,x3,x4
then destroy and spawn another object
otherwise
destroy object and spawn this RND generator until its the higher value.

Thank
John

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    think you are going to have to store the random # in an attribute (integer type)

    game.random#1
    game.random#2
    game.random#3
    game.random#4

    where you are using the number or

    Rule
    -changeAttribute game.random# To: random(1,5)

    then your
    Rules when
    game.random#1 is > game.random#2 (or whatever)
    etc.
    --do this
    Otherwise:
    --changeAttribute game.random#1 To: random(1,5)

    ===
    I am not too clear on what you mean with the x1 things... multiply or number?

    if the values are only needed with the Actor... I would put them in the Actor's Attribute pane.

    MH
Sign In or Register to comment.