• Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM question about random pick of room when game starts

EZTALES

Member
hey yall,
quick question about if this is possible in GM1.4 and if it could maybe someone give me an idea how to do it. any help is greatly appreciated!
so what i have is 4 rooms all called:
rm_menu
rm_menu2
rm_menu3
rm_menu4
(btw cant use backgrounds because i need sprites in my rooms.)
what i want is when the game starts up it randomly chooses between 1 of these 4 rooms.
thanks!
 
Create a room before those 4 rooms so it load first.

In the creation code for that room, use the choose () function to pick a room and go to it using room_goto()
 

EZTALES

Member
okay
Create a room before those 4 rooms so it load first.

In the creation code for that room, use the choose () function to pick a room and go to it using room_goto()
okay this does load up but sadly it keeps going to one room everytime i load the game
this is my code, sorry if this is not so good, im still understanding the langauge,
create event:

room_goto (choose(rm_menu,rm_menu1,rm_menu3))
 
Every game I make I make an rmInitialize as the very first room in the project/game. Make objInitialize and put Babia's code into it, put the object in the initialize room and you've got your solution

type

randomize();
room_goto(choose(rm1, rm2, rm3, rm4));
 

EZTALES

Member
Every game I make I make an rmInitialize as the very first room in the project/game. Make objInitialize and put Babia's code into it, put the object in the initialize room and you've got your solution

type

randomize();
room_goto(choose(rm1, rm2, rm3, rm4));
worked! thanks!
 

Danei

Member
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
 

JasonTomLee

Member
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
Note that you can save and set random seeds if you'd like to save or change the 'randomness' of your game
 

EZTALES

Member
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
oh! didnteven know about that! thanks!
 
Top