Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
How do I generate a random whole number via scripting?
If you want to use js, use the Browser object, or scripting, if you have that feature.
There's also the Advanced Random object if you need more advanced features, seed, noise, etc.
Thank you for the reply. int(random(n)) gave me the same error that everything else that I tried did. That it is not defined.
I wrote this piece of script in the script.js file that is created inside the editor.
What am I doing wrong?
Develop games in your browser. Powerful, performant & highly capable.
Maybe try leaving the int() off.
Thanks for the help.
Math.floor(Math.random() * 100)