Jump to content
Asharonapaul

trying to reallocate inventory quantities

Recommended Posts

So I am able to draw from inventory to hud. but I want to see how many of a health item is in possession, and subtract from it when the item is used, and restore that value into the list.

 

if obj_input.heal_key {
    var temp = ds_list_find_value(healths[0],0);
    var looky = ds_grid_value_y(database,0,0,6,2,temp);
    var ind =  ds_list_find_index(inventory[0],temp);
    if ds_list_find_value(inventory[1], ind) > 0 {
        var sub = ds_list_find_value(inventory[1],ind);
        sub -= 1;
        ds_list_delete(inventory[1],ind);
        ds_list_add(inventory[1],sub);
        if sub <= 0 ds_list_delete(healths[0],0);
    }
}
 
but it currently does not destroy the healths[0],0 entry when it is used.

Share this post


Link to post
Share on other sites

so the solution was to keep the slots as simpler entries and not arrays. and then storing the top of the list then so on. I even managed to make two other menus that rely on the first one. however something is broken with my inventory selection. I spent all day on it, going to read now. 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×