var for distance (problem)

Started by Momotaro, January 01, 2022, 12:44:54 PM

Previous topic - Next topic

Momotaro

Hi,

I'm trying to add some distance check to a move.
Description :

-Super move starter (p1 check p2 distance and activate a var)
-same state, player walk until making contact with p2
-then a changestate select either state 3001 or 3002 depending on the var activated.

My problem is mugen always choose the "close" option... (seems like var11 always stay at 0)
How can I fix it?

Part of the code

[State 3000, 4];distance detect CLOSE
type = VarSet
triggerall = Time = 0
trigger1 = p2dist x < 120
v = 11
value = 0
persistent = 0
;
[State 3000, 4];distance detect FAR
type = VarSet
triggerall = Time = 0
trigger1 = p2dist x >= 120
v = 11
value = 1
persistent = 0


after the hitdef

[State 3000, 7];----------------------CLOSE
type = ChangeState
triggerall = Var(11) = 0;distance detect CLOSE
trigger1 = movecontact;;;;;;;;;;;;movehit
trigger1 = hitshakeover = 1
value = 3001
ctrl = 0

[State 3000, 7];----------------------FAR
type = ChangeState
triggerall = Var(11) = 1;distance detect FAR
trigger1 = movecontact;;;;;;;;;;;;movehit
trigger1 = hitshakeover = 1
value = 3002
ctrl = 0



VictorCYBR

#1
Code seems good... I'd try adding a displaytoclipboard to check if the var is activating at all or not.
In statedef -2:

[State -2, Debug]
type = DisplayToClipboard
trigger1 = 1
text = "var 11 is %d"
params = var(11)
ignoreHitPause = 1

Test it with debug enabled.

Second thing is to check if the var is being used by another state, you can do that with the 'variable log' tool in fighter factory. When you click it anywhere in the states, it will show you a log with all the vars and which states are using them.

Momotaro

Quote from: DєαthScythє on January 01, 2022, 02:38:44 PM
Code seems good... I'd try adding a displaytoclipboard to check if the var is activating at all or not.
In statedef -2:

[State -2, Debug]
type = DisplayToClipboard
trigger1 = 1
text = "var 11 is %d"
params = var(11)
ignoreHitPause = 1

Test it with debug enabled.

Second thing is to check if the var is being used by another state, you can do that with the 'variable log' tool in fighter factory. When you click it anywhere in the states, it will show you a log with all the vars and which states are using them.

Thanks for your help.
(I should have precised it's not a POTS of similar character)
I used to use clipboard to display dizzy var level.

I tried it, the var works.
My problem was the actual distance.
after some tweakings, it seems to work.

I think, I'll switch back to p2bodydistance instead of p2distance.

Thanks again!!