-
Posts
6 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Male
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Mokrocaan's Achievements
Newbie (1/10)
0
Reputation
-
I need to pick up multiple loot from one NPC.
Mokrocaan replied to Mokrocaan's topic in Scripting Help
Thankyou for actually helping me out! This is great! I'm gonna exercise my Java programming skills more l, I see I have made some dumb mistakes. Thank you again! -
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?
-
After a kill I want to loot first before attacking another monster.
Mokrocaan replied to Mokrocaan's topic in Scripting Help
Thankyou brother! Every bit of information helps- 7 replies
-
- fighter
- scripthelp
-
(and 2 more)
Tagged with:
-
After a kill I want to loot first before attacking another monster.
Mokrocaan replied to Mokrocaan's topic in Scripting Help
@Nbacon Thankyou so much. The only problem im facing right now is that he doesnt loot the NPC I directly killed. It loots other peoples stuff or it loots my previous kill.- 7 replies
-
- fighter
- scripthelp
-
(and 2 more)
Tagged with:
-
After a kill I want to loot first before attacking another monster.
Mokrocaan replied to Mokrocaan's topic in Scripting Help
@Gunman I am going to try this out. Do you mean that I have to store the position of the NPC when he is at 0 healthPercent? Like this: If ( monster.healthPercent() == 0 ) { Position lootTile = monster.getPosition(); }- 7 replies
-
- fighter
- scripthelp
-
(and 2 more)
Tagged with:
-
Mokrocaan changed their profile photo
-
I have read alot of other scripts and examples of how to loot before attacking again. I cannot understand this concept, could somebody explain me how to do this inside of my own code. This is my code for now: =============================================================================================== NPC npc = getNpcs().closest(o -> o.getName().equals("Cow") && o.getInteracting() == null && !o.isUnderAttack()); if (npc != null && npc.getName().equals("Cow") && npc.getHealthPercent() > 0 && npc.isAttackable() && npc.hasAction("Attack") && map.canReach(npc) && !npc.isUnderAttack()) { if (npc.equals(myPlayer().getInteracting())) { } else { npc.interact("Attack"); if (npc.interact("Attack")) { sleep(random(3500,5000)); } } } else { camera.toEntity(npc); npc = npcs.closest("Cow"); } ==================================================================================================
- 7 replies
-
- fighter
- scripthelp
-
(and 2 more)
Tagged with: