saintpaul1 Posted April 22, 2023 Share Posted April 22, 2023 Lets say my player is killing npcs, it kills one but attacks another one adn the loot from the first one drops on the ground, but the loot is off screen because my player has moved because its attacking another npc. My player will only attack other npcs if loot !=null so my player wont do anything unless i turn the screen to see the loot. I have tried to turn the camera to the loot, walk to the loot and nothing, its like it doesnt know it exists but it does know because my player wont attack another npc unless its picked up. Ive tried with and without interaction event, same issue. Thanks in advance if anyone can guide me in the right direction, peace Quote Link to comment Share on other sites More sharing options...
FuryShark Posted April 22, 2023 Share Posted April 22, 2023 (edited) 3 hours ago, saintpaul1 said: Lets say my player is killing npcs, it kills one but attacks another one adn the loot from the first one drops on the ground, but the loot is off screen because my player has moved because its attacking another npc. My player will only attack other npcs if loot !=null so my player wont do anything unless i turn the screen to see the loot. I have tried to turn the camera to the loot, walk to the loot and nothing, its like it doesnt know it exists but it does know because my player wont attack another npc unless its picked up. Ive tried with and without interaction event, same issue. Thanks in advance if anyone can guide me in the right direction, peace getMap().distance(loot) < 18 is what I use to stop it trying to go for things too far away Edited April 22, 2023 by FuryShark Quote Link to comment Share on other sites More sharing options...
saintpaul1 Posted April 22, 2023 Author Share Posted April 22, 2023 (edited) 2 hours ago, FuryShark said: getMap().distance(loot) < 18 is what I use to stop it trying to go for things too far away Mine is set to 12. GroundItem itemToPickUp = main.getGroundItems().closest(groundItem -> dt.itemsToPickUp.contains(groundItem.getName()) && groundItem.getPosition().distance(main.myPosition()) <= 12); This is what im using currently to loot items : InteractionEvent lootingEvent = new InteractionEvent(itemToPickUp, "Take"); lootingEvent.setWalkTo(true); lootingEvent.setOperateCamera(false); lootingEvent.setMaximumAttempts(1); if (main.execute(lootingEvent).hasFinished()) { Util.Sleep.sleepUntil(() -> !itemToPickUp.exists(), 1000);//Interact "Take" on item } Tried lots of different variations though. EDIT: i fixed it i tested the script in a new project and it was somehting else in my code causing the issue , as always :L Thanks for reply. Edited April 22, 2023 by saintpaul1 1 Quote Link to comment Share on other sites More sharing options...