YesNoOk
avatar

Need help for Triple Air Dash (Read 337 times)

Started by Jecht Marchrius, March 18, 2019, 04:11:09 am
Share this topic:
Need help for Triple Air Dash
#1  March 18, 2019, 04:11:09 am
  • avatar
  • *
    • Philippines
Hey guys! I need some help in coding a Triple Air Dash move for my character. My character can triple jump and I want my character to do "only" a "MAXIMUM" of 3 air dashes per jump. The 3 air dashes is in any combination; all forward dashes, all backdashes or mixed dashes. My current air dash code below gives my character UNLIMITED air dashes.

Code:
;===========================================================================
;Air Dash
[State -1, Air Dash]
type = ChangeState
value = 110
trigger1 = statetype = A
trigger1 = command = "FF"
trigger1 = ctrl
trigger1 = stateno != 110
trigger1 = stateno != 115

;===========================================================================
;Air Back Dash
[State -1, Air Back Dash]
type = ChangeState
value = 115
trigger1 = statetype = A
trigger1 = command = "BB"
trigger1 = ctrl
trigger1 = stateno != 110
trigger1 = stateno != 115
Re: Need help for Triple Air Dash
#2  March 18, 2019, 04:17:07 am
  • ***
  • CPU Purple Heart
    • USA
    • www.dailymotion.com/2a8130871d2742d2f4da3b069

  • Online
 You need to set a variable that limits how many times you can air dash before you touch the ground.

 What you need...

1. A varset in statedef -2 set to 0 whenever you are in "statetype != A"
2. A non-persistent varadd in each air dash state that increases the variable by a value of 1.
3. In the CMD for all air dash commands, put a "triggerall = var(#) < 3" so that you can only air dash three times in a row before touching the ground.

 Edit: Oh, btw, I would get rid of this...

Quote
trigger1 = stateno != 110
trigger1 = stateno != 115

 Keeping this will prevent you from canceling an air dash into another air dash, which can make the whole thing wonky.
Re: Need help for Triple Air Dash
#3  March 18, 2019, 08:22:15 am
  • avatar
  • *
    • Philippines
Thanks for all the advice again Nep!

Feel free to correct me on these parts:

1. A varset in statedef -2 set to 0 whenever you are in "statetype != A"
My character can triple jump (thanks to you), so I used these triggers instead:
Code:
trigger1 = stateno = 40 ;jump start
trigger2 = stateno = 45 ;air jump start
trigger3 = stateno = 46 ;air jump start 2

2. A non-persistent varadd in each air dash state that increases the variable by a value of 1.
I used "command = "FF"" for my air dash and "command = "BB"" for my air back dash as triggers
Re: Need help for Triple Air Dash
#4  March 18, 2019, 10:24:02 am
  • ***
  • CPU Purple Heart
    • USA
    • www.dailymotion.com/2a8130871d2742d2f4da3b069

  • Online
 Well, it's more like resetting the variable to 0 in statedef -2 whenever your statetype is not A would be preferable because it'll always give back your air dashes when you touch the ground no matter what grounded state you're in.

 The commands are not really the important part here even if they're correct, you want to have a "triggerall = var(#) < 3" in both of them so that you can no longer air dash in the air after you use them all up. The varadds themselves go into both air dash states to assure that they count down properly.

 So, this is a general idea of how I do the -2 part for all my characters.

Quote
[State -2, Air Dash Reset]
type = varset
trigger1 = statetype != A
var(2) = 0

 How the CMD part looks for one of my characters

Quote
[State -1, Air Dash Forward]
type = ChangeState
value = 110
triggerall = !ishelper
triggerall = command = "FF"
triggerall = var(2) < 2 <--- air dash limit to two in the air
trigger1 = pos y <= -45
trigger1 = (statetype = A) && ctrl
trigger2 = pos y <= -45
trigger2 = (statetype = A) && movecontact
trigger2 = stateno = [400,430]
trigger3 = (statetype = A) && movecontact
trigger3 = stateno = 550

[State -1, Air Dash Backward]
type = ChangeState
value = 115
triggerall = !ishelper
triggerall = command = "BB"
triggerall = var(2) < 2 <--- same as the one above
trigger1 = pos y <= -45
trigger1 = (statetype = A) && ctrl
trigger2 = pos y <= -45
trigger2 = (statetype = A) && movecontact
trigger2 = stateno = [400,430]
trigger3 = (statetype = A) && movecontact
trigger3 = stateno = 550

 In both forward and back air dashes, I have a varadd that counts the air dash usage.

Quote
[State 110, VarAdd]
type = VarAdd
trigger1 = time = 0
var(2) = 1
Re: Need help for Triple Air Dash
#5  March 18, 2019, 03:13:20 pm
  • avatar
  • *
    • Philippines
I tried the code, but I can't air dash during my 2nd or 3rd air jump if I used up all of my 3 air dashes. I decided to change the triggers as I want my character to be able to triple air dash again after I do her 1st air jump, even if I used all of my air dashes during the regular jump, and do triple air dashes again after I do her 2nd air jump. Basically, when I do the 1st and 2nd air jump, I want my 3 stocks of air dash to be restocked
Re: Need help for Triple Air Dash
#6  March 18, 2019, 10:03:34 pm
  • ***
  • CPU Purple Heart
    • USA
    • www.dailymotion.com/2a8130871d2742d2f4da3b069

  • Online
 You'll have to put that same air dash reset in each of those jump states, except swap out "trigger1 = statetype != A" with "trigger1 = time = 0" in those cases.
Re: Need help for Triple Air Dash
#7  March 19, 2019, 02:41:00 am
  • avatar
  • *
    • Philippines
Hey, that works too! Thanks again Nep!