Skip to content

Modders guide

Senjay-id edited this page Oct 10, 2024 · 16 revisions

Requirement

  • File archiver software, I recommend 7zip or Nanazip.

  • Any text editor software, the guide will use Visual Studio Code, I recommend to also get Stitch for VSC

  • UndertaleModTool
    Pick the one labeled with "Latest" and click the highlighted file
    image
    Extract using the mentioned file archiver to anywhere, I recommend C:\Modding\Tools\UndertaleModTool

  • Test.Project.zip - We'll be using this test game to mod it, extract anywhere.

  • GMLoader - This build of GMLoader is tuned for the Test Project, extract to where you've extracted the Test Project. It should look like this
    image

Getting started

In the test project, right click data.win and choose "open with" then "Choose another app" make sure that "Always use this app to open .win files" is ticked.
Click "More apps" scroll down to the bottom and click "Look for another app on this PC"
Navigate to where you've extracted the UndertaleModTool click UndertaleModTool.exe then Open.

Now you can open any data.win with ease
image

Patching the code

After opening the data.win click the Game objects and choose obj_player then click the triple dot
image

Now we have this
image

Let's try changing the max hp of the player to 125
Minimize UndertaleModTool and navigate to the Test Project folder, open the mods folder
Create a new file based on the name of the code which is gml_Object_obj_player_Create_0.gml
image
Open the file with any text editor mentioned above, head back to UndertaleModTool, copy the content of the code and paste to the file
image
Edit the maxHP = 100 into maxHP = 125 then press Ctrl + S to save the file.

Close UndertaleModTool, if it asks if you want to save changes then press no. head over to the Test Project folder and then run GMLoader.exe to patch the game

If you see the max hp has changed to 125 then congrats, you've patched the game's code.
image

Adding or modifying sprites

You can read the ImportSprite script below for a brief explanation.
Open the data.win and click the sprites tab then click spr_something to inspect the sprite and their properties.

Minimize UndertaleModTool and navigate to the test project folder.
Rename the sprite.png file into spr_something.png then copy to the mods\textures
Close UndertaleModTool and run GMLoader.exe to patch the sprite. The red square should now be changed into a player sprite.
image

Advanced C# scripting

GMLoader allows you to load CSharpScript files in which the file extension is ".csx"
You can load it before the builtin scripts at mods\csx\pre
Or you can load it after the builtin scripts at mods\csx\post
Or you can even load it after patching the data at mods\csx\after (Useful for sanity checking)

Whether to load it before or after the builtin scripts depends on your needs.
Below are builtin scripts included by GMLoader, they are loaded in alphabetical order.

ImportTexture

Allows you to import sprite assets at mods\textures or tilesets(background) sprites at mods\textures\backgrounds
If a sprite doesn't exists in the data, it will create a new sprite asset to the data, otherwise it will modify existing sprites.

Sprites
Sprites that has more than one frame will need to be converted to a strip format, refer to here.

A minimum naming convention of spriteName_f1.png is required for sprite assets, then you can add other suffixes to modify the sprite properties. The suffixes for sprite are
_f = the number of frames that the sprite has
_x = the origin position of x from the sprite
_y = the origin position of y from the sprite
_st = the speed type of the sprite, 0 for framespersecond || 1 for framespergameframe (More information)
_s = the speed of how much a sprite animation plays, has no effect for sprite that only has 1 frame
_b = the bounding box type of the sprite, 0 for automatic || 1 for fullimage || 2 for manual (More information)
_left = the left side collision box of the sprite, has no effect if the bounding box type is not manual (More information)
_right = same as above but right
_bot = same as above but bottom
_top = same as above but top

You can set the suffixes after _f in any order!
spriteName_f1_x6_y9 <== This is valid
spriteName_f5_b0_y5_x10 <== This is valid
spriteName_b1_x25_y50_f2 <== This is not valid
x6_spritename_y15_f1 <== This is not valid

Tilesets sprites
A minimum naming convention of spriteName_tc1.png is required for sprite assets, then you can add other suffixes to modify the sprite properties.
The suffixes for background sprite are
_tc = the tilecount of the sprite
_tw = the tile width of the sprite
_th = the tile height of the sprite
_x = the x output border of the sprite
_y = same as above but y
_col = the tile column of the sprite
_ipt = the number of item per tile

You can set the suffixes after _tc in any order!
spriteName_tc12_tw16_th32 <== This is valid
spriteName_tc5_x5_y5_col3 <== This is valid
spriteName_col5_x25_y50_tc24 <== This is not valid
x6_spritename_y15_tc2 <== This is not valid

If you don't set certain suffixes they will be defaulted to the config file.

ImportShader

Allows you to import shader files at mods\shader\any shader folder name

NewObjectManipulation

Allows you add a new object and manipulate their properties in form of json files.
The filename will be used as the object name (without .json)
You can use this config below as a template

{
    "Sprite": "s_playersprite",
    "Parent": "obj_controller",
    "TextureMaskID": "s_hitbox_player",
    "CollisionShape": "Box",
    "IsVisible": true,
    "IsSolid": false,
    "IsPersistent": false,
    "UsesPhysics": false,
    "IsSensor": false
}

Put the configuration files at mods\config\new_object

ImportGML

Allows you to import .gml files from mods\code
If you want to import collision files, you'll need to put them at mods\code\collision

ImportASM

Allows you to import .asm files from mods\code\asm

AppendGML

Allows you to append gml codes to any existing gml files instead of entirely replacing them.
You need to put the GML files at mods\code\appendgml\insertyourmodnamehere)

ExistingObjectManipulation

Same as the NewObjectManipulation but instead of adding a new object, it will manipulate existing object. You need to put the configuration files at mods\config\existing_object