Hello all, I don't know if I can ask everyday for help on the forums so if it's not allowed please let me know.
I am currently working on a kill and loot script. Everything is working fine but the only problem is that I cannot find a solution to pickup multiple loot from one NPC. This is the function where Im having trouble with:
========================================================================
public void lootClosestItem(String[] Item_Name,
Area Target_Area) throws InterruptedException{
Player player = myPlayer();
Inventory inven = getInventory();
final Area TARGET_AREA = Target_Area;
Area playerArea = player.getArea(7);
//GroundItem loot = groundItems.closest(l -> l.getName().equals(Item_Name) && playerArea.contains(l));
for(int i = 0; i < Item_Name.length; i++) {
List<GroundItem> loot = groundItems.filter(l -> l.getName().equals(Item_Name[i]) && playerArea.contains(l));
if(!inven.isFull() && TARGET_AREA.contains(player)) {
if (loot != null && loot.exists() &&loot.isVisible()) {
loot.interact("Take");
sleep(random(500,1000));
}
} else getCamera().toEntity(loot);
}
}
========================================================================
It works fine when I make a string variable for one item. But when I made a list of grounditems i did get an error in the condition to check for visibilty and existence. The GetCamera() function doesnt work either.
What am I doing wrong?