PlayerOne
Member
Right now I'm creating an upgrade system akin to the Fallout 4 / New Vegas workbench system. Everything is set up but I need to find the first item id of an item that I'm specifically looking for. In this case the item id is a sprite that is used to identify items in my players inventory.
Now I have found a function that identifies if an item exists in the grid.
The problem is that I need the x and y position in that grid for the very first item that I'm looking for. Then I can subtract it when an upgrade meets the requirements for my players equipment.
There is a function that seems to do what I'm looking for:
I tried using it (modified to fit my game of course) but I'm not sure if I'm using it correctly.
Now I have found a function that identifies if an item exists in the grid.
Code:
ds_grid_value_exists(global.player_inv, 0, 0, ds_grid_width(global.player_inv), ds_grid_height(global.player_inv), item);
There is a function that seems to do what I'm looking for:
Code:
//word for word directly from the doc's
if ds_grid_value_disk_exists(grid, 5, 5, 5, val)
{
xpos = ds_grid_value_disk_x(grid, 5, 5, 5, val);
ypos = ds_grid_value_disk_y(grid, 5, 5, 5, val);
}