Implementing Close Normal attacks

Started by DestinNotDustin, May 11, 2019, 02:18:55 AM

Previous topic - Next topic

DestinNotDustin

Using base Kung Fu Man as the example. I am having difficulty implementing close range normal attacks where Kung Fu Man performs a unique jab when close to an opponent. What command would I implement in the CMD file to resolve this?

Nep Heart

 You would need a trigger based on distance between p1 and p2 in conjunction of a cond for changestate in statedef -1.

An example in one of my characters to perform a close and mid version of an attack using the same exact command would look something like this.

value = cond((p2dist x <= 40),210,220)

if P2 is within 40 pixels of P1, this command sends P1 to state 210 (aka: the close version), while if too far will send P1 into state 220 instead.

DestinNotDustin

I would implement the value in the CMD of Kung Fu Man? Would it resemble something like this?

[Command]
name = "a"
command = a
time = 1
value = cond((p2dist x <= 40),210,220)

Nep Heart

 No, that's for the command. You want to do that for the changestate in statedef -1, the command stays the same no matter what.

[State -1, Medium Attack]
type = ChangeState
value = cond((p2dist x <= 40),210,220)
triggerall = !ishelper
triggerall = statetype != A
triggerall = command = "y"
trigger1 = ctrl
trigger2 = stateno = 200
trigger2 = movecontact
trigger3 = stateno = 300
trigger3 = movecontact
trigger4 = stateno = [300,315]
trigger4 = movecontact

Either way, mine is just an example of two different states that are entered depending on distance from P2. You can switch it out with any value depending on what you have set as your close range and mid range versions of the same button. Say if you have close range being state 200 and ranges outside of say... 80 pixels go into state 250, it would look like this instead.

cond((p2dist x <= 80),200,250)

Also, I would strongly recommend studying the cond trigger, it's extremely useful for simplifying multiple choice stuff like this.

DestinNotDustin

This is what I have thus far;

[Statedef 200]
type = S
value = cond((p2dist x <= 50),200)                     
movetype= A                     
physics = S                     
juggle = 1                     

I have two Statedef 200s, just one has the 'value' condition. Thank you for your time and continued patience, coding is a struggle for me.       

Nep Heart

 If you're a beginner, I would recommend studying the documents that come included with default MUGEN since they break down all the basics like state controllers and triggers that you'll be able to memorize with enough practice. KFM himself also comes with small hints in his codes that will give simple instructions on how these concepts work as well, so, you should read those tips in his CNS as well.

DestinNotDustin

Read and reread what you said and I believe I'm onto something! Downloaded your Haruhi Suzumiya and peeked at her Normals.cns to get a better understanding on how to implement Close attacks.

200 statedef is St. LP
205, I labeled at St. CLOSE LP

Now my code resembles this;
Spoiler (click to show)

St. CLOSE Light Punch

[State 205, 2]
type = PlaySnd
trigger1 = Time = 1
value = 0, 0

[State 205, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = cond((p2dist x <= 50),200,205)
ctrl = 1
Appreciate the help :)