News:

MFG's Character of the Month: October 2026 Voting

Main Menu

Var & Changeanim problem

Started by BC, April 25, 2009, 04:53:22 PM

Previous topic - Next topic

BC

Working on Balrogs Crazy Buffalo and have stumbled along a problem thats probably staring me right in the face.

Playing the game(cvs2) if you holding A B or C during the move he deals uppercuts instead of straights, and you can release and press again to mix things up like uppercut,straight,uppercut ect.  for lvl 3 theres 4 punches and 1 turn punch.


in my code i used just hold A for testing purposes.

[statedef 3100]
type = S
movetype = A
physics = S
velset = 0,0
ctrl = 0
anim = 3100

[State 0, Helper]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "superpause"
ID = 3001
stateno = 3501
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 9999
pausemovetime  = 9999

[State 0, SuperPause]
type = SuperPause
trigger1 = time= 0
time = 50
anim = -1
darken = 1
p2defmul = 0
poweradd = 0
unhittable = 1

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

[statedef 3101] ;punching state
type = S
movetype = A
physics = N
velset = 0,0
ctrl = 0

[State 0, VarSet]
type = VarSet
trigger1 = command !="hold_a"   ;reseting var(3) to 0 when a is not held down
v = 3
value = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = var(3)=1           ;change to uppercuts when a is held
value = 3103
elem = 1
ignorehitpause = 1
persistent = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !var(3)           ;when a is not held change to straights
value = 3101
ignorehitpause =  1
persistent =0

[State 2000, VelSet]
type = VelSet
trigger1 = anim = 3101 && animelem = 2
trigger2 = anim = 3103 && animelem = 4
x = 8

[State 2000, VelMul]
type = VelMul
trigger1 = AnimElem = 2, > 0
x = .79

[State 2000, HitLow]
type = HitDef
trigger1 = AnimElem = 3
attr = S, HA
damage = 70,5
animtype = Medium
getpower = 0,0
guardflag = M
hitflag = MAF
pausetime = 5,5
sparkno = 2
sparkxy = -10,-70
forcestand = 1
ground.type = Low
ground.slidetime = 30
ground.hittime  = 30
ground.velocity = -6,0
airguard.velocity = -3,-1
air.type = Low
air.velocity = -6,-1
air.juggle = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = anim = 3101 && time = 44 ;after 4 straights
trigger2 = anim = 3103 && time = 56 ;after 4 uppercuts
value = 3102
ctrl = 0

[statedef 3102] ;turn punch state.
type = S
movetype = A
physics = N
ctrl = 0
anim = 3102

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 3
value = 0

[State 2000, HitLow]
type = HitDef
trigger1 = AnimElem = 9
attr = S, HA
damage = 70,5
animtype = hard
getpower = 0,0
guardflag = M
hitflag = MAF
pausetime = 5,5
sparkno = 2
sparkxy = -10,-70
ground.type = high
ground.slidetime = 30
ground.hittime  = 30
ground.velocity = -6,-3
airguard.velocity = -3,-1
air.type = Low
air.velocity = -6,-1
air.juggle = 1
fall = 1

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 10
x = 0
y = 0

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


and this in state -2

[State -2, VarSet]  ;can be added in state 3101 i know.
type = VarSet
trigger1 = command = "hold_a"
v = 3
value = 1


but yea this only allows me to hold A to change the anim and when i release and try holding it again it doesnt changeanim just keeps on  dealing straights.... so i can only hold A once basically.


heres what happens, without holding A the straights play.... when holding A the uppercuts play, when i hold A for 2 punches then release he does 2 uppercuts and 2 straights which is fine, but what if i wanna do 1 uppercut 2 straights and 1 uppercut lol <<<<<
Accepting commissions

Fallen_angel

you can understan more the movement if you have these on statedef =2 or =3

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 =1
text = "var(3) = %d "
params = var(3)

in the debug section, it will advice you when is the var active

What cames to the top of my head is that if you move the varset to the statedef it will be fixed

Cyanide

It changes to that anim once, persistent is 0, and of course if you set persistent higher than 0, the attack will keep swapping.

You need to add some more triggers and leave it at persistent = 1

type = changeanim
triggerall = var(3) = 1
trigger1 = anim = upper && animtime = 0
trigger2 = anim = straight && animtime = 0
value = upper
elem = 1

same thing but for straight as well.


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.

BC

#3
[state 0, changeanim]
type = changeanim
triggerall = !var(3)
trigger1 = anim = 3101 && animtime = 0
trigger2 = anim = 3103 && animtime = 0
value = 3101
elem = 1

[state 0, changeanim]
type = changeanim
triggerall = var(3) = 1
trigger1 = anim = 3103 && animtime = 0
trigger2 = anim = 3101 && animtime = 0
value = 3103
elem = 1

like this? knowing me ive got it wrong......

but anyway @ fallen  i have DTC already setup and var(3) switches on and off fine.

adding the above code Cyanide makes him stuck in state 3101 (with state 3100's superpause anim frame 1/1)



EDIT:


[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !var(3)           ;when a is not held change to straights
value = 3101
ignorehitpause =  1
persistent =0

[state 0, changeanim]
type = changeanim
triggerall = var(3) = 1
trigger1 = anim = 3103 && animtime = 0
trigger2 = anim = 3101 && animtime = 0
value = 3103
elem = 1


this works...... but not well lol, works fine and as it should BUT if you keep A held during superpause he gets stuck like the above. then when you release he wont stop dealing straights lol but if you hold A while he does straights he deals uppercuts fine.


so i think somewhere in between the 2 codes lol?  or ammend first 2 codes

Accepting commissions

Rajaa Retired

Quote[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !var(3)           ;when a is not held change to straights
value = 3101
ignorehitpause =  1
persistent =0

[state 0, changeanim]
type = changeanim
triggerall = var(3) = 1
trigger1 = anim = 3103 && animtime = 0
trigger2 = anim = 3101 && animtime = 0
value = 3103
elem = 1

Why is one triggered only once and the other not? If you want to change from one to the other, remove persistent = 0 from the top one and add triggers One and Two from the bottom one to the top one and change the trigger1 that's already in the top one, into a triggerall.. Limit it so you can activate this only after the superpause. Maybe a time trigger or something.


I think that's what's bugging it.

BC

#5
after a headache i got it.

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = stateno!=3100
triggerall = var(3)=0
trigger1= time <= 0
value = 3101
ignorehitpause =  1

[state 0, changeanim]
type = changeanim
triggerall = var(3)=1
trigger1 = anim !=3103
value = 3103
elem = 2

[state 0, changeanim]
type = changeanim
triggerall = animtime = 0
triggerall = anim = 3103
trigger1 = var(3) = 0
value = 3101
elem = 2

this works as it should now, thanks to all that helped.


had to mess with the changestates also, because it was allowing too many hits

[State 0, ChangeState]
type = ChangeState
triggerall = anim!=3103
trigger1= anim = 3101 && time >=44
trigger2 = hitcount = 4
value = 3102
ctrl = 0

[State 0, ChangeState]
type = ChangeState
triggerall = anim!=3101
trigger1= anim = 3103 && time >=56
trigger2 = hitcount = 4
value = 3102
ctrl = 0

[State 0, ChangeState]
type = ChangeState
triggerall = anim=3101
triggerall = anim=3103
trigger1= time>=56
trigger2 = hitcount = 4
value = 3102
ctrl = 0
Accepting commissions