var help

Started by c001357, October 03, 2009, 04:48:33 PM

Previous topic - Next topic

c001357

[Statedef 2000]
type=S
physics=S
movetype=I
ctrl=0
velset=0,0
poweradd=-1000
sprpriority=2

[State 2000, 1]
type=varset
trigger1= !time
var(9)=ifelse((command="a"),1,10)
ignorehitpause=1

[State 2000, 2]
type=varset
trigger1= !time
var(9)=ifelse((command="b"),2,10)
ignorehitpause=1

[State 2000, 3]
type=varset
trigger1= !time
var(9)=ifelse((command="c"),3,10)
ignorehitpause=1

[State 2000, 4]
type=varset
trigger1= !time
var(9)=ifelse((command="x"),4,10)
ignorehitpause=1

[State 2000, 5]
type=varset
trigger1= !time
var(9)=ifelse((command="y"),5,10)
ignorehitpause=1

[State 2000, 6]
type=varset
trigger1= !time
var(9)=ifelse((command="z"),6,10)
ignorehitpause=1

[State 2000, Super Pause]
type=superpause
trigger1= !time
time=60
movetime=60
pos = -4,-68
anim = 100
sound = 20, 0

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=1,1000,240)

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=2,1010,240)

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=3,1020,240)

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=4,1021,240)

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=5,1030,240)

[State 2000, End]
type=changestate
trigger1= time>=30
value=ifelse(var(9)=6,1035,240)


changestate always redirects to 240 though

Byakko

Hummmmm why do you have 6 changestates with the same trigger anyway ? How do you expect the five ones that aren't the very first to ever be read ?
Let's say you don't press a at the very first tick. Mugen reads your state and finds, at time = 30, if you pressed a then go to state 1000, otherwise go to state 240. So you didn't press a, so you go to state 240. End of state 2000. You don't read the other changestates because you already aren't in state 2000 anymore.
See what's wrong ?

Does it at least go to state 1000 if you do hit a at !time ?
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.

c001357

Quote from: Byakko on October 03, 2009, 05:15:39 PM
Does it at least go to state 1000 if you do hit a at !time ?

no

Cyanide

I bet you don't even manage to have A as true at !time.

You'd have to buffer it in some manner, otherwise you almost have to be holding the key when you enter the state, and that's sorta difficult if the state itself isn't activated BY a.


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.

c001357

no, the input is not a problem, it just doesnt go to the right state

Quote[State 2000, End]
type=changestate
trigger1= time>=30 && var(9) = 1
value=1000

i changed it a bit, but now my char just freezes ???

Rajaa Retired

#5
In the varsets you could do this:

Quote[State 2000, 1]
type=varset
trigger1= !time && command="a"
var(9)= 1
ignorehitpause=1

etc...

or for optimization:
Quote
[State 2000, 1]
type=varset
trigger1=!time&&(command="a"||command="b"||command="c")
var(9)=ifelse(command="a",1,ifelse(command="b",2,3))
ignorehitpause=1

[State 2000, 1]
type=varset
trigger1=!time&&(command="x"||command="y"||command="z")
var(9)=ifelse(command="x",4,ifelse(command="y",5,6))
ignorehitpause=1

If you press "A" and "X" at the same time, "X" will take priority.


Use one changestate, like this:

Quote[State 2000, End]
type=changestate
trigger1=time>=30
value=1000 + (10*(var(9)=2)) + (20*(var(9)=3)) + (21*(var(9)=4)) + (30*(var(9)=5)) + (35*(var(9)=6))
Spoiler: Explanation (click to show)

That just adds a certain value to your base value, based on the statement inside the parentheses that are inside the parentheses multiplied by the number outside of the parentheses that are inside of the parentheses; in this case, the statement inside the parentheses that are inside the parentheses would be, "var(9)=?" and the number outside the parentheses that are inside the parentheses is 10, 20, 21... etc.

The first one:
So if variable 9 does equal 2, then it will multiply the 10 by 1, adding 10 to the base value. If variable 9 doesn't equal 2, then it will multiply the 10 by 0, adding 0 to your base value. Since the variable can only equal one value at a time, it will check each portion of the equation and add accordingly, if the variable is not equal to any of those values it'll just go to state 1000, which is why I left out a portion where variable 9 equals 1, because you want your character to go to state 1000 when variable 9 is equal to 1.

As for your character freezing, maybe that happens in your next state? Turn on the debug to see what state you're in when you freeze, then go search in that state. From what I'm looking at in the code you've posted, it's probably not the problem.