ikemen-engine / Ikemen-GO

An open-source fighting game engine that supports MUGEN resources.
https://ikemen-engine.github.io
Other
696 stars 124 forks source link

Timing Difference of `DestroySelf` and `NumHelper` between MUGEN1.1 and IKEMEN #1894

Closed K4thos closed 4 days ago

K4thos commented 1 month ago

Discussed in https://github.com/ikemen-engine/Ikemen-GO/discussions/1892

Originally posted by **ChaosKo** July 18, 2024 Hi guys, Just started using Ikemen and learning the basics of MUGEN scripts recently. I think I observed an inconsistency when I was trying an old character from MUGEN1.1 in Ikemen. So the character has a super that shoots a projectile, and both the character and the target will start a certain animation when the projectile hits. I believe the author created a helper for the projectile to mark if the projectile hits, i.e., ``` [State -3,Super] type = Helper triggerall = !NumHelper(7702) trigger1 = movehit>=1 trigger1 = NumTarget >= 1 id = 7702 name = "projectile" pos = 40,-65 postype = P1 stateno = 7702 keyctrl = 0 ownpal = 1 ignorehitpause = 1 persistent = 0 ``` And the helper will be destroyed if it missed (when the character is out of the super state 8000, and the enemy hasn't got into state 2100 or 2200). ``` [Statedef 7702] type = S movetype = I physics = N ctrl = 0 velset = 0,0 anim = 20000 sprpriority = 4 [State 4110, DestroySelf] type = DestroySelf trigger1 = target,Stateno != [2100,2200] trigger2 = root,stateno != 8000 ``` If it hit, the character will enter state 2001 and play a certain animation. ``` [State -3, ChangeState] type = ChangeState trigger1 = NumHelper(7702) >= 1 value = 2001 ``` For MUGEN1.1, it works as expected. But for Ikemen, I think `NumHelper(7702)` is always 0 thus the animation won't be played. So I guess that the timing of DestroySelf for Helper 7702 went wrong in Ikemen, and I managed to fix it by modifying: ``` [State 4110, DestroySelf] type = DestroySelf ; add a delay here triggerall = time > 5 trigger1 = target,Stateno != [2100,2200] trigger2 = root,stateno != 8000 ``` I think it's quite interesting but that's all I got based on what I learnt for now. Can anyone explain the underlying difference? Thanks ^^
Wftk commented 1 month ago

i guess it maybe caused by numhelper checking for destroyself sctrl "active" flag in source code. Also i think need to test it in winmugen too maybe theres that check required while in 1.1 not.

potsmugen commented 1 month ago

May be the same as #1388 by the sound of it. If the helper is created in state 7702, then it never has targets. Therefore the expression target,Stateno != [2100,2200] is evaluated as 0 != [2100,2200], which is true and triggers the destroyself. Adding trigger1 = numtarget should fix it if that's the case.

ChaosKo commented 1 month ago

Adding trigger1 = numtarget should fix it if that's the case.

Yeah, I tried it and it worked.

K4thos commented 4 days ago

Closing as a duplicate for maintenance.