Random Loop 0 Author Share Posted February 1, 2018 GroundItem feather = getGroundItems().getClosest("Feather"); should be GroundItem feather = getGroundItems().closest("Feather"); also if (chicken != null) { chicken.interact("Attack"); return 1500; feather.interact("Take"); } the feather.interact("Take"); will never be reached, put it before the return if (chicken != null) { chicken.interact("Attack"); feather.interact("Take"); return 1500; } You're my hero !! I can't believe I'm this dumb hahaha. Now I just need to find a better method for looting instead of just sleeping for 3000, is there a way to check if the enemy I'm attacking is at 0 hp? Link to comment Share on other sites More sharing options...
Tweeboy 14 Share Posted February 1, 2018 You're my hero !! I can't believe I'm this dumb hahaha. Now I just need to find a better method for looting instead of just sleeping for 3000, is there a way to check if the enemy I'm attacking is at 0 hp? Check the API and see if you can find what you need Link to comment Share on other sites More sharing options...
Random Loop 0 Author Share Posted February 1, 2018 Check the API and see if you can find what you need is there a global animation to when npcs die? I could maybe check if that animation is playing, sleep 2-3 seconds and then loot the closest feathers? Not the perfect solution but it'd make sense right? Link to comment Share on other sites More sharing options...
Tweeboy 14 Share Posted February 1, 2018 could try checking for death animation while in combat ye could check for npc.getHealth() <1 many options, try them out and see what works is there a global animation to when npcs die? I could maybe check if that animation is playing, sleep 2-3 seconds and then loot the closest feathers? Not the perfect solution but it'd make sense right? Link to comment Share on other sites More sharing options...
Random Loop 0 Author Share Posted February 2, 2018 After tinkering around a bit (maybe a bit too much) I found out you can't really check if a chicken's health is at 0 or if it's lower than 25% (they have 3 hp so that'd be 0) because (I'm guessing here) when it healths reaches 0, it stops existing and isn't an npc anymore. I'd prolly have to use dying animation, but I have no idea to know how to know what the chicken dying animation is. edit: I think I've found the animation let's test it out now ! Welp animation wasn't working either, I did something which doesn'T make 100% sense but it works even though it's clunky, will try to find something better but I'm happy for now. Link to comment Share on other sites More sharing options...
Tweeboy 14 Share Posted February 2, 2018 After tinkering around a bit (maybe a bit too much) I found out you can't really check if a chicken's health is at 0 or if it's lower than 25% (they have 3 hp so that'd be 0) because (I'm guessing here) when it healths reaches 0, it stops existing and isn't an npc anymore. I'd prolly have to use dying animation, but I have no idea to know how to know what the chicken dying animation is. edit: I think I've found the animation let's test it out now ! Welp animation wasn't working either, I did something which doesn'T make 100% sense but it works even though it's clunky, will try to find something better but I'm happy for now. Try checking until chicken you're attacking doesnt exist? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.