SMBX NPC Offsets
Jump to navigation
Jump to search
This is the memory map for the npc struct. This struct is not fully analysed. Any help is appreciated!
Please note that the data may not be fully 100% accurate.
| NPC Memory | |||
|---|---|---|---|
| Name | Memory address | Memory type | Description |
| Attached layer name | NPC+0x00 | VB6 String Pointer | The attached layer name. |
| Unknown | NPC+0x04 | Word | Unknown |
| Unknown decrementing timer | NPC+0x06 | Word | Unknown decrementing timer |
| Collides below | NPC+0x0A | Word | Set to 2 when touching a block below |
| Collides left | NPC+0x0C | Word | Set to 2 when touching a block to the left |
| Collides above | NPC+0x0E | Word | Set to 2 when touching a block above |
| Collides right | NPC+0x10 | Word | Set to 2 when touching a block to the right |
| Unknown | NPC+0x18 | Double | NPC movement related, perhaps temporary |
| Invincibility to Sword | NPC+0x26 | Word | Invincibility frame countdown, for sword attacks |
| Activate event layer name | NPC+0x2C | VB6 String Pointer | Activate event layer name |
| Death event layer name | NPC+0x30 | VB6 String Pointer | Death event layer name |
| Talk event name? | NPC+0x34 | VB6 String Pointer | Talk event name? |
| No More Objs event layer name | NPC+0x38 | VB6 String Pointer | No More Objs event layer name |
| Layer name | NPC+0x3C | VB6 String Pointer | Layer name |
| Unknown | NPC+0x40 | Word | Unknown (some sort of hide value if -1) |
| Activated | NPC+0x44 | Word | Activated / interacted with player flag |
| Friendly | NPC+0x46 | Word | Friendly (on = 0xFFFF) |
| Don't Move | NPC+0x48 | Word | Don't Move (on = 0xFFFF) |
| NPC Message text | NPC+0x4C | VB6 String Pointer | NPC Message text |
| Is a generator | NPC+0x64 | Word | Is a generator? |
| Generator delay setting | NPC+0x68 | Float | Generator delay setting |
| Generator firing rate | NPC+0x6A | Word | Generator firing rate |
| Generator delay countdown | NPC+0x6C | Float | Generator delay countdown |
| Direction to generate NPC? | NPC+0x70 | Word | Direction to generate NPC? |
| Layer to spawn NPC on | NPC+0x72 | Word | Which layer to spawn NPC on |
| Invalidity/offscreen flag? | NPC+0x74 | Word | Invalidity or offscreen flag? |
| X position | NPC+0x78 | Double | X position |
| Y position | NPC+0x80 | Double | Y position |
| Height | NPC+0x88 | Double | Height |
| Width | NPC+0x90 | Double | Width |
| X Speed | NPC+0x98 | Double | X Speed |
| Y Speed | NPC+0xA0 | Double | Y Speed |
| Spawn X | NPC+0xA8 | Double | Spawn X |
| Spawn Y | NPC+0xB0 | Double | Spawn Y |
| GFX Height | NPC+0xB8 | Double | GFX Height |
| GFX Width | NPC+0xC0 | Double | GFX Width |
| Unknown | NPC+0xD8 | Float | Unknown |
| Respawn Id | NPC+0xDC | Word | Respawn Identity. 0 means doesn't respawn, otherwise same as 0xE2 |
| Id | NPC+0xE2 | Word | Sprite GFX index/Identity |
| Animation frame | NPC+0xE4 | Word | Animation frame |
| Animation timer | NPC+0xE8 | Float | Animation timer |
| Direction faced | NPC+0xEC | Float | Direction faced (Unknown difference from 0x118) |
| NPC AI 1 | NPC+0xF0 | Double | Multipurpose NPC AI state/timer 1 |
| NPC AI 2 | NPC+0xF8 | Double | Multipurpose NPC AI state/timer 2 |
| NPC AI 3 | NPC+0x100 | Double | Multipurpose NPC AI state/timer 3 |
| NPC AI 4 | NPC+0x108 | Double | Multipurpose NPC AI state/timer 4 |
| NPC AI 5 | NPC+0x110 | Double | Multipurpose NPC AI state/timer 5 |
| Direction faced | NPC+0x118 | Float | Direction faced |
| Bounce off block | NPC+0x120 | Word | 0xFFFF means just bounced off a block to change direction |
| Kill flag | NPC+0x122 | Word | Kill/Kill effect (0 = No kill/ 1-? Kill effect with kill) |
| Unknown | NPC+0x124 | Word | Note: Must be set to 0xFFFF when spawning a new NPC |
| Offscreen flag | NPC+0x128 | Double | Offscreen flag (0xFFFFFFFF = offscreen) |
| Offscreen countdown timer? | NPC+0x12A | Word | Offscreen countdown timer. 180 is onscreen. Set to 0 to force despawn. |
| Unknown | NPC+0x12C | Word | Unknown grabbing-related |
| Collides with NPCs | NPC+0x136 | Word | 0xFFFF indicates it collides with other NPCs. Doubles as a "grabbed" flag |
| Contained Within | NPC+0x138 | Word | Set to the container's ID when contained in another NPC (i.e. jar) |
| Current Section | NPC+0x146 | Word | Current section this NPC is on |
| Hit Count | NPC+0x148 | Float | Boss Hit count |
| NPC Collision | NPC+0x152 | Word | Seems to be set to 0xFFFF for a bullet when it destroys another NPC. May apply to all 0x136-related collisions but untested. |
| Invincibility frames | NPC+0x156 | Word | Invincibility frame countdown for all sources of harm |