SMBX NPC AI

SMBX stores its AI values in special fields in the SMBX struct.

Paragoomba (ID: 3)

 * ai1 Increments 1 per tick, at 32 the jumps are starting and it only increments one per jump until 35.
 * ai2/ai3/ai4/ai5 Unused

Shell (ID: 5, 7, 24, 73, 113, 114, 115, 116, 172, 174)

 * ai1/8 (ai2)/ai3 Unused
 * ai4 Timer counts up from 0 to 3 when changing direction and spawning hit effect.
 * ai5 Unused

Piranha Plant (Green) (ID: 8)

 * ai1 Timer
 * ai2 Current AI phase (1=showing up [Tick 0-32; Then reset to 0], 2=showing [Tick 0-49; Then reset to 0], 3=hiding down [Tick 0-32], 4=hiding [Tick 33-74; Then reset to 0])
 * ai3/ai4/ai5 Unused

SMB3 Coin (ID: 10)

 * ai1 Set to 1 when affected by gravity (e.g. when Luigi hits a block containing coins), 0 otherwise

Lava Bubbles (ID: 12)

 * ai1 Timer
 * ai2 Current AI phase (1=jumping up, 2=fall down)
 * ai3/ai4/ai5 Unused

Player Fireball (ID: 13)

 * ai1 Player-character logic to use for the fireball (1=Mario, 2=Luigi, 3=Peach, 4=Toad, 5=Link)
 * ai2 1 if Peach's fireball bounced off a block.

Boom Boom (ID: 15)

 * ai1 Current AI phase (0=running/walking, 1=spike mode, 2=transforming to spike mode, 3=jumping up, 4=hurt)
 * ai2 Decimal Timer
 * ai3/ai4/ai5 Unused

Bill Blaster (ID: 21)

 * ai1 Timer: Increments 1 per tick, at 200 one bullet bill is fired unless the player is over or underneath the blaster. (incremeting will not be paused!)
 * ai2/ai3/ai4/ai5 Unused

Billy Gun (ID: 22)

 * ai1 Timer: Increments 10 per tick when the player is holding the billy gun, at 200 one bullet bill is fired.
 * ai2/ai3/ai4/ai5 Unused

Ninji (Violet) (ID: 25)

 * ai1 Timer: When touching the ground then a timer decrements from 5 to 0. When the value is back to 0 then the ninji is jumping again.
 * ai2/ai3/ai4/ai5 Unused

Cheep-Cheep (Red) (ID: 28)

 * ai1 The selected Cheep-Cheep AI (From 0...)
 * ai2 Unknown
 * ai3 Unknown
 * ai4 0 = Swim up, 1 = Swin down
 * ai5 Unused

Hammer Bros. (ID: 29)

 * ai1 Timer: Direction Timer, if <0 then moving left, else moving right. Will reset about ~100 ticks (unknown)
 * ai2 Timer: Increments 1 per tick (while not shooting), if reaches 250 then super-jump is executed ==> Timer resets to 0
 * ai3 Throwing releated. High number = more throws
 * ai4/ai5 Unused

Super Leaf (ID: 34)

 * ai1 Timer: From 1 to 6. Controls the "swing"-effect for correct speed. When the value 6 is reached the direction of this swing is switched.
 * ai2/ai3/ai4/ai5 Unused

Thwomp (ID: 37, 180)

 * ai1 Current AI phase (0=idle, 1=going down, 2=staying down, 3=going up)
 * ai2 Timer: For state 2 => from 0 to 100; When hit value 100 then state is switched to 3.
 * ai3/ai4/ai5 Unused

Boo (ID: 38, 43, 44)

 * ai1 Current AI phase (0=idle, 1=following player)
 * ai2/ai3/ai4/ai5 Unused

Birdo (ID: 39)

 * ai1 Current AI phase (0=movement, 1=fire, or -30 to 0 if got hit)
 * ai2 Timer: Increments 1 per tick; if reaches 125 then jump, if reaches 250 then shoot, at 280 resets to 0
 * ai3 Movement timer: Increments 1 per tick, when reached 500 ==> Direction changed
 * ai4/ai5 Unused

Grab Block (ID: 45)

 * ai1 Current AI phase (0=untoched, 1=touched)
 * ai2 Timer: (Only in touched mode), 1 to 450; If reaches 450 then the block dissapears; If value is 0 in touched mode then the block is thrown and destroys itself on collision.
 * ai3/ai4/ai5 Unused

Donut Block (ID: 46, 212)

 * ai1 Current AI phase (0=idle, 1=falling)
 * ai2 1 if someone is standing ==> Increments timer
 * ai3 Timer: From 0 to 5 ticks for red version; 0 to 30 ticks for brown version
 * ai4/ai5 Unused

Lakitu (SMB3) (ID: 47)

 * ai1 Which direction the lakitu is traveling
 * ai2 Lakitu float timer - 0 when lowering, 1 when raising
 * ai3 Animation state (0: bobs up, 1: bobs down, 2: preparing to throw, 3: throwing)
 * ai4 Preparing to throw timer: Resets if at 0 when it reaches the player, starts from 100 and decreases by 1 each frame.
 * ai5 Throw timer: Starts at 0, will not start counting until ai4 is also 0. Increases by 1 every 6 ticks up to 20, then a Spiny Egg is thrown and the timer resets (but does not begin counting yet).

Toothy Pipe (ID: 49)

 * ai1 Current AI phase (0=not holding, 1=holding)
 * ai2 NPC Array Index to find Toothy NPC Struct (NOTE: At high index experience laggs)
 * ai3/ai4/ai5 Unused

Toothy (ID: 50)

 * ai1 Stays 1, if set to 0 then Toothy despawns
 * ai2/ai3/ai4/ai5 Unused

Piranha Plant (Red, Upside-Down) (ID: 51)

 * ai1 Timer
 * ai2 Current AI phase (1=showing up [Tick 0-42; Then reset to 0], 2=showing [Tick 0-49; Then reset to 0], 3=hiding down [Tick 0-42], 4=hiding [Tick 43-109; Then reset to 0])
 * ai3/ai4/ai5 Unused

Piranha Plant (Red Horizontal) (ID: 52)

 * ai1 Timer
 * ai2 Current AI phase (1=showing up [Tick 0-32; Then reset to 0], 2=showing [Tick 0-49; Then reset to 0], 3=hiding down [Tick 0-32], 4=hiding [Tick 33-109; Then reset to 0])
 * ai3/ai4/ai5 Unused

Fighter Fly (ID: 54)

 * ai1 Timer: From 0 to 29. When reached value 29 then the jump is beeing made.
 * ai2/ai3/ai4/ai5 Unused

Platform (ID: 60, 62, 64, 66)

 * ai1 Speed X
 * ai2 Speed Y
 * ai3 Unused/Unknown?
 * ai4 Unused/Unknown?
 * ai5 ID of Path riding on, if 0 then platform is using no path

Piranhacus Giganticus (ID: 74)

 * ai1 Timer
 * ai2 Current AI phase (1=showing up [Tick 0-42; Then reset to 0], 2=showing [Tick 0-49; Then reset to 0], 3=hiding down [Tick 0-42], 4=hiding [Tick 43-74; Then reset to 0])
 * ai3/ai4/ai5 Unused

Toad (Jumping) (ID: 75)

 * ai1 Timer: [Tick 0-9 "Charging" Jump], [Tick 0-9 Jumping], When falling down timer stays at value 100... (strange algorithm)
 * ai2/ai3/ai4/ai5 Unused

Parakoopa (Green) (ID: 76, 121, 122, 123, 124)

 * ai1 Para-Koopa Movement Mechanism (0: Follow, 1: Jump, 2: Hover Left/Right, 3: Hover Up/Down, Any Other Number: Stay in Place)
 * ai2 Unused/Unknown?
 * ai3 For AI-State 2 (Hover left/right): Direction Flag for slightly going up/down.
 * ai4/ai5 Unused

SMW Bowser Statue (ID: 84)

 * ai1 Increments 1 per tick, resetting when it shoots (shooting about Tick ~220 [Not fixed])
 * ai2/ai3/ai4/ai5 Unused

SMB3 Bowser (ID: 86)

 * ai1 Resets to 9 when starting to jump high and decrements 1 per tick. Not sure but may start arcing after it hits 0
 * ai2 Increments by a seemingly random number between 0.0 and 1.0 each tick. Resets from time to time but I don't can't tell exactly why.
 * ai3 Increments by 1 per tick. Sometimes it gets reset to 0, but other times it gets reset to a negative number and counts back up to 0 to trigger something.
 * ai4 Current AI phase (2=hopping, 3=jumping high+falling, 4=shooting fireballs, 10=turning right after hitting ground, -10=turning left after hitting ground)
 * ai5 Other? (0=just after hitting ground, 1=other)

Herb (ID: 91)

 * ai1 The NPC ID of the content in the herb.
 * ai2/ai3/ai4/ai5 Unused

Piranha Plant SMB1 (ID: 93)

 * ai1 Timer
 * ai2 Current AI phase (1=showing up [Tick 0-32; Then reset to 0], 2=showing [Tick 0-49; Then reset to 0], 3=hiding down [Tick 0-32], 4=hiding [Tick 33-74; Then reset to 0])
 * ai3/ai4/ai5 Unused

Yoshis (ID: 95, 98, 99, 100, 148, 149, 150, 228)

 * ai1 1 is hurt (and running)
 * ai2 Counter relating to head movement when hurt
 * ai3/ai4/ai5 Unused

Colored egg (ID: 96)

 * ai1 The NPC ID of the content in the egg.
 * ai2/ai3/ai4/ai5 Unused

Star SMB3 (ID: 97)

 * ai1 Whether the star has already been collected (1 when true)
 * ai2 Direction Flag (0 = fly up; 1 = fly down)
 * ai3 Unused/Unknown?
 * ai4 Direction Flag Timer (From 0 to 4; When 4 reset to 0 and toggle the Direction Flag)
 * ai5 Unused

Wood platform (ID: 104)
(ai3) (ai4) (ai5) Unused
 * ai1 The current Y-Speed
 * ai2 The current X-Speed

Thin platform (ID: 105)

 * ai1 If the player stands on the platform, then this value is 1, else it is 0
 * ai2/ai3/ai4/ai5 Unused

Bit (ID: 126, 127, 128)

 * ai1 AI-State (2 = Moving [Tick 0-119], 1 = Charging [Tick 0-89 or 29], -1 = Jumping [Tick stays at 0 until reaching the floor]). Note: The AI States are quite random.
 * ai2 Timer
 * ai2/ai3/ai4/ai5 Unused

Tweeter (ID: 129)

 * ai1 Jump Timer: 0 to 3, on every jump this timer increases by 1 until it reaches value 3. Then the next jump is a high jump and the timer resets to 0.
 * ai2/ai3/ai4/ai5 Unused

Snifit (Red/Blue) (ID: 130, 131)

 * ai1 Timer: From 0 to 120 = Movement, from 121 to 149 = Init Fire, after that fire and the timer reset to 0
 * ai2 Quickly changes between 0 and 1 when shaking.
 * ai3/ai4/ai5 Unused

Snifit (Gray) (ID: 132)

 * ai1 Timer: Unknown
 * ai2 Jump Timer: 0-99 to Jump with ai3 is 0, 0-40; 91-99 with ai3 is 2.
 * ai3 Shoot related, 0 = (shoot nothing?); 2 = Shoot twice?, [Note: very unclear!]
 * ai4/ai5 Unused

Mouser's Bomb (ID: 134)

 * ai1 Timer (until explode): 0-349 until explode; When 250 reached then AI-State is 1.
 * ai2 AI-State: 0 = Idle, 1 = Short before exploding
 * ai3 Bomb animation state: 0-14 repeating when AI-State is 1.
 * ai4/ai5 Unused

Bob-Omb (SMB2) (ID: 135)

 * ai1 Timer (until explode): 0-549 until explode; When 450 reached then AI-State is 1.
 * ai2 AI-State: 0 = Idle, 1 = Short before exploding
 * ai3/ai4/ai5 Unused

Bob-Omb kicked (SMB3) (ID: 137)

 * ai1 Timer (until explode): 0-349 until explode; When 250 reached then AI-State is 1.
 * ai2 AI-State: 0 = Idle, 1 = Short before exploding
 * ai3 Bomb animation state: 0-10 repeating when AI-State is 1.
 * ai4/ai5 Unused

Galoomba Kicked (SMW) (ID: 166)

 * ai1 Timer (until standing back up): 0-399 until standing back up.
 * ai2/ai3/ai4/ai5 Unused

Para-Galoomba (SMW) (ID: 167)

 * ai1 Timer/AI-State: 0-61 Simple Movement; 62 First Jump and lock on to the Jump-Timer; 63 Second Jump; 64 Third Jump; 65 Fifth Jump;
 * ai2 Jump Timer: AI-State 62-64: Increment 1 per tick, from 0-15; AI-State 65: Increment 2 per tick; When reched 15, then jump if possible.
 * ai3/ai4/ai5 Unused

Bully (SM64) (ID: 168)

 * ai1 Unknown/Unused?
 * ai2 AI-State: 0 = following player, 1 = kicked off by player
 * ai3/ai4/ai5 Unused

Grinder (Circular saw) (ID: 179)

 * ai1 Grinder Speed Y
 * ai2 Grinder Speed X
 * ai3/ai4 Unused
 * ai5 The ID of the line BGO the Grinder is on

Bowser's statue (ID: 181)

 * ai1 Timer: 0-230 until shoot.
 * ai2/ai3/ai4/ai5 Unused

Dry Bones (ID: 189)

 * ai1 0=Up walking around, 1=Collapsed
 * ai2 When broken, increments by 1 per tick until 400 at which point it gets up
 * ai3 Alternates between 1 and 0 when wiggling (ai2 between 300 and 400)
 * ai4/ai5 Unused

Skull Raft (ID: 190)

 * ai1 AI-State: 0 = Idle, 1 = Active Moving
 * ai2/ai3/ai4/ai5 Unused

Kamikaze Koopa (ID: 194)

 * ai1 Unknown/Unused?
 * ai2 Unknown/Unused?
 * ai3 Unknown/Unused?
 * ai4 Unknown/Unused?
 * ai5 Animation Timer 0-15: The current color of the shell.

Collectable Star (ID: 196)

 * ai1 Whether the star has already been collected (1 when true)
 * ai2 Direction Flag (0 = fly up; 1 = fly down; This flag gets toggled after running the animation timer 14 times (5 animation frames * 14 = 70 frames total per direction)
 * ai3 Unused/Unknown?
 * ai4 Animation Timer (From 0 to 4)
 * ai5 Unused

SMW Exit point (ID: 197)

 * ai1 Direction Flag (1 = move up; 0 = move down)
 * ai2 The lower y coordinate. This y coordinate toggles the direction flag from moving down to moving up. Modifying this flag has no effect!
 * ai3/ai4/ai5 Unused

Blargg (ID: 199)

 * ai1 AI-State (0 = idle; 1 = looking; 2 = moving)
 * ai2 Timer - AI-State 1: 0 to 89; AI-State 2: Stays at 90 until moving animation finished.
 * ai3/ai4/ai5 Unused

SMB Bowser (ID: 200)

 * ai1 0: Walking, 1: Pre-fire, 2: spitting fire
 * ai2 The direction Bowser is moving, not facing. 0 is left, 1 is right.
 * ai3 Fire timer, after spitting fire increments up to around 60
 * ai4 Some sort of Hammer related timer, noted below.
 * ai5 Unknown, always 1 (SMBX forces it to be 1) [Related to 2-player mode]

ai4 Details
(where tableOfBowser is a table of the active SMB1 Bowsers returned by `NPC.get(200, -1)`)
 * The timer is mostly random
 * However, repeatedly setting the values based on a range can modify the rate at which hammers are thrown. For example:
 * The internal ai4 equals to this C++ pseudocode
 * Note that in the Lua code, we set the value to 15. In the C++ code, the random spawn rate is based on a modulus of 16. This is due to the fact that when setting the value in Lua, it is automatically incremented to 1 above of what is set.

Wart (ID: 201)

 * ai1 AI-State: 0 - Idle, 1 - Bubbles; 2 - Got hit; 3 - Death
 * ai2 Walking Direction: 1 - left; -1 - right
 * ai3 Timer (Idle: 0 to 180; Bubbles: 0 to 130)
 * ai4 Death timer (0 to 120)
 * ai5 Unused

Zoomer (ID: 205), Spark (ID: 206), Spike Top (ID: 207)

 * ai1 Walking side: 0 - in air (falling down), 1 - Walking on top side, 2 - Walking on left side, 3 - Walking on bottom side, 4 - Walking on right side
 * ai2 Unknown: Is -1 on top and right side, is 1 on left and bottom side
 * ai3 Unknown Timer
 * ai4 Unused/Unknown?
 * ai5 Edge Timer: If hitting an edge, then timer starts from 1 to 6. When reaching value 6 then the NPC is switching walking side.

Mother Brain (ID: 209)

 * ai1 Shaking Timer: 0 to 44 (0 = Idle, otherwise lower value means harder shake)
 * ai2/ai3/ai4/ai5 Unused

Rinka (ID: 210)

 * ai1 AI-State: 0 = Waiting, 1 = Moving
 * ai2 Timer for AI-State 0: From 0 to 88; When reaching 88, then AI-State is switched to 1 (Moving)
 * ai3/ai4/ai5 Unused

Rinka block (ID: 211)

 * ai1 Spawn Timer: 0 to ~200 (Increments about 1 to 2 per tick [i.e. 1,835...]); If the value reaches over 200 then a new Rinka NPC is spawned. Then is it switched back to 0.
 * ai2/ai3/ai4/ai5 Unused

Blooper (ID: 231)

 * ai1 When starting the level in water, set to 1 (else set to 0).
 * ai2 Vertical movement counter: increases when moving up, decreasing when moving down. Set to -60 when falling outside of the water or outside of water with no movement.
 * ai3/ai4/ai5 Unused

Venus Fire Trap (ID: 245)

 * ai1 State Timer, increases per tick (Initial state on activation: 42. While state 1, tick from 0 to 43 [equal to physical height] (until Fire Trap will finish warping up process). While state 2, tick from 0 to 100. On value 50 - shoot the fire. While state 3 - tick to 43 [equal to physical height] (Until Fire Trap will finish warping down process). On state 4, continue timer from recent value to 150. If player is arround, reset timer to 140)
 * ai2 Current state (1 - Showing up, 2 - Watch for a player and shoot, 3 - Hiding down, 4 [Initial] - Wait in the shelter)
 * ai3 Unused
 * ai4 Unknown, always 1
 * ai5 Unused

Pokey (ID: 247)

 * ai1 -3 when a body segment.
 * ai2 2 when the bottom segment.
 * ai3/ai4/ai5 Unused

Big Piranha Plant (ID: 256, 257)

 * ai1 Timer (Initial state 71, While state 1 - tick from 0 to 85 [Equal to NPC height, until it will be completely shown] and reset to 0, While state 2 - Do nothing until something will hurt NPC, then toggle state to 3 and timer value to 50. While state 3, tick from 0 to 85 [Equal to NPC height, until it will be completely hidden], then toggle state to 4 and tick timer from - to 75. Then toggle state to 1 and begin showing).
 * ai2 Current AI phase (1 - Showing up, 2 - Waiting be shown, 3 - Hiding down, 4 [Initial] - Wait in shelter)
 * ai3 Unused
 * ai4 Unused.
 * ai5 Unused

Roto Disc (ID: 259)

 * ai1 Position on the circle, increments (when placed at top) from 0 to 3, or decrements (when placed at bottom). Value is always 0 at the start position and changes every quarter circle.
 * ai2 Unused/Unknown?
 * ai3 Unused/Unknown?
 * ai4 Frame Timer.
 * ai5 Switches to 0 for a frame when ai1 changes. Checks for vertical/horizontal lines on the path?

Firebar (ID: 260)

 * ai1 Distance from the center of the circle (SMBX Advanced Tab "Position")
 * ai2 Position on the circle, increments (when placed at top) from 0 to 3, or decrements (when placed at bottom). Value is always 0 at the start position and changes every quarter circle.
 * ai3 Unused/Unknown?
 * ai4 Unused/Unknown?
 * ai5 Switches to 0 for a frame when ai2 changes. Checks for vertical/horizontal lines on the path?

Nipper Plant (ID: 261)

 * ai1 AI-State: 0 = Jumping, 1 = Moving
 * ai2 Timer for standing without moving and hopping.
 * ai3/ai4/ai5 Unused

Ice Block (ID: 263)

 * ai1 Contained NPC ID
 * ai2 Displayed Frame?
 * ai3 Nogravity flag. Set to 0 when grabbed.
 * ai4/ai5 Unused

Ice Ball (ID: 265)

 * ai1 AI State: 1 is bouncing, 5 is flying horizontally
 * ai2/ai3/ai4 Unused
 * ai5 Number of bounces. After the 2nd bounce, the ice ball will be destroyed on impact with the ground.

Link's Laser (ID: 266)

 * ai1 Despawn Timer (increments from 0 to 40)
 * ai2/ai3/ai4/ai5 Unused

Larry (ID: 267)

 * ai1 AI State: 0 is walking, 1 is preparing to fire, 2 is shooting
 * ai2 Movement direction (left is -1, right is 1)
 * ai3 Jumping Timer: Increments from 0 to a random number between 40 and 60
 * ai4 Shooting Timer: Increments from 0 to around 130 in AI State 0 (can be exceeded if he was jumping when the number passed 130), shows y-position to aim at in AI State 2
 * ai5 Always 1.

Larry's Shell (ID: 268)

 * ai1 AI State: 0 is staying still, 1 is moving on the ground, 3 is jumping out of the shell
 * ai2 AI State Timer: 0: Increments from 0 to 60 before switching to State 1; 1: Increments from 0 to 300 before switching to State 3; 3: Increments from 0 to 20 before turning the NPC into ID 267
 * ai3/ai4 Unused
 * ai5 Always 1.

Larry's Beam (ID: 269)

 * ai1 Displayed Frame: 0 = Frame 1, 1 = Frame 2, 2 = Frame 3
 * ai2 Timer for displayed frame: Increments from 0 to 21. At 16: Switches to AI 1 state 1, at 21: Switches to AI 1 state 2.
 * ai3/ai4/ai5 Unused

SMW Jumping Plant (ID: 270)

 * ai1 AI-State: 0 = Waiting, 1 = Moving upwards, 2 = Moving downwards
 * ai2 Timer for AI-State; 0: From 60 to -20; When reaching -20, then AI-State is switched to 1; 1: From 0 to 100; When reaching 100, then AI-State is switched to 2.
 * ai3/ai4/ai5 Unused

Swooper (ID: 271)

 * ai1 AI-State: 0 = Waiting, 1 = Flying
 * ai2 When in AI State 1: Fixated y-position the NPC is aiming at.
 * ai3/ai4/ai5 Unused

Hoopster (ID: 272)

 * ai1 Direction: Downwards: 1; Upwards: -1 (Rapidly switches between -1 and 2 when not fixed to something they can climb on)
 * ai2/ai3/ai4/ai5 Unused

Volcano Lotus (ID: 275)

 * ai1 AI-State: 0 = Idle, 1 = Preparing for shot, 2 = After shot,
 * ai2 AI State Timer; 0: Increments from 0 to 170, then switches into AI1 State 1; 1: Increments from 0 to 70, then switches into AI1 State 2 and shoots 4 NPC ID 276's; 2: Increments from 0 to 50, then switches to AI1 State 0
 * ai3/ai4/ai5 Unused

Volcano Lotus Fireball (ID: 276)

 * ai1 Direction: 0 = Upwards, 1 = Downwards
 * ai2 X-Movement, increments from 0 to 11 (0-5 frames movement to the left, 6-11 frames movement to the right)
 * ai3/ai4/ai5 Unused

Propeller Block (ID: 268)

 * ai1 0 while y-speed doesn't decrease while jumping with the block, else 1.
 * ai2/ai3/ai4/ai5 Unused

Fire Propeller Block (ID: 279)

 * ai1 0 while y-speed doesn't decrease while jumping with the block, else 1.
 * ai2 Increments from 0 to 79, shoots a fireball every 20 frames. When spinjumping: Rapidly switches between 25 and 100. CAREFUL! Landing on the ground while this value is above 79 will stop the flamethrower from shooting.
 * ai3 While spinjumping rapidly changes between -1 and 1, direction of the item while spinning (-1 is left).
 * ai4 Always 0.
 * ai5 Appears to be a random number. Does nothing? Known values: 12, 14.

Ludwig (ID: 280)

 * ai1 AI State: 0 = Standing, 1 = Preparing to fire, 2 = Firing, 3 = Jumping into the shell
 * ai2 Direction flag. Left: -1, Right: 1
 * ai3 Fire Timer: Increments from 0 to 40. While this is 0, AI State is 0, while this is between 1 and 20, AI State is 1, while this is above 20, AI State is 2.
 * ai4 Always 0.
 * ai5 Always 1.

Ludwig's Shell (ID: 281)

 * ai1 AI State: 0 = Not moving, 1 = Moving, 3 = Jumping out of the shell
 * ai2 Timer: AI State 0: Increments to 60, then switches to AI State 1; AI State 1: Increments from 0 to 300, when it reaches 300, the NPC turns back into Ludwig.
 * ai3 Jump Timer. Increments to a random number before jumping. Almost always jumps before this timer reaches 50. Set to 1 when AI State is 3.
 * ai4 Unused.
 * ai5 Always 1.

Bubble (ID: 283)

 * ai1 Contained NPC ID
 * ai2 Movement direction (-1 is upwards, 1 is downwards)
 * ai3 1 when popping.
 * ai4/ai5 Unused

Lakitu (SMW) (ID: 284)

 * ai1 Thrown NPC identity
 * ai2 Init to 1, set to 0 a little while after throwing
 * ai3 0=Haven't yet passed over player, 2=Getting ready to throw, 3=Like 0 but after having thrown before
 * ai4 When getting ready to throw, resets to 100 and starts decrementing. Throws once 0 again.
 * ai5 Always increments 1 per tick, resets to 0 after throw

Spiny Egg (SMW) (ID: 286)

 * ai1 Flag for colliding with the ground, when 1 transforms NPC into ID 285
 * ai2 Unknown, 0 when thrown by Lakitu, placed before testing or coming from a bubble, otherwise -1.
 * ai3/ai4/ai5 Unused

SMB2 Potion (ID: 288)

 * ai1 Unused
 * ai2 Target Section (-1 means no section, otherwise from 0 to 20)
 * ai3 1 when transforming into the door.
 * ai4/ai5 Unused

SMB2 Potion Door (ID: 289)

 * ai1 Unused
 * ai2 Target Section (-1 means no section, otherwise from 0 to 20)
 * ai3/ai4/ai5 Unused

Rideable Airship Piece (ID: 290)

 * ai1 Unused
 * ai2 Always -1
 * ai3 Unused
 * ai4 Mounted Flag (1 if true)
 * ai5 x-Direction

Peach's Bombs (ID: 291)

 * ai1/ai2 Unused
 * ai3 Frame timer.
 * ai4 Explosion state
 * ai5 Unused

Toad's Boomerang (ID: 292)

 * ai1 (FIELD_DFLOAT) Unknown. Init to 1
 * ai5 (FIELD_DFLOAT) Follows player character (1 is follows)