• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Asharonapaul

trying to reallocate inventory quantities

2 posts in this topic

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

  • Recently Browsing   0 members

    No registered users viewing this page.