eleax Posted February 28, 2015 Share Posted February 28, 2015 I have a simple hunter script I'm working on which works for 1 trap, but I dont know how to make it work for multiple traps. This is due to the fact that I use : Entity ready = objects.closest(9345); as a means of detecting my traps. objects.closest only works on one object so I need to find a way to deal with multiple. Thanks Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted February 28, 2015 Share Posted February 28, 2015 I have never had a need to do this, but you can just store one: Entity ready = objects.closest(9345); Entity second = objects.closest(new Filter blah blah in this filter return false if the object.equals(ready)); Quote Link to comment Share on other sites More sharing options...
eleax Posted February 28, 2015 Author Share Posted February 28, 2015 I have never had a need to do this, but you can just store one: Entity ready = objects.closest(9345); Entity second = objects.closest(new Filter blah blah in this filter return false if the object.equals(ready)); but if it returns false when the closest object is ready, would it pick up the closest object after ready ,or would it just be null basically? Quote Link to comment Share on other sites More sharing options...
Joseph Posted February 28, 2015 Share Posted February 28, 2015 but if it returns false when the closest object is ready, would it pick up the closest object after ready ,or would it just be null basically? it will ignore the ready enitty and look for whatever fits the best filter. Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted February 28, 2015 Share Posted February 28, 2015 but if it returns false when the closest object is ready, would it pick up the closest object after ready ,or would it just be null basically? Are you trying to check if a trap fell? If so you only need to store one fallen trap. If you have a loop going, and you are constantly checking for a closest object (the fallen trap), say you have 2 fallen traps, it will store the first one, then you can operate on it, i.e. pick it up and reset it. Then the loop goes again checking for another fallen trap, you just set one, so there is one left on the ground, it will then store that one, you put it back up, and move on. You just need to check for one fallen trap. If you store multiple fallen traps you will over complicate your script unnecessarily. You cant operate on more than 1 fallen trap at a time anyway. Quote Link to comment Share on other sites More sharing options...
eleax Posted February 28, 2015 Author Share Posted February 28, 2015 alright i tried the filter and it works thanks a lot friends. also if you are using object entities and you are in a place where there a shit ton of objects(like the jungle) will all these objects mess up the bot trying to find a specific object? Quote Link to comment Share on other sites More sharing options...
Twin Posted March 1, 2015 Share Posted March 1, 2015 alright i tried the filter and it works thanks a lot friends. also if you are using object entities and you are in a place where there a shit ton of objects(like the jungle) will all these objects mess up the bot trying to find a specific object? If i'm reading this correctly, no it shouldn't objects.closest("whatever string" or whatever id) you have in here will only be looked for, not anything else. Quote Link to comment Share on other sites More sharing options...