Jump to content

grounditem off screen?


saintpaul1

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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