Npcconfig.lua

From Moondust Wiki
Jump to navigation Jump to search

Attention: This page contains dead links!

Notice Note: Intergrated by using "NPC.config" since SMBX2 Beta 4


Download the latest version here.

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.


Installation

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:

npcconfig[NPCID].PROPERTY

For example, to get the current width of the Axe NPC, you could write:

npcconfig[178].width


Fields

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).

  • gfxoffsetx
  • gfxoffsety
  • width
  • height
  • gfxwidth
  • gfxheight
  • speed
  • isshell
  • blocknpc
  • blocknpctop
  • isinteractable
  • iscoin
  • isvine
  • iscollectablegoal
  • isflying
  • iswaternpc
  • jumphurt
  • noblockcollision
  • score
  • blockplayertop (may actually be playerblocktop)
  • grabtop
  • cliffturn
  • nohurt
  • blockplayer
  • grabside
  • isshoe
  • isyoshi
  • noyoshi
  • foreground
  • isbot
  • isvegetable
  • nofireball
  • noiceball
  • nogravity
  • frames
  • framespeed
  • framestyle
  • def_gfxoffsetx
  • def_gfxoffsety
  • def_width
  • def_height
  • def_gfxwidth
  • def_gfxheight
  • def_speed
  • def_isshell
  • def_blocknpc
  • def_blocknpctop
  • def_isinteractable
  • def_iscoin
  • def_isvine
  • def_iscollectablegoal
  • def_isflying
  • def_iswaternpc
  • def_jumphurt
  • def_noblockcollision
  • def_score
  • def_blockplayertop
  • def_grabtop
  • def_cliffturn
  • def_nohurt
  • def_blockplayer
  • def_grabside
  • def_isshoe
  • def_isyoshi
  • def_noyoshi
  • def_foreground
  • def_isbot
  • def_isvegetable
  • def_nofireball
  • def_noiceball
  • def_nogravity