GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: Script Submission » Copy mp_grid » 2019-08-08 08:10:08

Thanks for the welcome!
The size of the grid "from the room size" did not come out intentionally for me - this was relevant only for my situation (now I understand that it was worth passing the dimensions of the grid to the function from the outside, and not expect everyone to have the same room size).
Using it, I came to the conclusion that it is not optimized enough - its execution for large mp_grids (the size of a room) takes too long.
Therefore, today I would recommend using it only for small grids.
I took a different path: I entered the coordinates information into the ds_list, and then created a filled cell in these coordinates (in mp_grid). All this turned out to be not universal, so I do not send another function.
Thanks for your site!

#2 Script Submission » Copy mp_grid » 2019-08-07 05:41:11

Kosta
Replies: 2

There is a function for copying a regular grid, but it is not suitable for mp_grid.

Expand///@function mp_grid_copy(id,source);
///@description Copies one mp_grid to another mp_grid
///@param {real}	id object_index
///@param {real}	source object_index
{
var my_mp_grid_id=argument[0];
var other_mp_grid_id=argument[1];
mp_grid_clear_all(my_mp_grid_id);
for (var ix = 0; ix <= room_width; ix++;)
    {
	for (var iy = 0; iy <= room_height; iy++;)
		{
		if mp_grid_get_cell(other_mp_grid_id, ix , iy)=-1 mp_grid_add_cell(my_mp_grid_id, ix , iy);
		}
	}
}

Board footer

Powered by FluxBB