YesNoOk
avatar

AI auto combo working incorrectly. (Read 213 times)

Started by Ultimaetus, February 04, 2014, 05:23:00 am
Share this topic:
AI auto combo working incorrectly.
#1  February 04, 2014, 05:23:00 am
  • *
    • USA
    • derric.vinhage@gmail.com
So the combo automatically uses different moves via single button presses and optimally turns out as XXXYY. Yet the ai uses the same 200 statedef only without ever moving onto the next move. I assume it has to do with the fact that the AI is not actually issuing out X or Y commands, and I don't know how to fix it.



Code:
; AI Right Swing , Begin Combo
[State -1, AI Command X]
type = ChangeState
value = 200
Triggerall=var(59)>0
Triggerall=P2StateType!= L
triggerall = p2statetype != A
Triggerall =abs(P2Bodydist X)<40
trigger1 = stateno = 305
trigger2 = stateno = 200 && movehit=1 ||moveguarded = 1
trigger3 = stateno = 205 && movehit=1 ||moveguarded = 1
trigger4 = stateno = 201 && pos y = 0
trigger5 = ctrl && statetype = S

;Spin attack, Begin/continue Combo AI
[State -1, AI Command Y]
type = ChangeState
value = 220
Triggerall=var(59)>0
Triggerall=P2StateType!= L
triggerall = p2statetype != A
Triggerall = abs(P2Bodydist X)<40
trigger1 = stateno = 210  && movehit=1 ||moveguarded = 1
trigger2 = stateno = 220 && movehit=1 ||moveguarded = 1
trigger3 = stateno = 201 && pos y = 0 && movehit=1 ||moveguarded = 1


Statechange states to their respective move.
Spoiler, click to toggle visibilty

Im going to try and create separate statechanges in the cmd and just make it work off that instead.

edit: And that did it.
Last Edit: February 04, 2014, 05:39:15 am by Ultimaetus
Re: AI auto combo working incorrectly.
#2  February 04, 2014, 05:26:56 am
  • **
  • Gay Alien Boyfriend
    • USA
    • lunchboxlabs.tumblr.com
You simply have to switch the order of the ChangeStates. They activate based upon which comes first in the .cmd file. Once it finds a ChangeState that returns true, it switches to that state and ignores all the other ones. This is why 99% of .cmd files have super moves right at the top.
Last Edit: February 04, 2014, 05:30:08 am by RedLuncbox
Re: AI auto combo working incorrectly.
#3  February 04, 2014, 05:30:39 am
  • ****
  • The Legend Will Never Die
    • Mexico
When a character is controlled by the CPU the CPU randomly mashes commands from the entire command pool, this makes the chances of having the CPU press a button while a move has just hit be really really low.

What you need to do is hardcode or guide the AI to do the things you want it to do.

For example: (assuming AI Level)

Code:
[State 200, Combo]
type = ChangeState
triggerall = AILevel ;AI is activated
triggerall = stateno = 200 ;Canceling from state 200
;Think of this as coding the cancel in the character, except the AI will automatically do it once the first hit connects.
trigger1 = movehit
trigger2 = moveguarded
value = 205
ctrl = 0

You can use a variable in order to have pre-programmed patterns and maps.

If you need an example of how to do this you can check my Shingo (has annotations) or Kamekaze's AI for Rugal.
Twitter: @vans1belmont
1.1 AZRAEL #GDLK
amazon, pls
Last Edit: February 04, 2014, 06:39:11 am by Vans
Re: AI auto combo working incorrectly.
#4  February 04, 2014, 06:23:14 am
  • *
    • USA
    • derric.vinhage@gmail.com
I got it working as I needed, I am noting for some reason
trigger1 = Stateno = XXX && movehit=1 || moveguarded=1
causes the ai to loop the same attack if it gets blocked as opposed to

trigger1 = stateno = XXX && movehit=1
trigger2 = stateno = XXX &&  moveguarded = 1

which functions as expected.
Re: AI auto combo working incorrectly.
#5  February 04, 2014, 06:40:17 am
  • ****
  • The Legend Will Never Die
    • Mexico
Correct, you have to be specific when using AND and OR statements.

trigger1 = Stateno = XXX && movehit=1 || moveguarded=1

Is read as (stateno = xxx && movehit = 1) OR moveguarded = 1.

Try trigger1 = Stateno = XXX && (movehit=1 || moveguarded=1)

Instead.
Twitter: @vans1belmont
1.1 AZRAEL #GDLK
amazon, pls