News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Changing sets of weapons

Started by Leonardo, September 24, 2009, 08:55:11 PM

Previous topic - Next topic

Leonardo

I´m working on my Megaman X, and he will change between weapons from Megaman X1, X2 e X3. For this, I´m using a var that define which set is in use, and the states -1 uses it to trigger the correct weapon. The code is this:

[State -2, VarSet]
type = VarSet
trigger1 = RoundState = 1
v = 40
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 1
v = 40
value = 2

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 2
v = 40
value = 3

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 3
v = 40
value = 1

But is just doesn´t work. The var stuck in value = 1. Can someone say what´s wrong?

PotS

Try reversing the order of those varsets, like this:

[State -2, VarSet]
type = VarSet
trigger1 = RoundState = 1
v = 40
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 3
v = 40
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 2
v = 40
value = 3

[State -2, VarSet]
type = VarSet
trigger1 = command = "c"
trigger1 = var(40) = 1
v = 40
value = 2


You see, the order you currently have is probably making all those varsets trigger in succession, returning the var to 1.  Alternatively you can use just one varset, with an ifelse in the value.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.

Leonardo

Well, now worked... a little. Reversing the order, the var changes between 2 and 3, but never goes back to 1...

How could I use ifelse in the value with these 3 vars?

PotS

value= ifelse(var(40)=1, 2, ifelse(var(40)=2, 3, 1))
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.