AI Problem: Cannot Activate Next State from within Current State.

Started by Nocturnis, August 27, 2022, 07:29:07 PM

Previous topic - Next topic

Nocturnis

Here's the issue: I want the AI to activate state 196. Done. I want it THEN to activate state 198 while IN state 196 and I'm lucky I'm already bald cause I'd be pulling my hair out by now. It isn't working in the many forms of code I've tried. Below is the most basic.

[State -1, AI - Taunt: Red Charge]
type = ChangeState
value = 196
triggerall = var(7) = 1
trigger1 = statetype != A
trigger1 = ctrl
;The remarked lines are just situational. It's been taken out in order for me to see the move in raw form. It still fails with
;these triggers.
;trigger1 = life > 600 
;trigger1 = p2life > 500
;trigger1 = power < 2000
;trigger1 = p2bodydist X >= 25
;trigger1 = (p2stateno = [5050,5210]); && (p2stateno = [5200,5210])
;trigger1 = random < 900

[State -1, AI - Taunt: Red Charge, Charging]
type = ChangeState
triggerall = var(7) = 1
trigger1 = statetype != A
trigger1 = stateno = 196
value = 198
trigger1 = ctrl


The PLAYER activates this mode by pressing F+S (to enter the initial state) and then pressing and holding Y+B. Not sure if that matters in this case.

PlasmoidThunder

Does the character have ctrl in state 196? I ask because you're checking for it in the 198 ChangeState.

Quote from: Iced on July 24, 2013, 01:25:14 AM
Oh, I want a diagram. I fucking love diagrams.

Nocturnis

No the player doesn't have control.

I kept running into issues where without the check, the AI would go, "Okay do this" and initiate frame1 of the state so fast over and over again, it made a disco lightshow. Right now I've put a bandaid on the problem by adding the following to the changestate of 196:

trigger2 = var(7) = 1
trigger2 = command ="holdby"
trigger2 = ctrl = 0


It's... sort of working.

Am I overusing control checks for the AI in this case? I've also got an issue where teleports and other moves are just cancelling out other moves that they shouldn't. I definitely haven't got a full grasp of AI coding, so it wouldn't surprise me if I made a stupid mistake like that. :lol:

Thanks for the reply, by the way.

Edit: I'll just mark this as solved, I guess. It's SORT of working now.

PlasmoidThunder

Ideally the A.I. should be bound by the same triggers as the human player, just instead of commands, you specify when it should use the attack.

Quote from: Iced on July 24, 2013, 01:25:14 AM
Oh, I want a diagram. I fucking love diagrams.