News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Problems with platform helper

Started by SaltAddict, January 05, 2017, 06:33:20 PM

Previous topic - Next topic

SaltAddict

I've managed to code platforms for my character to use. The platforms are helpers. It works well if there's only one platform helper, but if it creates multiple patform helpers, only the first platform will work, and my character will simply phase through the other ones. Additionally, when my character is hit and knocked away, they will phase through any platform.

Here's my code:

Character code:
[State -2, Helper]
type = Helper
trigger1 = roundstate = 0
persistent = 0
stateno = 9898
helpertype = normal
id = 9898
name = "Platform"
keyctrl = 0
ownpal = 1
pos = 10,-100
postype = left

[State -2, Helper]
type = Helper
trigger1 = roundstate = 0
persistent = 0
stateno = 9898
helpertype = normal
id = 9898
name = "Platform"
keyctrl = 0
ownpal = 1
pos = 200,-100
postype = left         

[State -2]
type = changestate
triggerall = statetype = A && vel y > 0
trigger1=Cond(Numhelper(9898),abs(Rootdist X-Helper(9898),Rootdist X)<20,0) 
trigger1=Cond(Numhelper(9898),abs(Rootdist Y-Helper(9898),Rootdist Y)<5,0)
value = 52

[State -2]
type = changestate
triggerall = statetype = A && vel y > 0 && stateno = 5030
trigger1=Cond(Numhelper(9898),abs(Rootdist X-Helper(9898),Rootdist X)<20,0) 
trigger1=Cond(Numhelper(9898),abs(Rootdist Y-Helper(9898),Rootdist Y)<5,0)
value = 5100


[State -2]
type = varset
trigger1=Cond(Numhelper(9898),abs(Rootdist X-Helper(9898),Rootdist X)<20,0) 
trigger1=Cond(Numhelper(9898),abs(Rootdist Y-Helper(9898),Rootdist Y)<5,0)
v = 15
value = 1

[State -2]
type = varset
trigger1=Cond(Numhelper(9898),abs(Rootdist X-Helper(9898),Rootdist X)>20,0)
trigger1=Cond(Numhelper(9898),abs(Rootdist Y-Helper(9898),Rootdist Y)>5,0)
v = 15
value = 0

[State -2]
type = changestate
triggerall = var(15) = 1
trigger1=Cond(Numhelper(9898),abs(Rootdist X-Helper(9898),Rootdist X)>20,0) 
value = 51

[State -2, ]
type = posset
triggerall = statetype = S
trigger1 = var(15) = 0 && stateno = 0
y =0


Platform helper code:
[Statedef 9898]
physics = S                 
sprpriority = -4
anim = 9898

[State 9898]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 9898]
type = playerpush
trigger1 = 1
value = 0
ignorehitpause=0



Cyanide

Your 2 platforms have the exact same ID. Mugen will return redirects via the first ID found. Which is normally the first player ID in sequence if they have the same defined ID. You would need to give them different ID's and add additional code to allow for 2 platforms.

Most platform codes actually rely on hits (they break for super armour) but it forces a hit on you, and then releases you to your stand state via a short custom state, and forces you into a jump state when you hit either end. This can be done via invisible projectile or helper creation when p2 meets certain conditions. Using affectteam = B in the hitdefs will allow it to work on partners 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.

SaltAddict

#2
Quote from: Cyanide on January 06, 2017, 09:39:15 AM
Your 2 platforms have the exact same ID. Mugen will return redirects via the first ID found. Which is normally the first player ID in sequence if they have the same defined ID. You would need to give them different ID's and add additional code to allow for 2 platforms.

Most platform codes actually rely on hits (they break for super armour) but it forces a hit on you, and then releases you to your stand state via a short custom state, and forces you into a jump state when you hit either end. This can be done via invisible projectile or helper creation when p2 meets certain conditions. Using affectteam = B in the hitdefs will allow it to work on partners as well.

Thank you! That works, but how do I make the players not guard when they're close to the platform? I tried guard.dist in the hitdef but it doesn't work. Also, for some reason my character can't attack after landing in the platform, even though they can walk and jump...

Edit:
Platform code:
[Statedef 9898]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim =9898

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State ]
type = assertspecial
trigger1 = 1
flag = noshadow

[State ]
type = HitDef
trigger1 = root, vel Y > 0
numhits = 2
affectteam = B
attr = S, HT
damage = 0
priority = 7,Hit
hitflag = MAFD
hitsound = -1
guardsound = -1
pausetime = 0,0
sparkno = -1
guard.sparkno = -1
p2stateno = 53


[State]
type = assertspecial
trigger1 = 1
flag = noshadow

Cyanide

State 53 needs to selfstateno them to state 52 on time = 0, or it needs to allow the landing anim to play and selfstate to state 0 from there. A changestate won't work, has to be selfstate.

For not guarding, make use of the guarddist parameter and set it to 0. I forget if applying assertspecial unguardable actually turns off the block mechanism or just makes it so it can't block.

You can also have it flick to movetype = A only when you actually want the attack to happen. That way p2 can't see it coming.


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.

SaltAddict

Quote from: Cyanide on January 08, 2017, 01:20:43 AM
State 53 needs to selfstateno them to state 52 on time = 0, or it needs to allow the landing anim to play and selfstate to state 0 from there. A changestate won't work, has to be selfstate.

For not guarding, make use of the guarddist parameter and set it to 0. I forget if applying assertspecial unguardable actually turns off the block mechanism or just makes it so it can't block.

You can also have it flick to movetype = A only when you actually want the attack to happen. That way p2 can't see it coming.

Thanks! Works perfectly now!