NPC Type IDs
An NPC Type ID (Also known as Act ID or character code) is a number that defines an NPC's type.
NPC Table
A table of default NPC properties are stored in a npc.tbl
file in the data folder. You may edit this table with your favorite Cave Story editor. When NPCs of a set type are spawned they will initially use properties from their NPC Table entry, although these properties can be changed for NPCs with scripting at any time.
Note
Some vanilla NPCs change their damage or other features gotten from the NPC Table dynamically. Changing the NPC Table properties on these NPCs will most likely have little effect.
NPC Table parameters on different editors
Different Cave Story editors use different terminology on NPC Table parameters. This section translates all of them to ModCS API equivalents.
Booster's Lab
The King's Table
Cave Editor
life
parameter of a ModCS.Npcdamage
parameter of a ModCS.Npcexp
parameter of a ModCS.Npc- NPC Bits
- NPC Hitbox
- NPC Viewbox
surf
parameter of a ModCS.Npchit_voice
parameter of a ModCS.Npcdestroy_voice
parameter of a ModCS.Npcsmoke_size
parameter of a ModCS.Npc
NPC Type reference
... Here I would put my own NPC Type reference table but I'm currently too lazy. Please refer to your map editor's NPC list or this Cave Story NPC Spreadsheet instead.
Overriding NPCs
ModCS allows you to override an NPC type's act code. If a function in the ModCS.Npc.Act
array is defined with the index X
(where X
is the NPC Type ID of the NPC Type you want to override) in your Lua script the game will run that function instead of the built-in NPC act code. A ModCS.Npc will be passed as the first argument of the function when it's called.
Example
This example will set the Rect of NPC Type 0 (The Null NPC) to 16,0,32,16.
1 2 3 |
|