UPLOAD, SHARE, PRESERVE MUGEN FOR ETERNITY! a missing category? request it here.

1. ## Editing already made AI to be more difficult, a few questions

Hey guys. I'm not a creator but I thought I'd take it upon myself to see if I could understand some of this code enough to tweak the AI of a character I like to see if it can be a bit tougher when fighting against other AIs. The character is Shiki-KOFM (Maybe an updated version, my folder says Shiki-KOFM2). Her AI is great already for a combo character but I wanted to see if I can change how often she does certain things.

I came upon this thread with a search: https://mugenarchive.com/forums/show...ctivation-code

The post that I've been trying to apply is here:
-
If you want change the difficulty of a character made for mugen 1.0+ you can use this code under the statedef -1:

;var(59) = AI variable
;var(50) = Difficulty variable

[State -1, AI ON]
Type = VarSet
TriggerAll = Var(59) < 1
TriggerAll = RoundState=2
Trigger1 = AILevel>0
v = 59
value= 1
Ignorehitpause=1

[State -1, AI OFF]
Type=VarSet
Trigger1=var(59)>0
Trigger1=RoundState!=2
Trigger2=!IsHelper
Trigger2=AILevel=0
v=59
value=0
Ignorehitpause=1

[State -1]
Type=VarSet
Trigger1=1
var(50)=(AILevel=1)*3+(AILevel=2)*7+(AILevel=3)*16 +(AILevel=4)*30+(AILevel=5)*58+(AILevel=6)*90+ (AILevel=7)*150+(AILevel=8)*300

This will be used to activate and deactivate the AI and to increase or decrease it's difficulty depending on the trigger used in every command.
Use "triggerall = var(59)>0" for the commands that you want the AI to utilize and "triggerall = var(59) = 0" for the commands that you want to be used only by the player.
To tell the CPU which difficulty level to utilize use "triggerall = random<var(50)*X". Where X is a number being multiplied by the var(50) which is our difficulty level variable. Generally you will want to use a number around 1.2 for the moves you don't want to see often and around 1.8 for the moves that will be executed a lot, thus increasing the difficulty of the character AI.
If the character already have an AI activation by human impossible commands just remove every one of these commands to use only what's needed, in this case this new method introduced in Mugen 1.0 which is easier to understand and to work with.
This way is similar to the one you wrote but easier to be implemented in almost any character.
-

So this is what state -1 looks like in Shiki-KOFM_AI. cmd, and what I'm assuming is a move after it:

[Statedef -1]

trigger1 = power >= 0
value = 1

;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;Aerial Cut 1
[State -1, Aerial Cut 1]
type = ChangeState
value = 1530
triggerall = var(59) != 1
triggerall = command = "Aerial-Cut-1"
triggerall = statetype = A
trigger1 = ctrl
trigger2 = stateno = 600
trigger2 = movecontact
trigger3 = stateno = 610
trigger3 = movecontact
trigger4 = stateno = 630
trigger4 = movecontact
trigger5 = stateno = 635
trigger5 = movecontact
trigger6 = stateno = 640
trigger6 = movecontact
trigger7 = stateno = 645
trigger7 = movecontact

(picked a smaller move to save post space)

So my question is, I wanted to ask you guys how I apply the post to this cmd file. After I put the code in the post after State -1, I wanted to ask where exactly I put triggerall = random<var(50)*X(With X as a number) in this cmd file. Are these move names with the triggers after it below state -1 where I put that, and changing X to 1.2 or 1.8 etc will affect how often she uses the move?

Any other ideas? Thanks. Sorry for the huge post.  Reply With Quote

2. ## Re: Editing already made AI to be more difficult, a few questions

Put after the value for changestate both activation and the move probability calculator, your move would look like this:

[State -1, Aerial Cut 1]
type = ChangeState
value = 1530
triggerall=var(59)>0
triggerall=random<var(50)*1.1
triggerall = statetype = A
trigger1 = ctrl
trigger2 = stateno = 600
trigger2 = movecontact
trigger3 = stateno = 610
trigger3 = movecontact
trigger4 = stateno = 630
trigger4 = movecontact
trigger5 = stateno = 635
trigger5 = movecontact
trigger6 = stateno = 640
trigger6 = movecontact
trigger7 = stateno = 645
trigger7 = movecontact

Yes, increase that value to increase how often it will perform that move.
Remember to remove any "command" from your AI code.
Also this thread will go to development help section.  Reply With Quote

3. ## Re: Editing already made AI to be more difficult, a few questions Originally Posted by Imperius Remember to remove any "command" from your AI code.
So I've noticed in your example you took out this line: triggerall = command = "Aerial-Cut-1"

So any of those lines in the code below state -1, right? I just wanted to make sure, since in other parts of this .cmd there are these examples of 'command' related lines:

[command] (example 1)
name = "AI2"
command = B,F,c+b,z,c+z,x,s
time = 1
[command]
name = "AI3"
command = B,U,a+b,y,c+y,s,z,D

---

[command] (example 2)
name = "Diabolic-Fire-2"
command = ~D,B,y
time = 15
[command]
name = "Diabolic-Fire-1"
command = ~D,B,x
time = 15

---

I'm only looking for these lines, right:

;Air Upper 1
[State -1, Upper 1]
type = ChangeState
value = 1100
triggerall = var(59) != 1
triggerall = command = "Upper-1" <---------- These kinds of lines
trigger1 = statetype = A && ctrl
trigger2 = stateno = 600
trigger2 = movecontact
trigger3 = stateno = 610
trigger3 = movecontact
trigger4 = stateno = 630
trigger4 = movecontact
trigger5 = stateno = 635
trigger5 = movecontact
trigger6 = stateno = 640
trigger6 = movecontact
trigger7 = stateno = 645
trigger7 = movecontact
trigger8 = stateno = 100

Also, thanks a lot for the help. I'll give it a go later, and thanks for moving it to dev help, wasn't sure where to put this initially.  Reply With Quote

4. ## Re: Editing already made AI to be more difficult, a few questions

Yes but only the ones in the state -1, the others on your example dont need to be changed.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•