SMBX NPC Offsets
Revision as of 11:07, 25 June 2016 by Horikawa otane (talk | contribs)
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 (0x158 bytes) | |||
|---|---|---|---|
| Name | Memory address | Memory type | Description |
| Attached layer name | NPC+0x00 | VB6 String Pointer | The attached layer name. |
| Unknown | NPC+0x04 | FIELD_WORD | Unknown |
| Unknown decrementing timer | NPC+0x06 | FIELD_WORD | Unknown decrementing timer |
| Collides below | NPC+0x0A | FIELD_WORD | Set to 2 when touching a block below |
| Collides left | NPC+0x0C | FIELD_WORD | Set to 2 when touching a block to the left |
| Collides above | NPC+0x0E | FIELD_WORD | Set to 2 when touching a block above |
| Collides right | NPC+0x10 | FIELD_WORD | Set to 2 when touching a block to the right |
| Unknown | NPC+0x18 | FIELD_FLOAT | NPC x-axis movement related, perhaps temporary |
| Is Underwater? | NPC+0x1C | FIELD_WORD | underwater state (2 is underwater, 0 is no) |
| Hit Counter (ie for hammers) | NPC+0x24 | FIELD_WORD | Hit counter, for point calculation |
| Invincibility to Sword | NPC+0x26 | FIELD_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 |
| isHidden | NPC+0x40 | FIELD_WORD | If the NPC is hidden. |
| Activated | NPC+0x44 | FIELD_WORD | Activated / interacted with player flag |
| Friendly | NPC+0x46 | FIELD_WORD | Friendly (on = -1) |
| Don't Move | NPC+0x48 | FIELD_WORD | Don't Move (on = -1) |
| NPC Message text | NPC+0x4C | VB6 String Pointer | NPC Message text |
| Is a generator | NPC+0x64 | FIELD_WORD | Is a generator? |
| Generator delay setting | NPC+0x68 | FIELD_WORD | Generator delay setting |
| Generator firing rate | NPC+0x6A | FIELD_WORD | Generator firing rate |
| Generator delay countdown | NPC+0x6C | FIELD_FLOAT | Generator delay countdown |
| Direction to generate NPC? | NPC+0x70 | FIELD_WORD | Direction to generate NPC? |
| Generator type | NPC+0x72 | FIELD_WORD | The generator type (1 = Warp; 2 = Projectile) |
| Invalidity/offscreen flag? | NPC+0x74 | FIELD_WORD | Invalidity or offscreen flag? |
| X position | NPC+0x78 | FIELD_DFLOAT | X position |
| Y position | NPC+0x80 | FIELD_DFLOAT | Y position |
| Height | NPC+0x88 | FIELD_DFLOAT | Height |
| Width | NPC+0x90 | FIELD_DFLOAT | Width |
| X Speed | NPC+0x98 | FIELD_DFLOAT | X Speed |
| Y Speed | NPC+0xA0 | FIELD_DFLOAT | Y Speed |
| Spawn X | NPC+0xA8 | FIELD_DFLOAT | Spawn X |
| Spawn Y | NPC+0xB0 | FIELD_DFLOAT | Spawn Y |
| GFX Height | NPC+0xB8 | FIELD_DFLOAT | GFX Height |
| GFX Width | NPC+0xC0 | FIELD_DFLOAT | GFX Width |
| Spawn Direction | NPC+0xD8 | FIELD_FLOAT | Direction the NPC is spawned in |
| Respawn Id | NPC+0xDC | FIELD_WORD | Respawn Identity. 0 means doesn't respawn, otherwise same as 0xE2 |
| Id | NPC+0xE2 | FIELD_WORD | Sprite GFX index/Identity |
| Animation frame | NPC+0xE4 | FIELD_WORD | Animation frame |
| Animation timer | NPC+0xE8 | FIELD_FLOAT | Animation timer |
| Direction faced | NPC+0xEC | FIELD_FLOAT | Direction faced (Unknown difference from 0x118) |
| NPC AI 1 | NPC+0xF0 | FIELD_DFLOAT | Multipurpose NPC AI state/timer 1 |
| NPC AI 2 | NPC+0xF8 | FIELD_DFLOAT | Multipurpose NPC AI state/timer 2 |
| NPC AI 3 | NPC+0x100 | FIELD_DFLOAT | Multipurpose NPC AI state/timer 3 |
| NPC AI 4 | NPC+0x108 | FIELD_DFLOAT | Multipurpose NPC AI state/timer 4 |
| NPC AI 5 | NPC+0x110 | FIELD_DFLOAT | Multipurpose NPC AI state/timer 5 |
| Direction faced | NPC+0x118 | FIELD_FLOAT | Direction faced |
| Bounce off block | NPC+0x120 | FIELD_WORD | -1 means just bounced off a block to change direction |
| Kill flag | NPC+0x122 | FIELD_WORD | Kill/Kill effect (0 = No kill/ 1-? Kill effect with kill) |
| Respawned, but onscreen | NPC+0x124 | FIELD_WORD | This is set to 0 when an NPC resets its respawn position, but will not spawn itself fully because it's still visible by the player. Note: Must be set to -1 when spawning a new NPC |
| Offscreen flag | NPC+0x128 | FIELD_WORD | Offscreen flag (-1 = offscreen) |
| Offscreen countdown timer? | NPC+0x12A | FIELD_WORD | Offscreen countdown timer. 180 is onscreen. Set to 0 to force despawn. This is set to -1 when an NPC is ready to respawn (but may not be able to if the player is close by) |
| Player carrying index | NPC+0x12C | FIELD_WORD | The index of the player grabbing the NPC. Defaults to 0 when not grabbed, setting to 1 or higher deactivates block collision when grabbed but causes the respective player to drop other objects |
| Grab Timer? | NPC+0x12E | FIELD_WORD | Related to grabbing npcs. Starts at 30 then quickly returns to 0 when released. |
| Collides with NPCs | NPC+0x136 | FIELD_WORD | -1 indicates it collides with other NPCs. Doubles as a "grabbed" flag |
| Contained Within | NPC+0x138 | FIELD_WORD | Set to the container's ID when contained in another NPC (i.e. jar) |
| Current Section | NPC+0x146 | FIELD_WORD | Current section this NPC is on |
| Hit Count | NPC+0x148 | FIELD_FLOAT | Boss Hit count |
| P-Switch Block ID | NPC+0x14E | FIELD_WORD | ID of the block they were created from due to p-switch |
| NPC Collision | NPC+0x152 | FIELD_WORD | Seems to be set to -1 for a bullet when it destroys another NPC. May apply to all 0x136-related collisions but untested. |
| Invincibility frames | NPC+0x156 | FIELD_WORD | Invincibility frame countdown for all sources of harm |