Error when using for loop

  • Hi everyone,

    I have a simple piece of code which is used to generate 5 unique numbers. The range of these numbers should be between 1 and 12. The problem is that when I generate less than 7 numbers, it will display all 12 unique numbers from 1 to 12. If I generate more than 7 numbers, it works well without any issue. Also, I use the newest Construct 2 version on Windows 7 x64 Home Premium, graphic card is up to date.

    Here is the link to my capx file. Please have a look.

    dl.dropbox.com/u/44238179/Bugs.capx

    Thanks in advance for your help.

    Cheers,

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your for loop is running every tick, you should add a trigger condition to make sure it only runs once. ('On start of layout' or whenever you want it to happen)

  • Hi Nimtrix,

    Thanks for your response. May I have another question: you mean the trigger once event right? In this situation, do I have to have any action inside this trigger?

    Thanks very much.

  • Any condition with a green arrow over the icon is a trigger condition, as well as the 'Trigger once'. (A trigger condition only runs once)

    If you want the loop to run right away use System -> On start of layout

  • I got it. Thanks a lot for your help bro. I did not know that these loop will run on every tick.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)