YesNoOk
avatar

Double Jump Animation/Custom Jump? (Read 574 times)

Started by Carmell, September 02, 2020, 09:05:24 PM
Share this topic:
Double Jump Animation/Custom Jump?
#1  September 02, 2020, 09:05:24 PM
  • **
    • USA
So I want to have a custom jump animation for anytime the character double jumps and for a second I thought it was going to be easy but then besides not working a bunch of weird things started happening.

I'll try to be as descriptive as possible.

My character uses the same basic jump animation for neutral forward and back and they are all mapped to the standard anims 41-43

So since anim 44 wasnt being used I thought that would be a good anim to map the doublejump to but when I did that something weird happened.

Jump Neutral started just naturally rolling over into anim 44 as soon as the anim hit the last frame. I couldnt find anything in the code telling the jump animation to change from 41 to 44 and if 44 doesnt exist the jump animation works properly. I tried a different animation 45 and then noticed forward jump now naturally rolled over into animation 45 and same if I changed it to 46 with the back jump animation. Still couldnt find anything in the code but I doubt its a coincidence that anims 44-46 lines up with the different jump directions.

I tried googling for similar problems but it seems people were told to just make a custom jump state. I have no idea how to do that though.

All I really want is for airjump neutral back and forward all to go straight to a singular animation.


The code currently looks like this but I have no idea if it's even relevant because all my messing with it didnt seem to affect the animation at all just velocities

; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1
facep2 = 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0

[State 45, 1]
type = ChangeAnim
Trigger1 = SelfAnimExist(44)
value = 44

[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 45, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 45, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)

[State 45, 7]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1
Re: Double Jump Animation/Custom Jump?
#2  September 03, 2020, 04:46:11 AM
  • *
    • Mexico
    • Reptorebanador@gmail.com
hmm, did you skip statedef 50 on purpose?, I'm pretty sure that's where the change to those animations happens, specifically in some part like this

Code:
[State 50, 3]
type = ChangeAnim
triggerall = animtime = 0
triggerall = SelfAnimExist(anim + 3)
trigger1 = anim >= 41 && anim <= 43
value = Anim + 3

you can changgthat value to the anim you want specifically, but I think that might affect the ground jump animation too, should be possible to add some conditions to that one to make sure it happens in the air only, like, I dunno, adding a variable to keep track of your jump or something alng those lines
Re: Double Jump Animation/Custom Jump?
#3  September 05, 2020, 02:01:40 AM
  • *****
  • Shame on you!
    • USA
You might be able to use
Spoiler, click to toggle visibilty
something like that.
You'll have to "space" your animations apart evenly. Anim = 0 will need to change to 40, or whatever your pre-jump animation is. Pretty sure it's 40. It should work automatically if you have your animations set to the right numbers. If you change it to 10,000, then your animations would be 10041, 10042, and 10043.

vVv Mauru Mauru Released vVv
Re: Double Jump Animation/Custom Jump?
#4  September 05, 2020, 10:03:39 AM
  • **
    • USA
Are there hidden states in the .cns? Statedef 50 doesnt seem to exist by my eyes. I dont even see it in Kung Fu Man. Heck I dont even see the movement related statedefs my character has that I posted above in Kung Fu Man or Gombie.

I really doubt POTS gutted the character all those years ago when he coded it. I must be missing something super obvious.
Re: Double Jump Animation/Custom Jump?
#5  September 05, 2020, 11:14:18 AM
  • avatar
  • **
    • USA
Animations 44, 45, and 46 are not unused.  The offending code is in common1.cns.  You will need to override this or use another animation.  As Hiperhazz mentioned.

Spoiler, click to toggle visibilty

State 50,2 sets an animation (41, 42, or 43) based on which direction you are jumping.

State 50,3 tells the character that if he is falling down, and he has a jump animation available that is his current animation +3, and he is specifically now in animations 41, 42, or 43, then he should change to the new animation (current anim +3).  So when you are in animation 41, and you have an animation 44, and you start falling, you change to animation 44.
Re: Double Jump Animation/Custom Jump?
#6  September 05, 2020, 12:28:04 PM
  • *****
  • Shame on you!
    • USA
@Carmell: Your character might be using common.cns, or something similar. If you look in C:/Mugen/Data/  there might be a common file.
You can copy and paste the statedef 50 from it, and paste it into your character. Then edit in the changes.
What ever statedef is in your main character's cns will be the one Mugen uses. So it's an easy way to overwrite things.
Having the Data/Common.cns is an easy way to make all the characters' basic behaviors be the same.
vVv Mauru Mauru Released vVv
Re: Double Jump Animation/Custom Jump?
#7  September 07, 2020, 10:43:17 AM
  • **
    • USA
Okay I think I get it. I see in the .def file that it is in fact using common.cns

As for copying statedef 50 in your example are you saying if the same statedef exists in both files the one in charactername.cns will take priority?

Re: Double Jump Animation/Custom Jump?
#8  September 07, 2020, 10:58:30 AM
  • ****
Exactly. Any state in the character's files will have priority over states in common1.cns.