So,i'm working on this character named Kung-Fu Man-R...basically a improved version of KFM. When coding his AI,i noticed that he would lose against small characters(Jump Force styled),something that i was not expecting,since he could beat Dragon Claw easily. Why that? Because the standard MUGEN AI almost didn't crouch. So,i coded a AI for him to crouch immediately when he gets 20 pixels close to his opponent. But,when i saw how he was in the game,he loopingly crouched.Here's the code (note:it's on statedef -2).[State -2, Crouching AI]type=ChangeStatevalue=10triggerall=var(7)triggerall=ctrltrigger1=statetype=Strigger1=p2bodydist x<=20 I think it has something to do with him repeating over an over again,so the solution would be stopping him from looping
I'd add a random chance of this action happening, something simple, like 'random < 100'. And maybe some more conditions.I think the reason is while crouching, a character is still in control, meaning, he chooses to do another action, but since crouching has 100% chance happening at tick 1 he keeps going in that state?The solution may be coding crouching state for AI's usage specifically. Where he wouldn't be in control, so then you can 'cancel' this AI crouching state into a crouching attack etc.
-2 is processed before -1, so this block of code fundamentally overrides all ai commands when the conditions are met.You're pretty much looking at this the wrong way. You shouldn't tell the ai to crouch whenever it can, you should tell it to use crouching attacks, and if your main concern is jus characters, to do so when the opponent's size constant is below a certain threshold.
What Foobs said. [State 1350, Chest Finder]type = VarSettrigger1 = (Time%1) = 0 v = 12 ;fv = 10value = floor( (enemy,const(size.head.pos.y) - enemy,const(size.mid.pos.y) )/2 ) [State 1350, Chest Tracker]type = VarSettrigger1 = (Time%1) = 0 v = 13 ;fv = 10;value = floor( const(size.mid.pos.y) + var(12)) value = ifelse(enemynear(0), statetype = L , 10, ifelse(enemynear(0), statetype = C ,floor( enemy,const(size.mid.pos.y)/2), floor( enemy,const(size.mid.pos.y) + var(12))))[State 1350, WTFisIT]type = VarSettrigger1 = (Time%1) = 0 v = 10value = ceil(P2BodyDist Y + var(13) )/20;10 This will give your character the spot for P2's chest. You can change the trigger to happen once at the start of the round or w/e. But if P2's creator set him up correctly you'll know about how tall it is. Then you can have a method to stop standing attacks in StateDef -1 from working unless P2 is in the air next to you.