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.
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.
Bullet Displacement Bug
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 bullet displacement bug is a bug where a boss's bullets are fired from a wrong position relative to the boss. This bug is encountered on various boss attacks, which are as follows:
- Rumia's mid-spell
- Meiling's mid-non-spell
- Patchouli's "Bury in Lake" spell-card
- Patchouli's 2nd non-spell
- Sakuya's 1st non-spell
- Sakuya's 2nd non-spell
- Remilia's 4th non-spell
- All of Flandre's non-spells
- Flandre's "Four of a Kind" spell-card

How it happens
This bug happens occasionally on the attacks mentioned in the previous sections. This bug is not consistent to replicate, as it depends on boss movement (which is RNG-based) and sometimes it depends on rank.
Why it happens
In order to understand how this bug takes place, we must understand how the game processes its events. Every frame, the game updates events in a specific order:
- Clamping boss position to its movement limits
- Process scripted boss behavior
a. Apply interpolation-based movement updates
b. Handle bullet firing - Clamping boss position to its movement limits
Boss movement limit
To prevent a boss from going off-screen, the boss is given a movement limit. This limit is a rectangle that represents the space the boss can exist in. The limit's (x,y) position as well as their (width, height) are usually set at the start of a new pattern.
Enemy movement interpolation
Movement interpolation smoothly moves an enemy from one position to another position over a fixed duration. Different interpolation modes can be used to create movement patterns such as constant speed or smooth deceleration.
At the start of the interpolated movement, the enemy's final position is calculated. This will not be used until the very end of the interpolated movement. Each frame, the enemy's velocity is updated according to its interpolation mode (e.g. a constant decrease each frame for constant deceleration). The velocity is then used to update the enemy's position. On the final frame of the interpolation, the game directly sets the enemy position to the interpolation target position instead of continuing to derive it from velocity. This is done to ensure that the enemy ends up in the correct final position.
For example, say an enemy is at the coordinates (2, 18) and has an initial velocity of 7. The enemy is linearly decelerating to a speed of 0 across 5 frames, only moving in the positive x-direction. Given this information, the final position is computed as (2 + (5 * 7 / 2), 18) = (19.5, 18). The velocity decreases by 7/5 = 1.4 at each frame.
| Frame | Speed | Position |
|---|---|---|
| 0 | 7 | (2, 18) |
| 1 | 5.6 | (9, 18) |
| 2 | 4.2 | (14.6, 18) |
| 3 | 2.8 | (18.8, 18) |
| 4 | 1.4 | (21.6, 18) |
| 5 | 0 | (19.5, 18) |
On the final frame, the position is set to the pre-calculated (19.5, 18). If it were not set to this pre-calculated position, then the final position would have been (23.0, 18).
Bullet firing logic
On some patterns, boss bullet firing is controlled by a timer-based system. Each frame, the firing timer is incremented, and once the timer reaches the configured firing interval, the boss fires its pattern and the shooting timer is reset.
When spawning bullets, the game uses the boss's current position combined with a given offset. As a result, bullets always spawn relative to the boss position when the firing logic executes.
Where the bug occurs
The movement limit clamps (steps 1 and 3) prevent the boss from visibly leaving its allowed movement area. However, a problem occurs because of interpolation-based movement updates happen between these two clamp operations.
On the final frame of an interpolation movement, the game directly sets the boss position to the interpolation target position. If this target position lies outside the movement limits, the boss temporarily exists outside its allowed area (step 2a). This target position does not take into account the movement limit, meaning that this area can lie outside of the movement limit.
Immediately afterwards (step 2b), the bullet firing logic executes. Since bullets spawn using the boss's current position, any bullets fired during this frame will use the boss's temporary out-of-bounds position as its spawn location. Note that it only affects bullets fired from a timer-based system, bullets fired through other means are unaffected by it.
Of course, for this to happen, the shooting timer (step 2b) has to coincide with the final frame of the interpolation (step 2a).
After the bullets have been spawned, the game performs the second movement limit clamp (step 3). This moves the boss back within bounds before rendering occurs. As such, the boss itself never visibly appears outside the movement area, but bullets can still appear displaced from the boss.
Links
Replays
- Replay
kana0603by "kana0603". Extra, MarisaB, 1.02h. 「April 11, 2026」. Download link (Note: Bug happens twice on Flandre's 7th non-spell) - Replay
Aby "kana0603". Extra, MarisaB, 1.02h. 「April 5, 2026」. Download link (Note: Bug happens twice on Flandre's 7th non-spell)
Videos
This section has no content yet. Would you like to add to this section? Contact me if you are interested!
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: |