# (FIXED) Can't set a variable to a random number

When I try to set a variable to a random number (1 or 2), the event that needs the variable to be at 1 and the one that needs it to be at 2 both trigger

At the beginning of the scene

Do = RandomInRange(1, 2) to variable wallgeneration1 of wall

Variable wallgeneration1 of wall is = 1

Create objects from the external layout named terrain1

Variable wallgeneration1 of wall is = 2

Create objects from the external layout named terrain2

use the â€śtrigger onceâ€ť condition.

Doesnâ€™t work, I just tried

Suppose you are an expert in calculators. You know a lot about old and new, simple and scientific calculators, about the electronic components that compose them and about the failures that they can suffer.

Now suppose I have a problem with a calculator and I make a post on a forum that contains the following text and nothing else:

I write 1 + 1 on the calculator and the result is 3. The result should be 2, why is not 3? Please help me.

And you, despite being a calculator expert, canâ€™t tell me right away what the mistake is.

Why canâ€™t you tell me immediately whatâ€™s wrong? What do you need to be able to help me in that situation?

I can already tell that is is going to end up to these 5 â€śrulesâ€ť

1. What you are trying to achieve/what you expect to happen.
2. What actually happens.
3. A screenshot of the specific events in question.
4. Patience. Not everyone is available at all times.

But if not,

Why canâ€™t you tell me immediately whatâ€™s wrong? What do you need to be able to help me in that situation?

not entirely sure

1. Only one triggers (Just read between the lines, you can guess it easily)
2. Two triggers (Said it)
3. Iâ€™ve put in text basically everything that would be in the screenshot
4. Patience, got that
5. Understanding, got that

The text donâ€™t replace the screenshot, or a shared copy of your project in the better of the cases.

Just think about it, without that nobody can magically guess what is happening an help you further.

Same exact thing as the text
At the beginning of the scene

Do = RandomInRange(1, 2) to variable wallgeneration1 of wall

Variable wallgeneration1 of wall is = 1

Create objects from the external layout named terrain1

Variable wallgeneration1 of wall is = 2

Create objects from the external layout named terrain2
And, I said
â€śWhen I try to set a variable to a random number (1 or 2), the event that needs the variable to be at 1 [to work] and the one that needs it to be at 2 [to work] both triggerâ€ť

I give up with this post Iâ€™ll find a way myself

Ok, but thatâ€™s a shame because seeing your events I already had the first suggestion to solve the issue.

Anyways, I was already testing and working on your issue. Here is a working example of the events you are showing:

Random layouts

That means the problem is not in that events but in other section of the eventsâ€¦ thatâ€™s why we need to take a broader look at your events in order to help you.

Oh, well uh, I know I said I give up but, whatâ€™s your suggestions?

In fact, I have more ideas about what may be failing in your project, but I will let other users offer their help.

If the example I made for you (downloadable in the link in the previous comment) helps you, thatâ€™s great, and if not, well, no way.

For the next occasion I suggest you abide by the advice that you yourself quoted. In summary and said in another way:

• Be patient
• To have a good attitude

It is good to cooperate with those who we intend to cooperate with us.

I canâ€™t really open the files since I, uh, donâ€™t have a zip extractor, can you send a screenshot/picture instead?

you should pull the secound and third events as a sub-event of the fitst event. or you should add the â€śbeginning of the sceneâ€ť to all events.

1 Like

There isnâ€™t much going on with walls in other events, and thatâ€™s the only use of the external layouts and that variable, though

Fixed it