[SOLVED]1 in 5 chance of a object with certain animation to have a object be created on it

Im making a procedurally generated game where every tile (16x16) has a certain animation to know which color it will be (blue, yellow, green , gray). I’ve already figured out how to make every tile with animation green to have a tree in it but now i need to make it that every green tile has 1 in 5 chance to have a tree created on it. Can anybody help me?

(“Colour” = one of the tiles)

Solution if anyone needs one

Hey, I’m not really sure but can you try using randominrange(1,5) and if the value is 1 grow tree on it?

I already tried that but the object variable is for all tiles and not for individual tiles

The instance variables are for individual instances, but you don’t really need any here.
In your repeat event, if Random(4) = 1, create tree.

1 Like

What conditions do i use? @Gruk

making another variable would solve the problem I guess

What do you mean by a another variable?

There’s a condition “compare two numbers”.