Customizing NPCs in SMBX - Tutorial

Description: Casual SMBX discussion.
Moderators: Semi-moderatos, Moderators

h2643 M
Topic author, Forum admin
Forum admin
h2643 M
Topic author, Forum admin
Forum admin
Age: 20
Reputation: 110
Posts: 329
Joined: 15 Feb 2014
Location: Ukraine

Post #1by h2643 » 24 Aug 2015, 19:06

Super Mario Bros. X Customizing NPCs - Tutorial by Valtteri and h2643

1. Finding/creating a NPC graphic.
2. Creating an NPC Text file.
3. NPC Codes list.

1. Finding/creating a NPC graphic.

    So if you ever wanted to use custom NPCs in your SMBX levels, you probably were wondering on how to do that. Well, there are two ways: finding a graphic and creating a graphic.

    1) Finding needed graphics is easier. All you have to do is search for the graphics you need in a "Graphic Submissions" forum section: viewforum.php?f=10
    Or download The NEW SMBX CGFX Pack, it has pretty much everything that has been made by SMBX Community members: viewtopic.php?f=10&t=29

    2) Creating your own graphics, on the other hand, is a bit more complicated. To create a graphic, Paint.NET is recomended, as it's the most user-friendly image editing tool out there. If you have a good imagination at what you want to create, you're good to go. Also recoloring can be done with this tool too.

    Read more about how to create your own graphics here:
    or here:

2. Creating an NPC Text file.

    If the NPC you created is bigger or smaller than the original SMBX NPC (or if you just want to play with NPC behaviours), then you need to create an NPC Text file. It's needed as if your customized NPC won't have its own text file, it might appear glitched in SMBX. What you need to do is:

    1) Create a text file in the graphics folder for the level and name it after the NPC (if you want to apply codes to Goomba, name the .txt file as NPC-1, for example).
    2) Add the wanted codes with their values on their own lines. For example, let's customize a Goomba:

      Code: Select all


    The player would be able to walk on the Goomba, the Goomba would be invulnerable to fireballs, the Player would get hurt on top of it and the Goomba would add 1000 points to the player's total points when killed.

    3) Remember to add your new text file into the level folder (if you don't have a level folder, then create a new folder, name it after the level name (for example if your level name is "levelname.lvl", then name your level folder like "levelname", without quotes) and put your custom NPC graphics and your new text file in the folder).

3. NPC Codes list.

    Here's the list of possible NPC codes. When applying 1 or 0, 1 means yes and 0 means no.

    Graphical codes:

      gfxoffsetx=[+/- numbers] (moves the graphic in the x direction (left or right))
      gfxoffsety=[+/- numbers] (moves the graphic in the y direction (up or down))
      width=[+ numbers] (NPC's width)
      height=[+ numbers] (NPC's height)
      gfxwidth=[+ numbers] (graphic's width)
      gfxheight=[+ numbers] (graphic's height)
      frames=[+ number] (sets the number of frames the NPC should have)
      framespeed=# - 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***)

    Player Interaction codes:

      score=[0-13] (score you get by killing the NPC: none, 10, 100, 200, 400, 800, 1000, 2000, 4000, 8000, 1up, 2up, 3up and 5up)
      playerblock=[1,0] (makes NPCs act like blocks to the players)
      playerblocktop=[1,0] (makes the player 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)
      noyoshi=[1,0] (if true, Yoshi can't eat the NPC)
      nofireball=[1,0] (if true, the NPC can't be killed by fireballs)
      noiceball=[1,0] (if true, enemy can't freeze when an ice ball touches it)

    World Interaction codes:

      npcblock=[1,0] (makes the NPC act like a block to other NPCs)
      npcblocktop=[1,0] (makes NPCs able to stand on the NPC)
      noblockcollision=[1,0] (if true, the NPC doesn't interact with blocks)
      cliffturn=[1,0] (if true, enemy turn on a cliff)
      foreground=[1,0] (if true, the NPC is in front of everything)
      speed=[+/- numbers] - 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)
      nogravity=[1,0] (if true, the NPC walks in the air)

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

    So, do not use decimals in NPC codes. It causes crashing on some people. Thank you.

    **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:
      framestyle=0 - acts like a goomba, means, both left and right movement use the same sprite.
      framestyle=1 - 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.
      framestyle=2 - NPC has both left and right movement, and upside down movement for when the NPC is grabbed (such as the SMB2 enemies).

Have any questions? Ask them here.
<Knux> h2643 the super computer

PK Esper F
PK Esper F
Age: 14
Reputation: 108
Posts: 520
Joined: 22 Aug 2016
Location: The sky
Website Facebook Twitter

Post #2by PK Esper » 3 Oct 2016, 7:53

Wow,it looks useful to me. Thanks
why i hadn't been in this forum for long when i used to be a super active person
avatar is basically baldi from tumblr
Formerly known as RSupertheGreat.
What I support
Yes, I'm a girl. If you guys are thinking I'm a boy.
I hate most people.
I'm a developer (and a beta tester of):
My level/episode playthrough thread:

Return to “General”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest