YesNoOk
avatar

Custom AI Trigger Help: Enemynear (Read 503 times)

Started by Shado_Onikisu, July 13, 2012, 10:58:30 pm
Share this topic:
Custom AI Trigger Help: Enemynear
#1  July 13, 2012, 10:58:30 pm
  • *
  • My Status: A Novice AI Patcher and Char Editor
i Hope I'm Asking this Question in the right section.

Could anyone Please Explain to me about This trigger "Enemynear" and if these codes below are coded good enough that my AI will timed it correctly when he uses this move.


This is the Explosion Punch code i made For Mugenhunter Knuckles which is One of his Supers (you Know That Really Slow Fire Punch Move).

 i wanted knuckles to use it when someone is jumping towards him and so if he timed right the punch would land directly on his opponent when they land in front of him whether his enemy attack or not. i put the EnemyNear trigger in here and it look like it work, but now im confused about it because he used it a few times when his enemy was not in the air.

HELP PLZ
 


; Explosion Punch AI
[State -1, Explosion SDM/DM]
type = ChangeState
Value = ifelse(power>=2000,3030,3020)
TriggerAll = var(59)
triggerall = !Win
triggerall = power>=1000
triggerall = StateType != A
TriggerAll=Ctrl||(stateno=[19,21])||(stateno=100&&time>5)||stateno=101||(stateno=[120,149])
TriggerAll=(P2BodyDist X+(EnemyNear(floor(fvar(36))),Vel X*3))=[42,57]
TriggerAll=(P2BodyDist Y+(EnemyNear(floor(fvar(36))),Vel Y*2+EnemyNear(floor(fvar(36))),Const(Movement.YAccel)*2)*(P2StateType=A&&EnemyNear(floor(fvar(36))),Vel Y >=1))>-100
TriggerAll=EnemyNear(floor(fvar(36))),MoveType=A
TriggerAll=EnemyNear(floor(fvar(36))),stateno!=[5000,5999]
TriggerAll=Random<=var(59)*100||var(59)>9
TriggerAll=EnemyNear(floor(fvar(36))),AnimTime<=-3||var(59)<7
TriggerAll=EnemyNear(floor(fvar(36))),Time>=30||(!Time&&var(59)>9)||var(59)>10
Trigger1 = EnemyNear(floor(fvar(36))),Time>=50||var(59)>=11
Trigger2 = (PrevStateNo=[5000,5270])
Trigger3 = (PrevStateNo=[120,159])

; Explosion Punch AI
[State -1,Explosion SDM/DM]
type = ChangeState
Value = ifelse(power>=2000,3030,3020)
triggerall = var(59)&&(Random<=var(59)*100)
triggerall = RoundState = 2
triggerall = StateType != A
triggerall = EnemyNear(floor(fvar(36))),StateType != L
Triggerall = !inguarddist
triggerall = power >= 1000
TriggerAll=(P2BodyDist X+(EnemyNear(floor(fvar(36))),Vel X*3))=[42,57]
TriggerAll=(P2BodyDist Y+(EnemyNear(floor(fvar(36))),Vel Y*3+EnemyNear(floor(fvar(36))),Const(Movement.YAccel)*6)*(P2StateType=A&&EnemyNear(floor(fvar(36))),Vel Y >=1))=[-100,-46]
triggerall = Ctrl||(stateno=[19,21])||(stateno=100&&time>5)||stateno=101||stateno=0||(stateno=[120,149])
trigger1 = EnemyNear(floor(fvar(36))),MoveType = H
trigger1 = (EnemyNear(floor(fvar(36))),StateNo != [120,159])

; Explosion Punch AI
[State -1,Explosion SDM/DM]
type = ChangeState
triggerall = var(59)
triggerall = StateType != A
triggerall = EnemyNear(floor(fvar(36))),StateType != L
Triggerall = !inguarddist
Triggerall = Random <= var(59)*100
TriggerAll=(P2BodyDist X+(EnemyNear(floor(fvar(36))),Vel X*3))=[42,57]
TriggerAll=(P2BodyDist Y+(EnemyNear(floor(fvar(36))),Vel Y*3+EnemyNear(floor(fvar(36))),Const(Movement.YAccel)*6)*(P2StateType=A&&EnemyNear(floor(fvar(36))),Vel Y>=1))=[-100,-56]
triggerall = Ctrl||(stateno=[19,21])||(stateno=100&&time>5)||stateno=101||(stateno=[120,149])
triggerAll = power >= 1000
TriggerAll = EnemyNear(floor(fvar(36))),AnimTime <= -3
triggerAll = EnemyNear(floor(fvar(36))),MoveType = I
TriggerAll = EnemyNear(floor(fvar(36))),stateno!=[5000,5999]
triggerall = EnemyNear(floor(fvar(36))),StateType = A
Trigger1 = EnemyNear(floor(fvar(36))),MoveType = H
Trigger1 = !EnemyNear(floor(fvar(36))),Ctrl
Value = ifelse(power>=2000,3030,3020)





Re: Custom AI Trigger Help: Enemynear
#2  July 14, 2012, 12:58:24 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
What on EARTH are you doing?

(P2BodyDist Y+(EnemyNear(floor(fvar(36))),Vel Y*2+EnemyNear(floor(fvar(36))),Const(Movement.YAccel)*2)*(P2StateType=A&&EnemyNear(floor(fvar(36))),Vel Y >=1))>-100

What sort of bullshit is this? This looks like a load of equations for the hell of it. I'm not going to speculate on why you're flooring a floating variable in order to achieve an integer value. I mean, you'll only ever be trying to attack enemynear(0) anyway so what's a variable value for. And... if that fvar is ever above 2, the code is going to debug badly.

triggerall = p2statetype = A && p2bodydist = value of some sort, you choose && enemynear(0), vel Y>= some other value indicating a standard period of time for them dropping

3 triggers, no insane calculation and it's readable.

Reading more of that, this is fucking BROKEN anyway. Look at this

(!Time&&var(59)>9)||var(59)>10
Var 59 can reach a value of 10 or more.
Random<=var(59)*100
Anything above about 200, the AI will spam when it gets a chance, you bring that up to 100% chance. Worst choice for anything in an AI ever. The only limiter is it needs power. Basically, if you didn't code this AI, be happy. If you did, ick. AI should not include this much bullshit. It's simple situations for when you want your character to do something. It gives the character more choices, being really prescriptive about what and when actually makes it too predictable.


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.
Re: Custom AI Trigger Help: Enemynear
#3  July 14, 2012, 02:07:26 am
  • *
  • My Status: A Novice AI Patcher and Char Editor
Well ive kinda made this code by looking at ABAB's AI method and how he codes his Character's AI.

Anyways lets just cut all that other crap out and just look at this below

TriggerAll=(P2BodyDist X+(EnemyNear(floor(fvar(36))),Vel X*3))=[42,57]

TriggerAll=(P2BodyDist Y+(EnemyNear(floor(fvar(36))),Vel Y*2+EnemyNear(floor(fvar(36))),Const(Movement.YAccel)*2)*(P2StateType=A&&EnemyNear(floor(fvar(36))),Vel Y >=1))>-100

you said " some other value indicating a standard period of time for them dropping"


that is what im really trying to do. Im trying to tell the AI to Attack when his opponent coming down and towards him at a certain speed, distance, and Height. the "(EnemyNear(floor(fvar(36)))" Bullcrap was put in there because i thought it needed to be and i don't know the proper way of typing it all in correctly so that Mugen can read and i don't get "error has occur Parsing Bullshit Bullshit Bullshit".   My current AI as of right now will always uses this move when he is going up, down, flying backwards, or going behind him. 


Oh yea the reason why This --->Random<=var(59)*100  was turn up so high is because thats how i test my AIs. I let it Spam the Move to see how is he gonna use it and if the X and Y Bodydist are Correct then when im done i toned it down so it won't be too predictable. i didn't think no one would look at that.



This----> var(59)>10 i don't know what it does. I thought it helped with the random. ^^ :???:

Re: Custom AI Trigger Help: Enemynear
#4  July 14, 2012, 02:15:11 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
You just need to do a small amount of calculation, not point going overboard as most characters have varying jump's anyway, your value can't be all encompassing. So, general jump speed is -8 to -9

Assume they're about to start coming down, if vel Y is > -3 they're reaching the peak of their jump. You could insist that p2stateno < 1000 to be relatively sure they're not doing a special attack of some sort.

I don't know how long your special move takes to come out though so i'm guessing. You may want to increase the vel Y value to tweak it. Code doesn't need to be almost unreadable to work, especially not in AI, that's all just silly.


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.
Re: Custom AI Trigger Help: Enemynear
#5  July 14, 2012, 08:32:17 pm
  • *
  • My Status: A Novice AI Patcher and Char Editor
ok i went back and did some testing, but didn't get no good results

should this code do fine?

; Explosion Punch AI
[State -1,Explosion SDM/DM]
type = ChangeState
Value = ifelse(power>=2000,3030,3020)
triggerall = var(59)
triggerall = !Win
triggerall = power >= 1000
Triggerall = !inguarddist
triggerall = StateType != A
triggerall = P2Bodydist Y <= -50
triggerall = P2Bodydist X <= 30
triggerall = StateType = S
triggerall = P2StateType = A
Triggerall = Random <= var(59)*30
triggerall = enemynear,vel X >= 3 ||  enemynear,vel Y >= 3
trigger1 = ctrl

The move that im coding Right now is Mugenhunter Knuckles Explosion Punch Super.

Re: Custom AI Trigger Help: Enemynear
#6  July 14, 2012, 11:46:32 pm
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
You may find a positive 3 to be too little time. What results are you getting. "Not good" is not a correct answer. You have him do the move and see how long it takes to come out. You then work out how long p2 GENERALLY needs to drop to the floor. You then speculate on velocity based on that.

Trial and error. And the way it's set now you can at least DO trial and error and change a single value to tweak.


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.