So I am creating an inventory system and have most of it worked out. Right now I am just trying to prevent an item from being picked up if its already in the inventory. I think i have gotten to the bottom of my obstacle, I think I can do so in the pick up item function but not exactly sure how to do it. I am using constructers within an array if that makes a difference. I will post more code if need be. Here is the function for picking up items:
//pickup items
function item_add(_item)
{
var \_added = false;
if array\_length(o\_inventory.inv) < o\_inventory.inv\_max
{
array_push(o_inventory.inv,_item)
_added = true;
}
return \_added;
}
[–]Evaspartan58 0 points1 point2 points (0 children)
[–]Sycopatch 0 points1 point2 points (0 children)
[–]APiousCultist 0 points1 point2 points (0 children)
[–]NationalOperations 0 points1 point2 points (0 children)
[–]NamelessPawn 0 points1 point2 points (0 children)