YesNoOk
avatar

var for distance (problem) (Read 1062 times)

Started by Momotaro, January 01, 2022, 12:44:54 pm
Share this topic:
var for distance (problem)
#1  January 01, 2022, 12:44:54 pm
  • *****
  • A.K.A. NED
  • I like to draw fighting game characters...
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

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

Code:
[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

Last Edit: January 01, 2022, 04:07:12 pm by Momotaro
Re: var for distance (problem)
#2  January 01, 2022, 02:38:44 pm
  • ****
    • crepa.neocities.org

  • Online
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.
Last Edit: January 01, 2022, 02:42:36 pm by DєαthScythє
Re: var for distance (problem)
#3  January 01, 2022, 03:56:03 pm
  • *****
  • A.K.A. NED
  • I like to draw fighting game characters...
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!!