Is it possible to add a GUI button into this script, and add a counter to it, that uses the current amount of REPAIRKITS that are currently in the inventory, and make the button invisible until the counter reaches a certain number. And once that number is reached make it visible? I know how to put the button in, i just dont know how to do the rest of that. If it is possible what would be the code that would make it possible? Thanks!
enum InventoryItem{ DEBUG_ITEM, SCREW, NUT, BOSS_TRAY, BOSS_PLOWBLADE, BOSS_WINDBLADE, ENERGYPACK, REPAIRKIT, COUNT_NUM_ITEMS } var PlayerInventory: int[] ; var playerStatus: Player_Status; playerStatus = GetComponent(Player_Status) ; //Item Properties------------------------------------------------------------------------------------------------ private var repairKitHealAmt = 5.0; private var energyPackHealAmt = 10.0; //Initilaize Widget's starting Inventory------------------------------------------------------------------------- function Start(){ PlayerInventory = new int[InventoryItem.COUNT_NUM_ITEMS]; for (var item in PlayerInventory){ PlayerInventory[item] = 0; } //Give Widget some starting items PlayerInventory[InventoryItem.ENERGYPACK] = 0; PlayerInventory[InventoryItem.REPAIRKIT] = 0; } //Inventory Management Functions--------------------------------------------------------------------------------- function GetItem(item: InventoryItem, amount: int){ PlayerInventory[item] += amount; } function UseItem(item: InventoryItem, amount: int){ if(PlayerInventory[item] <= 0) return; PlayerInventory[item] -= amount; switch(item){ case InventoryItem.ENERGYPACK: playerStatus.AddEnergy(energyPackHealAmt); break; case InventoryItem.REPAIRKIT: playerStatus.AddHealth(repairKitHealAmt); break; } } function CompareItemCount(compItem: InventoryItem, compNumber: int){ return PlayerInventory[compItem] >= compNumber; } function GetItemCount(compItem: InventoryItem){ return PlayerInventory[compItem]; } @script AddComponentMenu("Inventory/Widget's Inventory")