A
aristhemage
Guest
Hi all I am making a sandbox game with an inventory with 9 slots, when picking up an item it should look for an empty slot, or a slot where it has the same item.
What it is doing is updating the inventory with the item, and unique items go into the next slot with nothing in it like it should, but when a item type is in the inventory, any other picked up items of the same type just disappear without updating anything.
Variables:
global.inventory = [0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air];
global.idee = when player touches and item, it changes the id (idee because I cant do global.id) to the block, this works.
Here are some code bits to help
Player step
When an item touches the player, this one is a grass block. (Yes, this is bootleg Minecraft, more for me than the public)
the item error timer is because it changes the amount of items you have from 0 to 2 the first time, and then +1 like it should the rest of the time, not the issue I want to talk about though. It should not affect this issue
Any help would be great, ill be in the comments to answer questions
What it is doing is updating the inventory with the item, and unique items go into the next slot with nothing in it like it should, but when a item type is in the inventory, any other picked up items of the same type just disappear without updating anything.
Variables:
global.inventory = [0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air, 0, 0, -1, block_air];
global.idee = when player touches and item, it changes the id (idee because I cant do global.id) to the block, this works.
Here are some code bits to help
Player step
GML:
if place_meeting(x,y,par_item){
while(global.inventory[global.invCheck] != global.idee){
if global.inventory[global.invCheck] = 0 || global.inventory[global.invCheck] = global.idee{
global.inventory[global.invCheck] = global.idee; global.inventory[global.invCheck + 1] += 1;}
else{
global.invCheck += 4
}}
}
if global.invCheck = 36{
global.invCheck = 0;
}
the item error timer is because it changes the amount of items you have from 0 to 2 the first time, and then +1 like it should the rest of the time, not the issue I want to talk about though. It should not affect this issue
GML:
if place_meeting(x,y,obj_player){
global.invCheck = 0;
global.idee = 1
if itemErrorTimer = 0{
instance_destroy();
itemErrorTimer = 1;
}else{
itemErrorTimer--;
}
}