Attempting to set up a basic attack that would force opponent to change state

Tutorials about compatibility, tools, etc

Moderator: Moderator

KotBehemot
Posts: 5
Joined: Wed Jun 15, 2022 8:28 pm

Attempting to set up a basic attack that would force opponent to change state

Post by KotBehemot »

Hello,

This is a character coding related question, so I hope folks here can help out.

I am trying to implement a new attack on a character (in this case, for Marasama). What the attack is supposed to do, is to place down a large hitbox for a number of frames, with hit opponents entering a specific state inherited from - simple pretty simple, right?

The attack is based on a simple animation that switches through basically two frames: 40 frame long one (that I eventually plan to give regular blue hitboxes, making for a vulnerable period) and 10 frame long one that is a giant red, to hit, hitbox.

Code: Select all

[Begin Action 5150]
0,0, 0,0, 40
Clsn1: 1
  Clsn1[0] = -208, -188, 214, 33
0,0, 0,0, 10, , S
0,0, 0,0, 40
Clsn1: 1
  Clsn1[0] = -208, -188, 214, 33
0,0, 0,0, 10, , S
0,0, 0,0, 40
So, the following is the Control Definition, pretty simple - activate the statedef 6170 after pressing "a":

Code: Select all

[State -1, Aura]
type = ChangeState
value = 6170
triggerall = command = "a"
trigger1 = ctrl
The following is the attack definition state:

Code: Select all

; Aura State
[Statedef 6170]
type     = S
movetype = A
physics  = S
ctrl     = 0
velset   = 0,0
anim     = 5150
sprpriority = -2

[State 6170, hit]
type = HitDef
trigger1 = AnimElem = 1
attr = S, NA          ;UŒ‚‘®«: ‚±‚ê‚Í Standing, Normal Throwi—§‚¿’ʏ퓊‚°j
hitflag = M-        ;‘ŠŽè‚ª‚â‚ç‚êó‘Ô‚Å‚Í‚È‚¢’nã‚ÌŽž‚Å‚µ‚©’Í‚ÞŽ–‚ªo—ˆ‚Ü‚¹‚ñ
priority = 5, hit    ;“Š‚°‚È‚Ì‚Å—Dæ“x‚ð’á‚­A‚©‚Âmiss‚©dodge‚Ì‘®«‚Å‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ
sparkno = 0          ;-1‚É‚•‚ê‚΃qƒbƒgƒXƒp[ƒN‚ª•\Ž¦‚µ‚È‚­‚È‚è‚Ü‚•
p2facing = 1  
pausetime = 0, 8
guardflag =         ;ƒK[ƒh‰Â”\
fall = 0         ;1‚É‚•‚ê‚ΑŠŽè‚ªƒ_ƒEƒ“ó‘Ô
kill = 0
hitonce = 0
p2stateno = 6171
animtype = light

[State 6170, LifeAdd]
type = LifeAdd
trigger1 = (AnimElem = 1 || AnimElem = 3 || AnimElem = 5 || AnimElem = 7 || AnimElem = 9 || AnimElem = 11 || AnimElem = 13 || AnimElem = 15)
value = -50
kill = 0

[State 1103]
type = TargetState
trigger1 = movehit>= 1
trigger1 = Numtarget
value = 6171

[State 6170, End]
type= ChangeState
trigger1= time = 440
value=0
ctrl=1
So, it's supposed to start, hit on at least 1st frame, remove life for testing every so often, and end 440 frames by going back to default neutral (in the future, also to be able to be flinched out of and from losing too much health).

In my testing, the state is entered, then is immediately left (Mara's state goes to 0 immediately, while the animation does not reset).

The following is the target's inherited state: Basically stand, go into an animation if specified one is available, and then get out after 90 frames.

Code: Select all

[Statedef 6171]
type    = S
movetype= H
physics = N
velset = 0,0
ctrl = 0

[State 6171]
type = ChangeAnim2
trigger1 = time = 0
trigger1 = SelfAnimExist(15200)
trigger1 = !SelfAnimExist(15600)
value = 15200

[State 6171]
type = ChangeAnim2
trigger1 = time = 0
trigger1 = !SelfAnimExist(15200)
trigger1 = SelfAnimExist(15600)
value = 15600

[State 6171]
type = ChangeAnim2
trigger1 = time = 0
trigger1 = !SelfAnimExist(15200)
trigger1 = !SelfAnimExist(15600)
value = 6621

[State 1081, 4]
type = Selfstate
trigger1 = time = 90
value = 0
ctrl = 1
Any idea why it might be failing? I can visually confirm, with debug that hitboxes intersect.

Please move this topic if it's in the wrong section.
UmbreonLover
Posts: 104
Joined: Wed Jan 26, 2022 12:03 am

Re: Attempting to set up a basic attack that would force opponent to change state

Post by UmbreonLover »

From my understanding, there are a few mistake that I'm simply seeing within your code, for starters;
I mark them with "***********************************" and ??? is simply because I don't know what's the move about,
or what's the main focus about.
► Show Spoiler
So why don't you try this code instead... Also? Anim = 5150 is either laying down, or flat dead to the floor lol
Don't know what animation number it is, but I will place it as "your number here"
► Show Spoiler
Again, from what I can understand from your coding, because I don't know what the move do, and what I did was simple.

When I press "A", The animation will play the "lying down" mode.
While in that State, I will begin to lose life for certain frames.
if X reason I hit my foe in the First frame
I will send my enemy to 6171 and
if I land the attack, or not; I will return to standing pose at the end of the animation cycle.

and your final code should be replace as:

------------victim-------------------
[State 1081, 4]
type = Selfstate
trigger1 = time >= 90
value = 0
ctrl = 1

in case X reason the timing went off by 1
KotBehemot
Posts: 5
Joined: Wed Jun 15, 2022 8:28 pm

Re: Attempting to set up a basic attack that would force opponent to change state

Post by KotBehemot »

Ah, I didn't notice that I was using an animation number that was specifically preset for an action. I switched the number of 280 for further use, since it it is actually supposed to be a "Standing Attack".

Losing life is intended - I am trying to use that to confirm that the character's state, is in fact, ongoing - rather than instantly stopping the moment he successfully connects with an attack.

Is the numtarget trigger used for anything under 1103 (sorry about the messy code headers)? Or should movehit be sufficient to affect any hit targets?

So, I have made the changes, but is still appears that no attacks connect, and the attacker immediately defaults to state 0, without playing the entire animation (which I did change to 280, just to clarify).

Current Code as Below:
► Show Spoiler
By the way, my basic understanding is to use hitdef's p2stateno to manually overwrite the victim's state with the attacking character's custom state, rather than a state that already exists with the victim character? Am I incorrect in this assumption? Also, should the AnimElem for HitDef be set to the exact frame where hitboxes are (In this case, every even frame), or only for the first frame?
UmbreonLover
Posts: 104
Joined: Wed Jan 26, 2022 12:03 am

Re: Attempting to set up a basic attack that would force opponent to change state

Post by UmbreonLover »

Using P2StateNo works perfectly fine for decent things, but if you want something more advances that involve multiple things, or activities, I would use TargetState instead. They both do the same, but function differently, in case your a little confused between them.

HitDef will always place victim's into a custom stateNo, if, there's any P2StateNo, or TargetState inside that StateDef. SelfState is the one that use their own StateNo and overrides any custom StateNo.

Yes, you should set each AnimElem hitbox number assign, but if you have too many, only using this Movehit = 0 covers any Hitbox animations without any worries towards the correct numbers.


NumTarget are used with NumProjID which are also known as Explod (NumExplod), reading the doc may help you understand more about it because it is a little complex for me to mention its function, but as I mentioned above; using MoveHit is a lot easier for people.
KotBehemot wrote: Thu Jun 16, 2022 3:51 pm So, I have made the changes, but is still appears that no attacks connect, and the attacker immediately defaults to state 0
Because you forgot to add the line I added which is:
ID = "your custom State Number" which was 6171
; <--- is a comment by the way
► Show Spoiler
If ID of HITDEF doesn't match with the ID that TargetState has, it will ignore it.
Keep in mind, if that Attack is a Projector (or a special move), it will keep hitting the victim (for each HITBOX) until the animation is completely finish
KotBehemot
Posts: 5
Joined: Wed Jun 15, 2022 8:28 pm

Re: Attempting to set up a basic attack that would force opponent to change state

Post by KotBehemot »

Thank you very much for your responses. Mugen's coding can be rather... cryptic, even with the selection of tutorials, both the ones that it came with and ones that can be found online.

I have made the changes you pointed out, but... it appears that the Attack State gets canceled immediately after the first tick (I can confirm that at least first frame happens, because I lose health when entering the state on the button press). Other character does not appear to be affected at all.

As part of the testing, I moved the hitbox from second Frame to the first one - and the hit does in fact happen! Except it appears that the target immediately enters state 5000 and gets out of it in the next Frame. I did note that p2stateNo does change the victim to the 6171: While just Hitdef's ID of 6171 or TargetState with same ID and Value do not. So, I am now able get to the second part: Victim interaction.

I still wish I knew why the attack gets interrupted after a single tick (animation is 440 ticks total, there are no hitboxes to cause flinching, tried ChangeState to trigger on AnimTime =0 and Time >= 440, hitonce = 0, ctrl = 0 so there shouldn't be overwriting), but at least I can somewhat continue.
► Show Spoiler
If I fail to achieve entirely what I wanted, it's not exactly end of the world - but it would be nice to figure out why the hell it keeps getting overwritten.

Once again, thanks for all the help!
UmbreonLover
Posts: 104
Joined: Wed Jan 26, 2022 12:03 am

Re: Attempting to set up a basic attack that would force opponent to change state

Post by UmbreonLover »

You are very welcome, but my first mistake is not asking you what version of mugen your using lol
  • 1.0 & 1.1B both work kind of the same, but work differently.
  • kemono works a lot more differently and some of the coding for Mugen; doesn't work.
I would have to see the following thing:
---------------------------------------------------------------------------------
  • Either a video of the full animation that shows the move or move's
    or
    The Action codes who performances the animation (both players and victim)
  • Mugen Version Number, or if its Kemono
Example of Action Code (Animation number):
► Show Spoiler
From there, I can assist a lot better, on knowing:

how long the animation is
where each HitBox and DefBox
while the victim time for recovery animation

Because SelfState for the victim is a bit hard to tell how long it should return to normal.
Time >= 90 does happen quick, and I think its a second, or less than a second lol
KotBehemot
Posts: 5
Joined: Wed Jun 15, 2022 8:28 pm

Re: Attempting to set up a basic attack that would force opponent to change state

Post by KotBehemot »

Sorry for taking so long to respond. I am using 1.1 version right from HCM.

Here is the animation code:
► Show Spoiler
UmbreonLover
Posts: 104
Joined: Wed Jan 26, 2022 12:03 am

Re: Attempting to set up a basic attack that would force opponent to change state

Post by UmbreonLover »

So I managed to fix the small issues you had in the coding, thanks to my buddy Mizu The reason why your victim was coming out so quickly was because of P2StateNo = ***.
If you use ID, that victim wouldn't come out until the animation has ended, but Mizu made
two different coding that works almost the same as using it with the ID.

A REMINDER
I know I sounds like a broken record, but remember to replace all:
  • "your number here"
The code has been tested by both me and him, and work perfectly.
Look carefully on how its written, because something simple might be missed seen lol
► Show Spoiler

For the victim StateDef:
► Show Spoiler
KotBehemot
Posts: 5
Joined: Wed Jun 15, 2022 8:28 pm

Re: Attempting to set up a basic attack that would force opponent to change state

Post by KotBehemot »

Hey, thanks for the code examples. Sadly, despite my best attempts, I couldn't find too much difference from what I am currently using and also, any difference in effect from what I currently got working. The issue isn't that the victim escapes the attack - it's that if the attack has the hitbox on the second frame, it never gets to it, because the Attack computes the first frame, and then immediately stops. That, is my biggest issue at the moment, and I am sorry if that wasn't clear.

So, what would cause the attack to just stop? Lack of defined animation (there is an animation that used to play before hits finally started to register)? Hitonce is set to 0, so that shouldn't interrupt it to my best understanding. ChangeState should only start if animation is over, and I know for sure that the animation is set as 280, is 440 ticks long, and should disable ctrl, so it shouldn't be instantly overwritten. Am I missing anything else?

Also, I assume MUGEN doesn't have any ability to set up a sprite by raw data? I just realized that since some victim animations used inexplicably lowered in their origin point. Or should I hope that binding the target might be the best approach?
UmbreonLover
Posts: 104
Joined: Wed Jan 26, 2022 12:03 am

Re: Attempting to set up a basic attack that would force opponent to change state

Post by UmbreonLover »

KotBehemot wrote: Thu Jun 23, 2022 9:00 pm Hey, thanks for the code examples. Sadly, despite my best attempts, I couldn't find too much difference from what I am currently using and also, any difference in effect from what I currently got working. The issue isn't that the victim escapes the attack - it's that if the attack has the hitbox on the second frame, it never gets to it, because the Attack computes the first frame, and then immediately stops. That, is my biggest issue at the moment, and I am sorry if that wasn't clear.

So, what would cause the attack to just stop? Lack of defined animation (there is an animation that used to play before hits finally started to register)? Hitonce is set to 0, so that shouldn't interrupt it to my best understanding. ChangeState should only start if animation is over, and I know for sure that the animation is set as 280, is 440 ticks long, and should disable ctrl, so it shouldn't be instantly overwritten. Am I missing anything else?

Also, I assume MUGEN doesn't have any ability to set up a sprite by raw data? I just realized that since some victim animations used inexplicably lowered in their origin point. Or should I hope that binding the target might be the best approach?
Mugen is extremely limit, and most of the codes doesn't work, or is never read in time.
Now, about the second frame, the reason it skips that frame, or immediately stops is due to Pausetime = 0, 8 and
how the code is setup after the attacked land. This may also fall under animation as well, but again; its hard to
pinpoint anything with just words.

if you set Pausetime = 0, 0, all the frames in that animation that contains a hitbox will land them all...
However, using the P2StateNo line will block it from ever completing all hitbox animations (in other words,
some frames will be skipped).

Remember that attacks are purely related to animation, and if it lacks? it may look bad, or issues may appear.

Mugen doesn't have a way, nor an ability to read the raw data of sprites. The best way to go is using bind the target,
or manually setting the X and Y pos. Keep in mind that all charactes comes in different side and shape. So, there
will never be a "perfect alignment code" for all chars.
Post Reply