JasrielKraftuur
Member
Hello. I am trying to create an inventory system that displays information based off the object you currently have selected. I've gotten the ability to show information to work, but I need to create a variable to set that value to. What I'm trying to do is print out this list of objects, the objects that are in your inventory, when you open your inventory:
this creates all the objects in the inventory, but if I try to set an object to a variable, like this:
it only sets it to the object ID, then seems to continuously add 1 to it even after it leaves the for loop.
I've also tried putting these variables in the create event:
but this sets it to a number that doesn't correlate with the object ID. The value is consistent with the object, i.e. there is a paper you can pick up and it's value is always 39, and a key's value is always 29. I'm not sure where these numbers are coming from though.
But what my goal is is to set the global.itemx variables to an actual object, not the object ID. That way I can call variables defined in the object in your inventory.
This is version 2.3.2.426(I'm getting this from the console, is this a reliable way to find the exact version?)
Hope this makes sense!
Code:
for(var q = 0; q < ds_list_size(global.inventoryObj); q++){
instance_create_depth(0,0,0,global.inventoryObj[|q]);
}
Code:
for(var q = 0; q < ds_list_size(global.inventoryObj); q++){
instance_create_depth(0,0,0,global.inventoryObj[|q]);
//Setting each object a variable
if(q == 0){
global.item1 = global.inventoryObj[|0]
}
if(q == 1){
global.item2 = global.inventoryObj[|1]
}
}
I've also tried putting these variables in the create event:
Code:
global.item1 = global.inventoryObj[|0]
global.item2 = global.inventoryObj[|1]
global.item3 = global.inventoryObj[|2]
global.item4 = global.inventoryObj[|3]
But what my goal is is to set the global.itemx variables to an actual object, not the object ID. That way I can call variables defined in the object in your inventory.
This is version 2.3.2.426(I'm getting this from the console, is this a reliable way to find the exact version?)
Hope this makes sense!