With this function you can add an instance into any room other than the current one and at any position within that room. The function returns the unique id of the instance which can then be used in further function calls to set properties etc... of that instance, but only once the game has entered the specified room. If you wish to create an instance in the current room you should be using the function instance_create_layer.
room_instance_add(index, x, y, obj);
|index||The index of the room to add an object instance to.|
|x||The x position of the new instance.|
|y||The y position of the new instance.|
|obj||The object to add an instance of.|
global.rm = room_add();
room_instance_add(global.rm, 100, 100, obj_Player);
The above code will add a new room to the game and then copy the contents of the room indexed as "rm_Base" into it. It will then add an instance of the object "obj_player" at the position 100,100 of this new room.