Jump to content

[Help] Sleeping With No Animation


WhoKnew

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");
}
  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...