Jump to content

grounditem off screen?


Recommended Posts

Posted

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 :)

Posted (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 by FuryShark
Posted (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 by saintpaul1
  • Boge 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...