Trivial Posted March 24, 2015 Share Posted March 24, 2015 Having a problem with box trap animations. From what I experienced the box trap id changes during the animation of something getting in it or trying to. However even when I check for every single box trap id the script still sometimes acts like there wasnt anything on that tile. Heres the code that checks for it: Entity trapsSpot1 = objects.closest(spotArea[0], new int[]{NORMAL_ID, BROKEN_ID, SHAKING_ID, FAILING, SUCCESS}); //failing and success = the ID's of the animating traps if(trapsSpot1 == null){ return State.TRAP1; } Is there any way to fix this, as in to check if a certain area contains any entities at all? Quote Link to comment Share on other sites More sharing options...
Gilgad Posted March 24, 2015 Share Posted March 24, 2015 Filter out the objects on the tile. Quote Link to comment Share on other sites More sharing options...
Twin Posted March 24, 2015 Share Posted March 24, 2015 (edited) On mobile didn't see full code Never mind me. Edited March 24, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted March 24, 2015 Share Posted March 24, 2015 (edited) Can't you just check the Boxtrap on the ground by its name? Is way more reliable since this will probably break every thursday bcs jagex update... Afterwards check if it has the required action to determine what state it is in? Khaleesi Edited March 24, 2015 by Khaleesi Quote Link to comment Share on other sites More sharing options...
Trivial Posted March 24, 2015 Author Share Posted March 24, 2015 (edited) Can't you just check the Boxtrap on the ground by its name? Is way more reliable since this will probably break every thursday bcs jagex update... Afterwards check if it has the required action to determine what state it is in? Khaleesi Filter out the objects on the tile. I switched from using id's to names, which should fix the problem with the animation because the name of the animating trap is box trap aswell. But now Im using a filter to declare whats a broken trap, but it tries to go for a trap thats out of the area I checked for even after the check. RS2Object brokenTrap = objects.closest(new Filter<RS2Object>(){ @Override public boolean match(RS2Object o){ return o != null && o.getName().equals("Box trap") && o.getActions().equals("Dismantle"); }}); if(brokenTrap != null){ if(huntingArea.contains(brokenTrap)){ return State.DISMANTLE; } } Edited March 24, 2015 by Damighty Quote Link to comment Share on other sites More sharing options...
Trivial Posted March 24, 2015 Author Share Posted March 24, 2015 Fixed the problem I mentioned above, heres the final solution: RS2Object brokenTrapFilter = getObjects().closest(new Filter<RS2Object>(){ @Override public boolean match(RS2Object o) { return o != null && huntingArea.contains(o) && o.getName().equals("Box trap") && o.hasAction("Dismantle") && !o.hasAction("Investigate"); } }); + using names instead of ID's Thanks a lot to both of you for the help Quote Link to comment Share on other sites More sharing options...