Attention: This page contains dead links!
Note: Intergrated by using "NPC.config" since SMBX2 Beta 4
Download the latest version
This library is mostly untested, and could cause problems if used.
This library allows access to the data usually set by NPC text files from Lua code. You can read and alter these values during the game.
Note: Not all values can be set meaningfully at runtime. Some only apply to newly spawned NPCs, but existing NPCs can have the same values edited using the NPC class.
To use the library, put the npcconfig.lua file in either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.
How to Use
First, import the library using this line:
npcconfig = API.load("npcconfig");
Then, you can access fields using this format:
For example, to get the current width of the Axe NPC, you could write:
This is a list of all the fields available to the npcconfig structure. Any beginning with def_ are the default values. These are copied into their respective regular values when a level loads. This is useful for changing the behaviour of NPCs for an entire set of levels.
Any in this list that are in bold are known to work. Any that are
struck out are known to only apply to newly spawned NPCs (though gfxwidth and gfxheight are also known to potentially cause existing NPCs to vanish).
width height gfxwidth gfxheight
- blockplayertop (may actually be playerblocktop)