YesNoOk
avatar

charged attack (Read 513 times)

Started by Dendog90, October 04, 2019, 06:03:36 am
Share this topic:
charged attack
#1  October 04, 2019, 06:03:36 am
  • avatar
  • **
    • USA
so I have charged up move, at which I hold the x button for certain amount of time, and depending on the time, that is the stateno he executes.
my problem is my charge up state anim, I want him to do the full animation then pause at the end as its charging the move but instead he goes straight to the last elem of the charge up state

;Charge RP
[Statedef 161]
type = s
movetype = I
physics = s
ctrl = 0
anim = 161
poweradd = 0
sprpriority = -1

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = command="hold_x"
value = 161
elem = 3
persistent = 1



;===========================================================================

[State 0, VarAdd];if button is held for 50 ticks, the value goes up by 1 and he does 3 punches
type = VarAdd
trigger1 = time = 50
v = 20
value = 1


;=========================================================================
[State 0, VarAdd];if button is held for 120 ticks, the value goes up by 2 and he does 5 punches
type = VarAdd
trigger1 = time =120
v = 20
value = 1

;==================================================================================

[State 0, ChangeState]
type = ChangeState
triggerall= var(20)=0
trigger1 = animtime=0
value =156
ctrl = 0

[State 0, ChangeState]
type = ChangeState
triggerall= var(20)=1
trigger1 = animtime=0
value =162
ctrl = 0

[State 0, ChangeState]
type = ChangeState
triggerall= var(20)=2
trigger1 = animtime=0
value =163
ctrl = 0

;-------------------------------------------------------------------------------
;3 punches
[Statedef 162]
type = s
movetype = A
physics = s
ctrl = 0
anim = 162
poweradd = -50
sprpriority = 1

[State 0, punch rip]
type = PlaySnd
trigger1 = animelem= 2
value = S0,2
volumescale = 30
channel = -1
;lowpriority = -1
freqmul = 1.0

[State 0, rocket blast]
type = PlaySnd
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
value = S2621,0
volumescale = 90
channel = -1
;lowpriority = -1
freqmul = 1.0

[State 157, Rp flash]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
anim = 157
pos = -15,-15
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 2
ontop = 0



[State 159, dust]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
anim = 159
pos = 60,10
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 1
ontop = 0


[State 159, RP shockwave]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
anim = 167
pos = 68,-86
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = .2,.2
sprpriority = 1
ontop = 0



[State 0, Rocket Punch]
type = Projectile
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
ProjID = 162
projanim =158
projhitanim =1
projscale = 1,1
projremove = -1
projremovetime = -1
velocity = 10,0
projhits = 1
projpriority = 3
projsprpriority = 3
offset =  115,-70
postype = p1         ;p2,front,back,left,right
attr = S, sp                   ;Attribute: Standing, Normal Attack
damage = 28, 0                   ;Damage that move inflicts, guard damage
animtype = Light                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MAF                    ;Flags of conditions that move can hit
priority = 3, Hit                ;Attack priority: 0 (least) to 7 (most), 4 default
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 8, 8                 ;Time attacker pauses, time opponent shakes
sparkno = s160
sparkxy = 0,-3                     
hitsound = s3100,0                  ;Sound to play on hit
guardsound = 6, 0                ;Sound to play on guard
ground.type = High               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 5             ;Time that the opponent slides back
ground.hittime  = 11             ;Time opponent is in hit state
ground.velocity = -4             ;Velocity at which opponent is pushed
airguard.velocity = -1.9,-.8     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = High                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -1.4,-3           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 15
envshake.time =10
envshake.freq =40
envshake.ampl= 10

[State 0, ChangeState]
type = ChangeState
trigger1 = animtime =0
value =0
ctrl = 1






;-------------------------------------------------------------------------------
;5 punches
[Statedef 163]
type = s
movetype = A
physics = s
ctrl = 0
anim = 163
poweradd = -100
sprpriority = 0

[State 0, punch rip]
type = PlaySnd
trigger1 = animelem= 2
value = S0,2
volumescale = 30
channel = -1
;lowpriority = -1
freqmul = 1.0

[State 0, rocket blast]
type = PlaySnd
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
trigger4= animelem = 11
trigger5= animelem = 13

value = S2621,0
volumescale = 90
channel = -1
;lowpriority = -1
freqmul = 1.0

[State 157, Rp flash]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
trigger4= animelem = 11
trigger5= animelem = 13
anim = 157
pos = -15,-15
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 2
ontop = 0



[State 159, dust]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
trigger4= animelem = 11
trigger5= animelem = 13
anim = 159
pos = 60,10
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = 1,1
sprpriority = 1
ontop = 0

[State 159, RP shockwave]
type = Explod
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
trigger4= animelem = 11
trigger5= animelem = 13
anim = 167
pos = 68,-86
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = 0
scale = .2,.2
sprpriority = 1
ontop = 0

[State 0, Rocket Punch]
type = Projectile
trigger1 =animelem = 5
trigger2 = animelem = 7
trigger3= animelem = 9
trigger4= animelem = 11
trigger5= animelem = 13
ProjID = 163
projanim =158
projhitanim =1
projscale = 1,1
projremove = -1
projremovetime = -1
velocity = 10,0
projhits = 1
projpriority = 3
projsprpriority = 3
offset =  115,-70
postype = p1         ;p2,front,back,left,right
attr = S, sp                   ;Attribute: Standing, Normal Attack
damage = 28, 0                   ;Damage that move inflicts, guard damage
animtype = Light                 ;Animation type: Light, Medium, Heavy, Back (def: Light)
guardflag = MA                   ;Flags on how move is to be guarded against
hitflag = MAF                    ;Flags of conditions that move can hit
priority = 3, Hit                ;Attack priority: 0 (least) to 7 (most), 4 default
;Hit/Miss/Dodge type (Def: Hit)
pausetime = 8, 8                 ;Time attacker pauses, time opponent shakes
sparkno = s160
sparkxy = 0,-3                     
hitsound = s3100,0                  ;Sound to play on hit
guardsound = 6, 0                ;Sound to play on guard
ground.type = High               ;Type: High, Low, Trip (def: Normal)
ground.slidetime = 5             ;Time that the opponent slides back
ground.hittime  = 11             ;Time opponent is in hit state
ground.velocity = -4             ;Velocity at which opponent is pushed
airguard.velocity = -1.9,-.8     ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2))
air.type = High                  ;Type: High, Low, Trip (def: same as ground.type)
air.velocity = -1.4,-3           ;X-velocity at which opponent is pushed,
;Y-velocity at which opponent is pushed
air.hittime = 15
envshake.time =10
envshake.freq =40
envshake.ampl= 10

[State 0, ChangeState]
type = ChangeState
trigger1 = animtime =0
value =0
ctrl = 1


and I tried to remove elem and persistent from change anim but he still doesnt do full animation, what can I do?
Re: charged attack
#2  October 04, 2019, 09:03:47 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
I assume you want him to pause on elem 3 rather than go straight there. Try this

Changeanim
Trigger1 = command = "hold_x" && animelemtime(3) >= 0
Value = whatever
Elem = 3

Itll only start locking you to 3 once you actually get there that way.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: charged attack
#3  October 04, 2019, 09:29:49 am
  • *****
  • Shame on you!
    • USA
You really don't need a variable to do what you're doing. You actually have a few flaws in your method. The most obvious problem is you dont actually check to see if X is being held.

like you have
trigger1 = command="hold_x"
in the changeanim, but not in any of the varadds.

It seems like you might want to add a trigger in your changestates to see if the hold_x is active. If it isn't it's released and you might want to switch states. 

But this,
Spoiler, click to toggle visibilty
Seems like it will always changestate to 163. There's no way for
trigger1 = time =120
to NOT work.

On top of ALL of that. Do you ever reset the var to 0? If you redo the state a 2nd time I don't think it will changestates; Ever.

Use DisplayToClipboard to watch that variable.
If you'd like to learn how to make this move without using a var, just ask.
vVv Ryuko718 Updated 10/31/22 vVv
Re: charged attack
#4  October 04, 2019, 09:51:23 am
  • avatar
  • **
    • USA
Thank you so much Cyanide for your response it did what I wanted and thanks for the advice Odb718
Re: charged attack
#5  October 04, 2019, 10:32:53 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Odb his changestate for var = 0 will take effect if x isn't held. Not holding x means the animation is allowed to complete. It might not be how you or i would do it but the logic is right.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: charged attack
#6  October 04, 2019, 11:44:39 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = command="hold_x"
value = 161
elem = 3
persistent = 1

Persistent=1 means that it will be triggered 2 times only, so at the third time it won't (acting the same as if you had released the button)
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: charged attack
#7  October 05, 2019, 04:59:44 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Persistent = 1 is trigger every tick. 2 is every 2 ticks and so on. Persistent = 0 is trigger once.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: charged attack
#8  October 07, 2019, 07:28:07 am
  • *****
  • Shame on you!
    • USA
[State 0, VarAdd];if button is held for 50 ticks, the value goes up by 1 and he does 3 punches
type = VarAdd
trigger1 = time = 50
v = 20
value = 1


;=========================================================================
[State 0, VarAdd];if button is held for 120 ticks, the value goes up by 2 and he does 5 punches
type = VarAdd
trigger1 = time =120
v = 20
value = 1
Odb his changestate for var = 0 will take effect if x isn't held. Not holding x means the animation is allowed to complete. It might not be how you or i would do it but the logic is right.
I guess his animation has to be shorter than 50 tics then. This just seems all the way backwards. Also, if for some crazy reason the player lets go of X on tic 50, and presses it on 51, the value didn't go up. Same thing with tic 120. It's got more than a couple flaws and could be done a lot more reliably. If the end of the animation is longer than a couple tics, the player could let go of X and still be rewarded.
The value going up only while the player holds X and then the change state reading the total value would be better.
vVv Ryuko718 Updated 10/31/22 vVv