News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

problem with A.I

Started by ManofSteel II, April 15, 2008, 02:59:58 AM

Previous topic - Next topic

ManofSteel II

Its my first time coding A.I and I keep getting this problem where my character will change states half way through an attack or some other action

I'm using the Impossible command style and this is how some of it looks

[State -1,AI Homing Attack]
type = ChangeState
triggerall = var(20) = 1 ;It executes if it detects CPU control. In plain terms, "If Variable 20 is equal to 1".
triggerall = movetype != H ;This prevents the mistake of the CPU " " while currently being hit!
triggerall = statetype != L ;This prevents the mistake of the CPU " " while currently lying down!
triggerall = P2life != 0 ;This prevents the mistake of the CPU " " when the enemy is already dead!
triggerall = Time > 25
trigger1 = statetype = S && alive && Random <= 35 && p2bodydist x >= 15
trigger1 = ctrl && roundstate != 3
value = 6100 ;Guy's " " stateno (state number). You can change this to your character's taunt stateno.

[State -1,AI Spin Dash]
type = ChangeState
triggerall = var(20) = 1 ;It executes if it detects CPU control. In plain terms, "If Variable 20 is equal to 1".
triggerall = statetype != A ;This prevents the mistake of the CPU taunting in mid-air!
triggerall = movetype != H ;This prevents the mistake of the CPU taunting while currently being hit!
triggerall = statetype != L ;This prevents the mistake of the CPU taunting while currently lying down!
triggerall = P2life != 0 ;This prevents the mistake of the CPU taunting when the enemy is already dead!
trigger1 = (P2statetype = S) && Random <= 50 && p2bodydist x <= 10
trigger1 = ctrl = 1
value = 310 ;Guy's " " stateno (state number). You can change this to your character's taunt stateno.

[State -1,AI Spin Charge]
type = ChangeState
triggerall = var(20) = 1 ;It executes if it detects CPU control. In plain terms, "If Variable 20 is equal to 1".
triggerall = movetype != H ;This prevents the mistake of the CPU taunting while currently being hit!
triggerall = (P2statetype = S)
triggerall = (P2statetype = C)
triggerall = statetype != L ;This prevents the mistake of the CPU taunting while currently lying down!
triggerall = P2life != 0 ;This prevents the mistake of the CPU taunting when the enemy is already dead!
trigger1 = Random <= 55 && p2bodydist x >= 15
trigger1 = ctrl = 1
value = 300 ;Guy's " " stateno (state number). You can change this to your character's taunt stateno.

Cyanide

You have ctrl = 1 in all of those so those one's won't be occuring. Take note of which ones are, and attempt to do it yourself. As in check the state numbers AND your commands for correctly set ctrl.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

ManofSteel II

#2
I don't understand

do you mean ctrl should equal 0 or that it depends on the state their in?

Cyanide

Those 3 states will not cause problems. They specifically ask that you have control so they should not be executable when in the middle of any other state.

What you have to check for.

Changestates in the cmd that are not checking for ctrl (or look for !ctrl)
states in the .cns where ctrl = 1

Hence you should try to do some of what the CPU does yourself. You could have coded something badly.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

ManofSteel II

I checked the Ctrl for each command and everything seems to be working, but now i'm getting another problem

it doesn't happnen all the time but when he's standing, he'll sometimes slide instead of going to a walk or run animation