546 - bombShield(int a, int script)


Sets the bomb invulnerability flag (a=0 false, a=1 true), the caller's ANM script will change to script when a bomb is active.

611 - etEx(int etId, int async, int type, float a, float b)


Adds bullet transformation to bullet manager etId, Transformation of flag type determines the specific behaviour of the bullet. Documentation can be found here.

BulletEffectType-67108864 - etExDelay(string et, string isAsync, string time)


Hide the bullet for time frames. During this time, it will not move, will be invisible and won't have a hitbox. If used as a first transformation, can be used to delay when the bullet actually appears.

6 - isDelayedSpawn


While this flag is set, the bullet will be invisible and not have a hitbox. This flag is cleared once the delay timer ends.

4 - short_timer


Integer value between -1 and 15 inclusive (by default -1). If non-negative, shooters using short_timer shoot their bullets and timer increments by 1 per frame until 15 is reached. Once 15, timer reset to -1 or 0 depending on Z key state.

5 - long_timer


Integer value between -1 and 120 inclusive (by default -1). If non-negative, shooters using long_timer shoot their bullets and timer increments by 1 per frame until 120 is reached. Once 120, timer reset to -1 or 0 depending on Z key state.

503 - flagClear(int n)


Clears flag(s) according to n. Refer to the flag table here for exact values.

91 - floatTime(int slot, float var, int time, int mode, float start, float final)


In time frames using mode mode, variable var changes from start to final. slot is used to set the slot to be used by this ins, every enemy has 8 slots.

-9980 - F1


Local float variable, inherited by spawned enemies.

-9984 - I1


Local integer variable, inherited by spawned enemies.

-9989 - ANGLE_PLAYER


Angle from the enemy to the player.

-9962 - BOSS_Y


Final Y position of the boss.

-9990 - PLAYER_Y


Player's Y position.

-9963 - BOSS_X


Final X position of the boss.

-9991 - PLAYER_X


Player's X position.

81 - circlePos(float varX, float varY, float angle, float radius)


Performs following operation: varX = cos(angle) * radius and varY = cos(angle) * radius

-9981 - F0


Local float variable, inherited by spawned enemies.

300 - enmCreate(string sub, float x, float y, int hp, int score, int item)


Creates an enemy using subroutine sub at coordinates (x, y) (relative to position of the parent), health of created enemy is hp, score bonus is score and item drop is item.

601 - etOn(int etId)


Shoots bullet(s) using properties from bullet manager etId.

23 - wait(int time)


Stops sub execution for time frames.

1 - delete()


Returns to the top of current call stack.

2 - GAME_SPEED


The value controls by how much faster the game speed is run. This variable is often set to a number between 0 and 1. This value is often changed when a (final) boss dies or when a photo is taken. Its default value is 1.

-9985 - I0


Local integer variable, inherited by spawned enemies.

-9983 - I2


Local integer variable, inherited by spawned enemies.

-9982 - I3


Local integer variable, inherited by spawned enemies.

-9954 - ENEMY_HP


Enemy's current HP.

3 - goheiExists


A flag that determines if a gohei exists on-screen or not. Flag is set to true by active gohei. Flag is set to false if gohei goes off-screen or is despawning.

-9926 - GI0


Global integer value. Value is initialised to 0 on stage load but not on stage reset.

-9925 - GI1


Global integer value. Value is initialised to 0 on stage load but not on stage reset.

-9924 - GI2


Global integer value. Value is initialised to 0 on stage load but not on stage reset.

-9923 - GI3


Global integer value. Value is initialised to 0 on stage load but not on stage reset.

17 - distortion(int a)


Triggers distortion effects on the edge of the screen. The meaning of the argument is not entirely clear. SA uses a value of 1 to create distortion at the bottom of the screen, while UFO uses this same value to create distortion at the top.

539 - spell3(int id, int timeRate, int unused, string name)


Declares a spell-card with id id and name unused. The ID passed to the spell-creating function is id + difficulty - 2 (with easy=0, normal=1, ..., overdrive=5). timeRate determines how much time the spell circle takes to shrink (in frames), as well as how fast the spell bonus decreases.

514 - setInterrupt(int slot, int hp, int duration, string subroutine)


Sets an interrupt on slot slot. Once caller's HP reaches hp or duration frames have passed since this instruction was called, the caller will terminate all subroutines it's currently running and execute subroutine subroutine.

270 - enmCreate270(string sub, float x, float y, int hp, int score, int item)


Creates an enemy using subroutine sub at coordinates (x, y) (relative to position of the stage background camera), health of created enemy is hp, score bonus is score and item drop is item.

115 - timer_callback_threshold(int time)


Calls the callback function timer_callback_sub after time frames have passed.

10022 - SELF_TIME


Integer value that increases by 1 every in-game frame. This value is used by bosses and by functions such as timer_callback_threshold.

7 - has_been_inbounds


This flag is set when the enemy has been within bounds. The default value is false.

8 - is_in_bounds


This flag is set when the enemy is currently within bounds. This flag is false if it is out of bounds.

Frame Perfect Attack Skip


Specifications


  • Versions: 1.00 - 1.01 - 1.02 - 1.02a - 1.02b - 1.02c - 1.02d - 1.02e - 1.02f - 1.02h
  • Difficulty: Easy - Normal - Hard - Lunatic - Extra
  • Mode: Main game - Practice mode
  • Shottype: ReimuA - ReimuB - MarisaA - MarisaB

What happens


The player must trigger this glitch on a non-spell for it to have any effect. This glitch can be done on all non-spells as well as some spells. Usually, the subsequent spell is skipped but in few cases the effect is different:

If done on Cirno's second non-spell, all her subsequent spells are skipped and the fight ends.
If done on Meiling's third non-spell, all her subsequent spells are skipped and the fight ends.
If done on Remilia's fourth non-spell, the subsequent spell is skipped, but the final spell-card is not skipped. Instead, the player faces the final spell-card "Red Magic", regardless of difficulty. This means it is possible to face Red Magic on Hard and Lunatic mode.

On top of this, it is also possible to do execute this glitch on the spells Meiling's third spell and Cirno's second spell.

How it happens


The player must end the attack exactly during the last frame of the attack, meaning it is a frame-perfect skip. This only works on attacks where the attack is a non-spell or Meiling's third spell or Cirno's second spell.

Why it happens


During a bossfight the player can go from one boss attack to another boss attack through different ways. Those different ways are by attacking or by timing out the pattern. In either case, the boss calls for a callback function.

Callback functions


A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.

Almost all bosses in EoSD use three different types of callback functions that are all relevant to this glitch:

  1. The life_callback_sub(func), which is triggered when the boss reaches a pre-determined HP threshold,
  2. The timer_callback_sub(func), which is triggered when the timer reaches 00s.
  3. The death_callback_sub(func), which is triggered when the boss reaches an HP threshold of 0 HP.

All three callback functions take a subroutine func as an argument. Once the condition of the callback function is met, then the game jumps to the function func.

For example, if Remilia's first non-spell is timed out, the timer_callback_sub is called. If enough damage has been dealt to Remilia's first non-spell, the life_callback_sub is called. If I capture Remilia's first spell-card, her death_callback_sub is called since she reaches 0 HP.

Example


Below is a real example of the code of Rumia's first non-spell and Rumia's first spell-card. Any code that doesn't contain the three above mentioned callback functions is removed for simplicity.

  • sub11 - Rumia's 1st non-spell
  • sub16 - Rumia's 2nd non-spell
  • sub22 - Rumia's 1st spell-card
void sub11(int IPAR, float FPAR) {
    [...]
    death_callback_sub(sub16);
    {"NHL"}:  life_callback_threshold(900);
    {"NHL"}:  life_callback_sub(sub22);
    timer_callback_threshold(2100);
    timer_callback_sub(sub22);
    [...]
}
void sub22(int IPAR, float FPAR) {
    timer_callback_threshold(1500);
}

We start off on Rumia's first non-spell (sub11).

Suppose you timeout Rumia's first non-spell. The following happens:

  • If 2100 frames have passed since the start of the non-spell, then Rumia "starts at" sub22, which is her first spell-card. The line timer_callback_sub(sub22) is triggered. This applies to all difficulties, even though this is a bug.

Suppose you shoot down Rumia's first non-spell. The following happens:

  • On Easy, if Rumia's HP is 0 HP, then Rumia "starts at" sub16, which is her second non-spell. The line death_callback_sub(sub16) is called.
  • On Normal/Hard/Lunatic, if Rumia's HP is 900 or less, then Rumia "starts at" sub22, which is her first spell-card. The line life_callback_sub(sub22) is called.

Now let us see what the code does on Rumia's first spell-card.

Suppose you timeout Rumia's first spell-card. The following happens:

  • If 1500 frames have passed since the start of the non-spell, then Rumia "starts at" sub16, which is her second non-spell. The line timer_callback_sub(sub16) is called*.

Suppose you shoot down Rumia's first non-spell. The following happens:

  • If Rumia's HP is 0 HP, then Rumia "starts at" sub16, which is her second non-spell. The line death_callback_sub(sub16) is called.

Explanation


Though, in the codeblock of void sub22, there are no callback functions to be found, so how does that explain the previous paragraphs ? Since the callback functions aren't overwritten, the game inherits the callback functions from the previous function. In this case, the callback function death_callback_sub(sub16) is also applied to the subroutine void sub22.

However, the line timer_callback_sub(sub22) is NOT applied to the subroutine void sub22. Instead, the line timer_callback_sub(sub16) is applied to the subroutine void sub22.

For an unknown reason in this game, if the function life_callback_sub OR the function timer_callback_sub is called, the argument of the function timer_callback_sub is automatically set to be the argument of the function death_callback_sub.

Order of code execution


Let's look back at the example on Rumia's first non-spell.

Suppose we were to shoot down Rumia on her first non-spell on Lunatic mode. The following sequence of events happen:

  1. The player shoots down her first non-spell until her HP is at 900 HP.
  2. The function life_callback_sub(sub22) is called.
  3. Because the function life_callback_sub(sub22) is called, the function timer_callback_sub(sub22) sets its new argument to be the argument of death_callback_sub(sub16). This means the new timer callback is timer_callback_sub(sub16).
  4. The first spell-card (sub22) starts.

Suppose we were to timeout Rumia's first non-spell. The following sequence of events happen:

  1. The player times out Rumia's first non-spell.
  2. The function timer_callback_sub(sub22) is called.
  3. Because the function timer_callback_sub(sub22) is called, the function timer_callback_sub(sub22) sets its new argument to be the argument of death_callback_sub(sub16). This means the new timer callback is timer_callback_sub(sub16).
  4. The first spell-card (sub22) starts.

Now let's set what happens when the player both shoots down and times out Rumia's first non-spell.

  1. The player shoots down and times out Rumia's first non-spell on the same frame.
  2. Because the function life_callback_sub(sub22) is called, the function timer_callback_sub(sub22) sets its new argument to be the argument of death_callback_sub(sub16). This means the new timer callback is timer_callback_sub(sub16).
  3. The new function timer_callback_sub(sub16) is called.
  4. The second non-spell (sub16) starts.

Exceptions


There are however a couple of weird edge-cases where this does not work. Below are explained why certain skips do not work or lead to different results.

Meiling & Cirno


In the case of Meiling's third spell and Cirno's second spell, the death_callback_sub is set to a subroutine after the spells that tells the boss to explode. This means that these spells use the same set-up as what the non-spells use, so the skip is possible on these spells.

Patchouli


Patchouli's third, fourth and fifth spell-cards cannot be skipped. This is because the argument of death_callback_sub is the same as the life_callback_sub in her subroutines. While the set-up is the same, the last three spell-cards are setup differently than the other bosses of this game.

Remilia


Remilia's fourth spell-card can be skipped, but doing the skip guarantees that the player faces the final spell-card "Red Magic" regardless of difficulty. This is because on the fourth-non-spell the argument of death_callback_sub is sub43, which is the spell "Red Magic". The reason why you normally do not face "Red Magic" on Hard/Lunatic is because on Remilia's fourth spell-card on Hard/Lunatic the death_callback_sub is overwritten and is given the argument sub44, which is the spell-card "Scarlet Gensokyo".

Conclusion


The Frame Perfect Attack Skip can be triggered on some attacks by doing a frame-perfect kill while timing out the pattern on the same frame. The reason this is possible is because two callbacks are triggered on the same frame. This is only possible in EoSD because of how this game handles its callbacks. The timer callback is passed a different argument of the death callback and the new time callback is executed on the same frame.


Replays


  • Replay kana0603 by "kana0603". Lunatic, ReimuB, 1.02h. 「March 16, 2021」. Download link (Note: Rumia's 1st spell-card skip)
  • Replay kana0603 by "kana0603". Lunatic, ReimuA, 1.02h. 「October 11, 2021」. Download link (Note: Rumia's 1st spell-card skip)
  • Replay kana0603 by "kana0603". Lunatic, ReimuB, 1.02h. 「March 18, 2021」. Download link (Note: Rumia's 1st spell-card skip)
  • Replay A by "kana0603". Lunatic, ReimuB, 1.02h. 「March 2, 2023」. Download link (Note: Rumia's 1st spell-card skip)
  • Replay s3 by "kana0603". Lunatic, ReimuB, 1.02h. 「March 27, 2020」. Download link (Note: Meiling's 1st spell-card skip)
  • Replay skip by "kana0603". Lunatic, ReimuB, 1.02h. 「September 15, 2022」. Download link (Note: Meiling's 1st spell-card skip)
  • Replay kana0603 by "kana0603". Lunatic, ReimuA, 1.02h. 「October 9, 2021」. Download link (Note: Meiling's 4th spell-card skip)
  • Replay 2noncncl by "kana0603". Lunatic, MarisaB, 1.02h. 「May 24, 2018」. Download link (Note: Patchouli's 2nd spell-card skip)
  • Replay kana0603 by "kana0603". Lunatic, ReimuB, 1.02h. 「March 17, 2021」. Download link (Note: Patchouli's 2nd spell-card skip)

Videos


All The Embodiment of Scarlet Devil pages:
Boss Attack Skip · Dialogue Pause Desync · Bomb Pause Desync · ReimuA No Sound · Nightbird on Easy Difficulty · Bomb Despawning Enemies · Laser Midpoint Bug · Remilia's 2nd non-spell timer · MarisaB Backward Laser · Bullet Displacement Bug · Max power at 127 power · Persisting Bat State
All Frame-perfect-related pages:
All Ecl-related pages: