x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Help with 2D blueprint scripting? (slashing)

Hi! Thanks for your help, I really appreciate it.

Anyways, I'm trying to have it so that my character slashes when a certain key is pressed. So far, it basically works with the exception that it keeps looping. I got the idea of checking what frame the animation is on (I'm using Paper2D), and if it is on the last (5th) frame of the animation, then for it to make a boolean variable false which is always checked when the character is about to slash. Unfortunately, I didn't find such feature or variable included in Blueprint. Does it exist? If not, what would be a good alternative to this?

Edit: I forgot to add, I want the whole slashing mechanic to come to a halt after the last frame or the end of the animation is reached. Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Mar 13 '15 at 03:46 AM in Blueprint Scripting

avatar image

jfaztk
331 46 64 74

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Alright, I pretty much solved it! What I did was I got the number of frames in the animation, and divided it by the framerate, and that value went through a delay that nulled the effects. Thanks!

more ▼

answered Mar 14 '15 at 04:32 AM

avatar image

jfaztk
331 46 64 74

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You got me confused!

Just set the slashing animation as not looping by dragging a wire from that particular animation and typing 'looping' in the box and then right click on it (in the components tab) and choose on end animation. Then you can do whatever you want since you will have the exact moment that the slash animation finishes playing.

Cheers.

more ▼

answered Mar 13 '15 at 10:20 AM

avatar image

Roccinio
576 52 56 77

avatar image jfaztk Mar 13 '15 at 10:54 AM

Hahahaha my bad XD Does this work with Paper2D though? All I'm doing is "Set Flipbook", I don't see anything for looping within there. Thanks for the reply!

avatar image jfaztk Mar 13 '15 at 10:58 AM

Ah, I found it. It somehow works, but not completely. The reason why is because, firstly, if you leave the key pressed it will just stay paused at the last animation, and secondarily, because if I leave the key pressed all the slashing logic (damage, impulse, etc.) is still being applied. I want the whole thing to just stop as soon as the animation's done playing.

Thanks!

avatar image Roccinio Mar 13 '15 at 11:30 AM

Oh boy Oh boy! You will drive me crazy! :p

Do you have set up the 'slashing' key as every frame? If yes that is your problem. It should only fire once. So choose a key and activate it only with "on pressed" That should make it fire once.

Now lets say you want him to go to the idle animation when he finishes the slash animation.

On "s" pressed set animation 'slash'---set no looping---- do whatever you want to do.

On animation slash end------- set animation looping --- set animation"walk"--- play animation from start.

Done!

avatar image jfaztk Mar 13 '15 at 11:37 AM

Well, I'm using input (project settings) for my slash key, and the thing works when you use the "on slashing" node. Maybe that is what you're talking about? I'll verify it when I get home. Aaaah, I get an idea of what you mean. I'll try that out one I get home. Is there any way for it to only detect input once? Like if you press and hold the key, it still only detects it once. I think this is what you were referring to :p

avatar image Roccinio Mar 13 '15 at 12:23 PM

All buttons (joypad or keyboard+ shoulder buttons) detect input only once when you press them and only once when you release them. Axis inputs detect every frame.

avatar image jfaztk Mar 13 '15 at 01:12 PM

Alright, that means that I'm doing it correctly then :p I'll see if I can do what you said when I'm home, ty

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

If you take a look at pretty much any template's jump function, you can see that it does the same thing you want to achieve, play whole animation without loop, not being able to restart the animation while it's still being played, etc. Just look at the jump functions ^^

more ▼

answered Mar 13 '15 at 11:02 AM

avatar image

Lostra01
138 14 19 26

avatar image jfaztk Mar 13 '15 at 11:06 AM

I'm on my phone right now, but I'll check it out when I get home, thanks. But I remember nothing like this in the sidescroller template...

avatar image Lostra01 Mar 13 '15 at 11:46 AM

The template doesn't matter, just take a look at the SideScroller 3D, and use the same method with the nodes for the Paper2D, you'll have to work a little bit with it, to apply the same to the 2D character, but it can be done, and it's surely working :)

avatar image jfaztk Mar 13 '15 at 01:13 PM

But don't 3D animations have many more different nodes that paper2D doesn't have?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question