Would you like to react to this message? Create an account in a few clicks or log in to continue.
Welcome!!! - Bienvenidos!!! - ( We hope you will get involved in the MMV Community which is dedicated to having fun with Mugen ) - Bienvenidos!!! - Welcome!!!
Posts : 782 Join date : 2012-05-01 Age : 33 Location : Russia
Subject: Quick AI patch tutorial January 28th 2021, 4:16 am
So i was always bummed out when characters in 1 mugen game have vastly different AI and i found a quick and good way to add it. works great so far (but only tested on Marvel/Capcom characters) all code parts are taken from IMT marvel characters, so this custom AI will be basically the same, which is used in AvX/Project X
so, first of all, you have to make sure character doesnt have any custom AI in place. if it does, you will need to replace it it sounds difficult, if you never edited AI before, but its actually pretty easy, since most of the characters have the same AI code pattern. but i would suggest to try this method on character with no custom AI first, and then, when you successful in that, go a step further and replace existing custom AI
1st part is really easy. it will make you no-AI character to have combos and proper defence 1st step of this 1st part is to just copy this text segment to the beggining of .cmd file, before all special/hypers input commands:
Spoiler:
;-| AI Commands |----------------------------------------------------------
;-| AI |------------------------------------------------------------- [Command] name = "CPU1" command = U, D, F time = 1
[Command] name = "CPU2" command = U, B, F time = 1
[Command] name = "CPU3" command = U, D, D time = 1
[Command] name = "CPU4" command = F, B, U time = 1
[Command] name = "CPU5" command = U, F, U, B time = 1
[Command] name = "CPU6" command = U, D, B time = 1
[Command] name = "CPU7" command = F, F, B time = 1
[Command] name = "CPU8" command = U, D, U time = 1
[Command] name = "CPU9" command = F, B, B time = 1
[Command] name = "CPU10" command = F, F, B, B time = 1
[Command] name = "CPU11" command = U, U, F time = 1
[Command] name = "CPU12" command = U, B, B time = 1
[Command] name = "CPU13" command = U, B, F, F time = 1
[Command] name = "CPU14" command = U, F, B, U time = 1
[Command] name = "CPU15" command = U, B, F, U time = 1
[Command] name = "CPU16" command = U, B, B, B time = 1
[Command] name = "CPU17" command = U, D, B, F time = 1
[Command] name = "CPU18" command = U, D, B, D time = 1
[Command] name = "CPU19" command = U, D, F, U time = 1
[Command] name = "CPU20" command = U, D, U, B time = 1
[Command] name = "CPU21" command = U, D, F, F time = 1
[Command] name = "CPU22" command = F, F, F, F time = 1
[Command] name = "CPU23" command = U, U, U, D time = 1
[Command] name = "CPU24" command = B, B, B time = 1
[Command] name = "CPU25" command = D, D, D, D time = 1
[Command] name = "CPU26" command = D, D, D time = 1
[Command] name = "CPU27" command = F, F, F time = 1
[Command] name = "CPU28" command = U, U, U time = 1
[Command] name = "CPU29" command = U, U, B, B time = 1
[Command] name = "CPU30" command = D, D, F, F time = 1
second step is pretty similar. you need to copy this part AFTER [statedef -1] to the same .cmd file
;--------------------------------------------------------------------------- ; Standing basics ; ; Punches: 200, 210, 220 ; Kicks: 230, 240, 250 ;--------------------------------------------------------------------------- ;crouch Strong punch (launcher) [State -1, Crouch launcher] type = ChangeState value = 420 triggerall = var(59) && ctrl && random < 200 triggerall = StateType != A && MoveType != H && RoundState = 2 && !IsHelper trigger1 = p2bodydist X <= 20 && (enemynear, anim = 5300) && (StateNo = 420) && movehit trigger2 = p2bodydist X <= 20 && (enemynear, statetype != A) && Random = [150,850] ; Stand Light Punch [State -1, Stand Light Punch] type = ChangeState value = 200 triggerall = (statetype = S) && var(59) && p2statetype != L && RoundState = 2 trigger1 = ctrl = 1 trigger1 = (enemynear, p2dist x <= 60 && enemynear, movetype != A && Random <= 200)
;--------------------------------------------------------------------------- ; Stand Medium Punch [State -1, Stand Medium Punch] type = ChangeState value = 210 triggerall =(statetype = S) && var(59) && p2statetype != L && RoundState = 2
;--------------------------------------------------------------------------- ; Stand Hard Punch [State -1, Stand Hard Punch] type = ChangeState value = 220 triggerall = var(59) && p2statetype != L && RoundState = 2 triggerall = statetype = S
;--------------------------------------------------------------------------- ; Stand Light Kick [State -1, Stand Light Kick] type = ChangeState value = 230 triggerall =(statetype = S) && var(59) && p2statetype != L && RoundState = 2 trigger1 = (enemynear, p2dist x <= 60 && enemynear, movetype != A && (Random <= 400&& random >200)) && ctrl
;--------------------------------------------------------------------------- ; Stand Medium Kick [State -1, Stand Medium Kick] type = ChangeState value = 240 triggerall = var(59) && p2statetype != L && RoundState = 2 triggerall = statetype = S
;--------------------------------------------------------------------------- ; Air basics ; Punches: 600, 610, 620 ; Kicks: 630, 640, 650 ;--------------------------------------------------------------------------- ; Air Light Punch [State -1, Air Light Punch] type = ChangeState value = 600 triggerall = var(59) && RoundState = 2 && stateno != 100 && statetype = A && ctrl trigger1 = p2dist X < 60 && (p2dist Y > -3 && p2dist Y < 3)
;--------------------------------------------------------------------------- ; Air Medium Punch [State -1, Air Medium Punch] type = ChangeState value = 610 triggerall = var(59) && RoundState = 2 && stateno != 100 && statetype = A
;--------------------------------------------------------------------------- ; Air Hard Punch [State -1, Air Hard Punch] type = ChangeState value = 620 triggerall = var(59) && RoundState = 2 && stateno != 100 && statetype = A
;--------------------------------------------------------------------------- ; Air Medium Kick [State -1, Air Medium Kick] type = ChangeState value = 640 triggerall = var(59) && RoundState = 2 && stateno != 100 && statetype = A
;--------------------------------------------------------------------------- ; Air Hard Kick [State -1, Air Hard Kick] type = ChangeState value = 650 triggerall = var(59) && RoundState = 2 && stateno != 100 triggerall = statetype = A && ctrl
;---------------------------------------------------------------------- ;---------------------------------------------------------------------- ; Air combo [State -1, ChangeState] type = ChangeState triggerall = Var(59) && StateType = A trigger1 = (StateNo = [600,620]) && (MoveContact) value = IfElse(StateNo = 600,630,IfElse(StateNo = 610,640,650)) persistent = 0
[State -1, ChangeState] type = ChangeState triggerall = Var(59) && StateType = A trigger1 = (StateNo = [630,640]) && (MoveContact) value = IfElse(StateNo = 630,610,620)
this is basically universal for every marvel/capcom character. only 1 part which could be not compatible is super jump. it uses value=700 here, but some characters may use value=900 or a completely different one. so you might need to change it (if you not sure what im talking about, just put mugen in debug mode when testing character's new AI, and if you get an error messages "character changed to invalid state 700" you will need to search this "700" in the second text segment, and replace it with a proper super jump value for this character. if you dont know or cant find this proper value, just completely remove super jump part from 2nd text segment, this one:
Spoiler:
;Super Jump [State -1, Super Jump] type = ChangeState value = 700 triggerall = (StateType != A) && Var(59) && random < 200 trigger1 = (StateNo = 420) && (MoveHit = 1) trigger2 = (enemynear, Vel X >= 4) && ctrl
so, thats it for basic AI. in the next message i will describe how to put in AI specials/hypers
Last edited by BigPimp on January 28th 2021, 2:06 pm; edited 6 times in total
candido159, yolomate and Splash like this post
BigPimp
Posts : 782 Join date : 2012-05-01 Age : 33 Location : Russia
Subject: Re: Quick AI patch tutorial January 28th 2021, 4:18 am
this part is a little more difficult, since it requires more of a personal touch basically, there are 2 templates, 1 for specials, 1 for hypers. make sure you understand and can perform tutorial from the 1st message, before going to this one
so, here is a template for hyper:
Spoiler:
; mega beam [State -1, megaBeam] type = ChangeState value = 3000 triggerall = power >= 1000 && var(59) && ctrl && p2bodydist x > 100 triggerall = StateType != A && MoveType != H && RoundState = 2 trigger1 = enemynear, numproj = 0 && enemynear, movetype != A && random < 100
for it to work, you need to put it somewhere after [statedef -1] (just like 2nd text segment in 1st tutorial) preferably, i would suggest to put if AFTER AI guard states. just search for "Main Standing Special" in that 2nd text segment from the 1st tutorial. thats where you need to put you custom AI hypers and specials
but thats not it. as you may know, specials and hypers are not as universal, as basic moves. in each special and hyper you will need to edit at least 2 lines. 1st line is the most important, it refers to which hyper/special character will use. im talking about "value=3000" line. usually capcom/marvel character hypers are coded under 3000-4000 values. you will need to find exact correct values for each hyper for your character and edit value line for each hyper template you have copy-pasted. so if, lets say, character has 3 hypers, 1st is 3000, 2nd is 3100, 3rd is 3200, the code segment for working hypers will be:
Spoiler:
; mega beam [State -1, megaBeam] type = ChangeState value = 3000 triggerall = power >= 1000 && var(59) && ctrl && p2bodydist x > 100 triggerall = StateType != A && MoveType != H && RoundState = 2 trigger1 = enemynear, numproj = 0 && enemynear, movetype != A && random < 100
; mega beam [State -1, megaBeam] type = ChangeState value = 3100 triggerall = power >= 1000 && var(59) && ctrl && p2bodydist x > 100 triggerall = StateType != A && MoveType != H && RoundState = 2 trigger1 = enemynear, numproj = 0 && enemynear, movetype != A && random < 100
; mega beam [State -1, megaBeam] type = ChangeState value = 3200 triggerall = power >= 1000 && var(59) && ctrl && p2bodydist x > 100 triggerall = StateType != A && MoveType != H && RoundState = 2 trigger1 = enemynear, numproj = 0 && enemynear, movetype != A && random < 100
now, the second line you will need to edit in this template is "p2bodydist x > 100". basically it refers to, at what distance character AI will be able to use this hyper. edit it accordingly (meaning you want projectle hypers to be used from the distance, and close up hypers from upclose)
so, thats pretty much it. the only other line you might want to edit is "StateType != A". it means that character AI cannot use this hyper while in the air. you need to replace it with "StateType = A" if you coding a hyper, which can be used ONLY in the air. or remove "StateType != A && " completely, if we talking about a hyper which can be used BOTH from the air and from the ground. (in most cases those hypers still have different states, because of different animations, so you will probably just need to copy-past a separate template for air version of the same hyper)
putting in AI specials is pretty much the same, you just need to use this template instead:
Spoiler:
[State -1, beam] type = ChangeState value = 1000 triggerall = var(59) && ctrl && p2bodydist x > 100 triggerall = StateType != A && MoveType != H && RoundState = 2 trigger1 = enemynear, numproj = 0 && enemynear, statetype != A && random < 100
also. a little additional note here. "random < 100" refers to how often character will spam this special/hyper, the higher the number, the more often it will try to perform it. hypers will require 1000 power though, so just leaving them all at 100 is good enough in most cases and you can also add any custom triggers for any more complicated/unique specials/hypers. but that basic code provided by AvX/Project X template is good enough for most cases
Last edited by BigPimp on January 28th 2021, 4:58 am; edited 4 times in total
skhsato123, candido159 and Splash like this post
Shining
Posts : 4994 Join date : 2013-03-26 Age : 44 Location : Italy
Subject: Re: Quick AI patch tutorial January 28th 2021, 4:33 am
Interesting, useful post... I will try in my two face He needs AI
candido159
Posts : 1219 Join date : 2013-05-16 Age : 25
Subject: Re: Quick AI patch tutorial January 28th 2021, 9:28 am
Very helpful for some people who'd like to make full game. Maybe in the future I will and will definitely use this as guide thanks Bigpimp
crosspotts1.0
Posts : 4982 Join date : 2013-04-15 Age : 32 Location : GLEN BURNIE maryland
Subject: Re: Quick AI patch tutorial January 28th 2021, 1:03 pm
Archive this page some where here
volzzilla
Posts : 10259 Join date : 2012-05-02
Subject: Re: Quick AI patch tutorial July 1st 2022, 7:08 pm
@BigPimp so basically to patch a char like this, delete the current AI, and add these files like you mentioned.
any tips on the deleting old AI part you can add please?