Transition not working from EOnBlocking

Problem Description

I’m working on creating a counter move for a character, as advised in the old website tutorial I made it into two states (and then had to update the code to current engine standard). First state blocks and if there’s an attack it actually blocks it will transition into the next state. Second state does the attack.

My current hang up here is that the transition simply isn’t working. I’m using EOnBlocking to make sure it only happens in response to an attack, and I know EOnBlocking functions because the log statement I put there goes through on block, but not the transition.

My transition works just fine when I put it into the F branch, but then it happens right away regardless of if there’s an attack to block. But it does show that the failure point isn’t in the second state, it’s somewhere in this one.

Code:

AttackRegister(Special)

# Adjust parameters here

F1-90:
    # Can use Guard-All if you don't need to discriminate against a specific one, but here we want to be vulnerable to  throws.
	Flag(CanBlock)
	Flag(Blocking)
    Flag(CanBlock-All)
	Flag(Blocking-All)
	Log(ItWorks)
endif


# Check if we got hit, and thus transition into the counter.
EOnBlocking:
AttackRecievedGetParam(Damage, MyCoolVariable)
 Log(Confirmed Counter)
  Transition(CounterConfirmed)
endif

The variable stuff is because the attack is meant to inflict the same amount of damage as what it counters. I tried removing the variable update and making the transition the only thing after EOnBlocking but that didn’t work, neither did changing the indentation.

Technical Info

Castagne Version: 0.57
Host Engine: Godot
Genre: 2D Fighter / 2.5D Fighter

Hello! Welcome to the forum Warthog.

The issue here is in the transition: another transition has been done before by the engine, which takes priority (the second argument). The hitstun / blockstun has a high priority in order to avoid bugs where you ignore a hit because you returned to neutral or similar on the same frame.

If you look at the decompilation tool, the code actually executed during the OnBlocking event becomes clear (I’ve highlighted the line where the blockstun transition happens):

The fix is simple: just add a priority that is higher than the priority of the blockstun transition:

Transition(CounterConfirmed, 100000)

This should make your counter work as expected!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.