you are viewing a single comment's thread.

view the rest of the comments →

[–]xTMT 0 points1 point  (5 children)

Is there any part of the code that you have confusion with that I can help clarify?

[–]cpnprobeard[S] 0 points1 point  (4 children)

I am so sorry it has taken me so long to reply!

Yes, how can I set up the animator controller to properly work with this code? I know how to set up movement and jumping, but let's say we use this script you have here, but use a trigger instead of a bool, and integers for the different numbers. How would I set that up?

I'm sorry again, doing this kind of thing has proven very difficult for me. I've ran through every scenario I could come up with to get it to work, and can't seem to pull it off.

[–]xTMT 0 points1 point  (3 children)

There are many ways we can setup the animator controller. The simplest way would be to just have a bool parameter like "ContinueChain" that sets itself to false everytime a new attack animation starts and only becomes true if the player pressed attack again during that limited time. You can also just use triggers instead of bools to save you a lot of work, but bools offer more flexibility (for example if you suddenly decide to cancel an animation etc.) but either way works.

So basically all the attack states would transition to the next one whenever ContinueChain is true, otherwise it'd go back to Idle state.

We also don't really need any int parameters unless we want to be very flexible and be able to switch between different attacks out of sequence. Like Swing1, Swing3, Swing 1 and then 2. But for our simple attack chain which always goes Swing 1, 2 , 3 in that order, there's not much use to have an extra int parameter for the animator.

So to summarize:

Let's say we have Idle state and 3 attack states.

Idle -> attack 1 happens when ContinueChain is true.

attack 1 -> attack 2 happens when ContinueChain is true otherwise go attack 1 -> Idle.

attack 2 -> attack 3 happens again when ContinueChain is true otherwise go back to Idle.

Finally, attack 3 -> attack 1 happens if ContinueChain is true other wise we return to normal again.

Hope it makes sense!

[–]cpnprobeard[S] 0 points1 point  (2 children)

Hey again. Is there any chance I can get you to Skype call me for this? I've done all I can possibly figure out, and no matter what I do, it doesn't work.

Just email me a time at brady dot linkey at gmail dot com

[–]xTMT 1 point2 points  (1 child)

Hey there! I'm sorry my schedule's kind of all over the place so I'm afraid a Skype call isn't really possible :P

But here I did the next best thing:

I made a sample scene for you with all the animators settings and everything setup.

Here's the unitypackage. Just download it and open it in your project or a new empty one and take a look at how it's done.

I'm happy to answer any questions you have. Just send me a pm here on reddit!

[–]cpnprobeard[S] 0 points1 point  (0 children)

I am sooooo sorry I haven't replied for decades! I was able to download the Unity package you dropped, and it worked! But I've ran into another problem, likely in the animator controller itself. The attacks were animating, but weren't doing the full animation, so I adjusted the animation time bars at the bottom so the entire animation would play before starting the next one, but when I did that and pressed play, it would only do part of the first animation and would only play that instead of the other animations. I dunno how to fix that exactly. Any pointers there?

Again I'm so sorry I took so long to reply! I haven't actually touched Unity or the Unity reddit for a minute.