WhoKnew Posted January 10, 2017 Share Posted January 10, 2017 Title pretty much says it all. Character needs to sleep, when combining items. Character doesn't do an animation. Some sort of inventory listener? Quote Link to comment Share on other sites More sharing options...
Solution Posted January 10, 2017 Share Posted January 10, 2017 Take a look at this. You can use that to sleep while a certain condition is met - which in your case would be while the player in animating. Quote Link to comment Share on other sites More sharing options...
Vilius Posted January 10, 2017 Share Posted January 10, 2017 Take a look at this. You can use that to sleep while a certain condition is met - which in your case would be while the player in animating.Smh solution pls. What he is doing is combining items which doesnt give an animation, what he needs to do is wait till the inventory only contains say potatoes instead of onions and potatoes. Quote Link to comment Share on other sites More sharing options...
Solution Posted January 10, 2017 Share Posted January 10, 2017 Smh solution pls. What he is doing is combining items which doesnt give an animation, what he needs to do is wait till the inventory only contains say potatoes instead of onions and potatoes. Making potions has an animation does it not? I'm sure there's other examples :P Quote Link to comment Share on other sites More sharing options...
Vilius Posted January 10, 2017 Share Posted January 10, 2017 Making potions has an animation does it not? I'm sure there's other examples :PBut he certainly asked for sleeping with no animation, he could be grinding chocolste bars for what I know which has no animation 2 Quote Link to comment Share on other sites More sharing options...
Abuse Posted January 10, 2017 Share Posted January 10, 2017 What I would do is remember which two inventory slots I'm interacting with, do the desired action and sleep until one of the inventory slots is empty or contains a different item using ConditionalSleep Quote Link to comment Share on other sites More sharing options...
Team Cape Posted January 10, 2017 Share Posted January 10, 2017 What I would do is remember which two inventory slots I'm interacting with, do the desired action and sleep until one of the inventory slots is empty or contains a different item using ConditionalSleep You'll have an issue with that if you use the 'Make all' option. Here's what to do: Every time the inventory decreases by 1 in amount of whatever resource you're using, record the time using System.currentTimeMillis(). Then, when you go back in the loop, check if your inventory resource count has decreased by 1 again. If it has, change the time to System.currentTimeMillis() again. Then create a check to see if it has not changed in the past ~ 5 seconds. If it hasn't, then you know you've stopped making it for whatever reason. You could do this in a conditionalsleep or in the regular loop cycle if you want - it's your choice. That's your first option. Your second option (less stable but easier to make) would be to check if the interaction with both item returned 'true' and if it did, then conditional sleep until your inventory doesn't contain one of them anymore OR dialogues/random events, and if either condition is met, stop sleeping. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 10, 2017 Share Posted January 10, 2017 Title pretty much says it all. Character needs to sleep, when combining items. Character doesn't do an animation. Some sort of inventory listener? Easiest solution is just to sleep until either your player can no longer combine items, or (if applicable, your character has leveled up): new ConditionalSleep(60_000) { @ Override public boolean condition() { return !canCombine() || getDialogues().isPendingContinuation(); } }.sleep(); Where canCombine() would be something like: public boolean canCombine() { return getInventory().contains("Item 1") && getInventory().contains("Item 2"); } 1 Quote Link to comment Share on other sites More sharing options...
Abuse Posted January 10, 2017 Share Posted January 10, 2017 You'll have an issue with that if you use the 'Make all' option. Here's what to do: Every time the inventory decreases by 1 in amount of whatever resource you're using, record the time using System.currentTimeMillis(). Then, when you go back in the loop, check if your inventory resource count has decreased by 1 again. If it has, change the time to System.currentTimeMillis() again. Then create a check to see if it has not changed in the past ~ 5 seconds. If it hasn't, then you know you've stopped making it for whatever reason. You could do this in a conditionalsleep or in the regular loop cycle if you want - it's your choice. That's your first option. Your second option (less stable but easier to make) would be to check if the interaction with both item returned 'true' and if it did, then conditional sleep until your inventory doesn't contain one of them anymore OR dialogues/random events, and if either condition is met, stop sleeping. I don't recall anything ingame that has a make x option that doesn't have an animation. But yes, your solution + explv's combined together is the proper solution Quote Link to comment Share on other sites More sharing options...