Editor splash

Custom NPC > What is NPC.txt?

NPC.txt is a custom configuration file which have name like npc-12.txt, npc-46.txt and contains the some parameters for custom NPC. The NPC.txt came from SMBX 1.3 and this is a part of SMBX64 standard.



The NPC.txt have limited options for using, and PGE can use more options than SMBX. Unknown options will be ignored by SMBX.


Parameter Values Description
SMBX64 Standard (working with SMBX)
gfxoffsetx= [+/- numbers] (moves the graphic in the x direction)
gfxoffsety= [+/- numbers] (moves the graphic in the y direction)
width= [+numbers] (NPC's width)
height= [+numbers] (NPC's height)
gfxwidth= [+numbers] (graphics width)
gfxheight= [+numbers] (graphics height)
score= [0-13] (score you get by killing: 0 10 100 200 400 800 1000 2000 4000 8000 1up 2up 3up 5up)
playerblock= [1,0] (makes NPCs act like blocks to the players)
playerblocktop= [1,0] (makes the player able to stand on the NPC)
npcblock= [1,0] (makes the NPC act like a block to other NPCs)
npcblocktop= [1,0] (makes NPCs able to stand on the NPC)
grabside= [1,0] (gives the player the ability to grab NPCs from the side)
grabtop= [1,0] (gives Mario the ability to grab NPC's like shy guys)
jumphurt= [1,0] (if set to 1, the player gets hit from landing on the enemy)
nohurt= [1,0] (if true the NPC doesn't hurt you)
noblockcollision= [1,0] (if true the NPC doesn't interact with blocks)
cliffturn= [1,0] (if true enemy turn on a cliff)
noyoshi= [1,0] (if true you can't eat the NPC)
foreground= [1,0] (if true the NPC is in front of everything)
speed= [+/-numbers] Speed multiplier: how fast the NPC moves (the number is what the speed is multiplied by: 0 = no speed, 1 = default, 2 = twice as fast as default, 3 = thrice as fast etc.*
Negative values make it move backwards.)
nofireball= [1,0] (if true the NPC can't be killed by fireballs)
nogravity= [1,0] (if true the NPC walks in the air)
frames= [+number] (sets the number of frames the NPC should have)
framespeed=# Frame speed modificator: how fast the NPC animates (0-7 are eighths of the default speed, 8 is the default speed and 9 and bigger are the default speeds multiplied **)
framestyle= [0,1,2] (names the style the frames should switch ***)
noiceball= [1,0] (if true enemy can't freeze when an ice ball touches it)
Extended values (not working inside SMBX)
nohammer= [1,0] (if true enemy can't be killed by hammer) (*)
noshell= [1,0] (if true enemy can't be killed by shell or other NPCs) (*)
name= "string" or string Defines the NPC's name which will be used in the editor.
health= [+numbers] Defines the health value of NPC.
Useful for creation of powerful enemies or bosses.
grid= [+numbers] Re-defines alignment grid size for this NPC
gridoffsetx= [+/-numbers] Defines horisontal offset at aligned by grid coordinate value
gridoffsety= [+/-numbers] Defines vertical offset at aligned by grid coordinate value
gridalign= [+numbers] Defines align mode: 0 - at center of the global cell, 1 - at edge of the global cell.
image= "string" or string Defines the sprite image file name. Allows to have a custom image file names.
script= "string" or string Custom NPC-AI Algorithm script.



*  Speed value clarification:


speed=0 - the NPC stands still. If the player is able to stand on this NPC (playerblocktop=1), the NPC acts like a conveyor belt to the player (and other NPCs).

speed=1 - does no change to the NPCs speed. It's like multiplying the speed by 1 which does nothing if you know maths at all.

speed=2 - makes the NPC twice as fast as the original speed.

speed=3 - makes the NPC thrice as fast as the original speed (and so on).

So, basically, the value you put to the speed= code is the number that the speed is multiplied by.

Also, some people like to use decimals (e.g. 1.5) in the speed= NPC code, because without them you can't change the NPCs speed to other than 200%, 300%, 400% etc. and, what's more important, you can't make the NPC slower. E.g. with the value 0.5 you can make the NPC two times slower, and with 1.5 you can make the NPCs speed one and half times higher. Decimals work on some people, but on a good portion of people, they make the level crash on load.

Note: Original SMBX have a bug: do not use decimal values in NPC codes if you want use them with SMBX. It causes crashing of SMBX on some people. In the PGE and in the LunaLUA-SMBX this bug absence, and you have a full freedom for use decimal values. But if you want use decimal values inside SMBX, you must have in the "International standards" settings the dot "." character instead a comma "," character as decimal separator. LunaLUA-SMBX fixes this bug with forcing SMBX Engine to think that current standards are configured to "United States".




** Frame speed value clarification:

framespeed=1 - eight times faster than the original frame speed.

framespeed=2 - four times faster than the original speed.


framespeed=4 - two times faster than the original speed.


framespeed=8 - normal. No changes to the framespeed.


framespeed=16 - half as fast as the original framespeed.

So, if you're good at maths, you can see that the framespeed= values are eights of the original frame frequencies. 1 makes it 8 times faster, 8 does nothing and 16 makes it twice as slow. So, in percentage, the values would go like this:

framespeed=1 - 800%

framespeed=2 - 400%

framespeed=3 - 267% (rounded)

framespeed=4 - 200%

framespeed=5 - 160%

framespeed=6 - 133% (rounded)

framespeed=7 - 114% (rounded)

framespeed=8 - 100%

framespeed=9 - 89% (rounded)

framespeed=10 - 80%

framespeed=11 - 73% (rounded)

framespeed=12 - 67% (rounded)

framespeed=13 - 62% (rounded)

framespeed=14 - 57% (rounded)

framespeed=15 - 53% (rounded)

framespeed=16 - 50%





*** Framestyle number meanings:


acts like a goomba, means, both left and right movement use the same sprite.


the NPC have sprites for both left and right, the first half of the sprite sheet is for left movement, the later half is for the right movement.


NPC has both left and right movement, and upside down movement for when the NPC is grabbed (such as the SMB2 enemies).


Also, the value 0 on the NPC codes with a "no" beginning won't do anything. EXCEPT:


Return to top


NPC Graphics and FrameStyles

Framestyle 0

- Statical, you can use one image with one frame for item.


- Animated simple, have animated frames like blocks or BGO.



Framestyle 1

- Animated with left-right direction defining. Allows to define images for left and right NPC's direction.



Framestyle 2

- Animated with left-right-upper directions defining, Allows to define images for left and right NPC's directions and also left

 and right directions for upper state.



Framestyle 3 (is not available in the SMBX)

- Animated with rotation. Allows to define NPC's frames with round rotation (NPC should can adhease to celling and walls).



Algorithmic animation

- Animated with special animation algorithm. The NPC have algorithmic pre-defined frame sequance, and you can't redefine them if you will use your NPC in the SMBX.
To redefine animation you must edit / customize NPC-AI script for that purpose.





Return to top





<< Back

Copyright © 2014-2016 Platformer Game Engine by Wohlstand project.