TheoTown

TheoTown

Not enough ratings
How to create your own plugin | TheoTown
By volshebnik
Detailed explanation on how to create your own plugin in TheoTown.
   
Award
Favorite
Favorited
Unfavorite
Creating a Plugin Image
The plugin image can be drawn in a drawing program, I personally use Pixel Studio.

For ease of drawing, you can draw a grid for the base of the plugin.















Your plugin should be positioned on the grid so that its outermost pixels touch each step of the pixel ladder by half.
Like this















It will be more clear using the example of a plugin.















When approaching the completion of the drawing, you need to get rid of the remnants of the grid and crop the picture exactly along the edges.
Like this















If you want to make a plugin with night animation (for example, light from windows or glowing banners), with a winter view and all this with rotation mechanics, then you need to prepare similar images.



You can add 2 or 4 rotation options, so if you want two, then make similar pictures with only two views of the house for, normal view, animation and winter view.
Creating a plugin folder
To create a plugin folder you need to follow the link. Plugin creator website[pca.svetikas.lt].
Now I will explain each setting on this site. Some settings can be changed after creating the folder, so changing them on the site does not matter, since now it is important to create a folder with the necessary files. I’ll tell you in the description of the settings which settings this applies to

  • Manifest ID
    Do not change.

  • Version
    Leave at 1.

  • Name
    Name of your plugin.

  • Description
    Description of your plugin.

  • Author
    Your name or nickname, whatever you want.

  • Select draft type
    Select your plugin type. For example, residence, commerce, industry or something else. Then click on the arrow on the right to open additional settings. For some reason, after clicking the arrow, the draft type disappears, so select the type again.

  • Frames
    Click "Add Custom Frame" and select an image from your files. If there are several of them, do this as many times as you have images. For example, if you have a regular image, a winter image and a night animation image, then you need to add 2 frames.

  • Width and Height
    It doesn't matter to change.

  • Level
    Choose any level.

  • Optional attributes
    If your plugin is residence, commerce, industrial, then it is better not to choose anything (the game will determine the price and number of people itself). If this is not the case, then select the attributes you need. For some reason, the list of attributes does not scroll well with the mouse wheel, this can cause problems.

  • Click "Export as zip archive"
    The zip archive will download. Unzip the downloaded zip archive and open the unzipped folder. It should contain images for your plugin, a manifest file and a JSON code file.
If everything is in order, then congratulations, you managed to create the plugin folder.
Editing the manifest file.
  1. In the plugin folder, open the manifest file using Notepad and use the example provided to check the correctness.
    { "id": "ID of your plugin", "version": 1, "title": "name of your plugin", "text": "description of your plugin", "author": "your name" }

  2. If you want, you can add a built-in translation using a tag.
    Text[tag]Translation
    For example, a code with translation into Russian.
    { "id": "ID of your plugin", "version": 1, "title": "Earth[ru]Земля", "text": "Planet[ru]Планета", "author": "your name" }
    Learn more about built-in translations on the site Plugin inline translation - TheoTown[forum.theotown.com].

  3. If you are satisfied with everything, you can save the file and close it.
Editing json code
In the plugin folder, open the json code file using Notepad. To avoid confusion, copy this code somewhere. You can delete the code text, since you will be working with ready-made codes; your task will be to copy, paste and edit for your plugin. And now a list of json codes with a description will be presented.

An example of json code for a plugin without rotation mechanics, with animation and a winter look.
[ { "id": "ID of your animation", "type": "animation", "light": true, "light switching": true, "frames": [{"bmp": "[i]name of your picture[/i]",}], "rotation aware": false }, { "id": "ID of your plugin", "type": "your plugin type", "level": select level from 1 to 3 if your plugin is residential, commercial, industrial, "author": "your name", "width": the width of your plugin (must match the height), "height": the height of your plugin (must match the width), "frames": [{"bmp": "[i]name of your picture[/i]"}], "frames winter": [{"bmp": "[i]name of your picture[/i]"}], "animation": [{"id": "[i]ID of your animation[/i]", "x":number,"y":number}] } ]
For example
[ { "id": "$Volshebnik33_GreenHouse_Night_Light", "type": "animation", "light": true, "light switching": true, "frames": [{"bmp": "nightlight.png",}], "rotation aware": false }, { "id": "$Volshebnik33_GreenHouse", "type": "residential", "level": 2, "author": "Volshebnik33", "width": 2, "height": 2, "frames": [{"bmp": "greenhouse.png"}], "frames winter": [{"bmp": "greenhouse_winter.png"}], "animation": [{"id": "$Volshebnik33_GreenHouse_Night_Light", "x":0,"y":-36}] } ]
Example of json code for a plugin with rotation mechanics, animation and winter look.
[ { "id": "ID of your animation", "type": "animation", "light": true, "light switching": true, "frames": [ { "bmp": "name of your picture", "count": 2 or 4, "h": height of one rotation, "w": width of one rotation } ], "rotation aware": true }, { "id": "ID of your plugin", "type": "your plugin type", "level": select level from 1 to 3 if your plugin is residential, commercial, industrial, "author": "your name", "width": the width of your plugin (must match the height), "height": the height of your plugin (must match the width), "frames": [ { "bmp": "name of your picture", "count": 2 or 4, "h": height of one rotation, "w": width of one rotation } ], "frames winter": [ { "bmp": "name of your picture", "count": 2 or 4, "h": height of one rotation, "w": width of one rotation } ], "animation": [{"id": "[i]ID of your animation[/i]", "x":number,"y":number}] } ]
For example
[ { "id": "$Volshebnik33_GreenHouse_Night_Light", "type": "animation", "light": true, "light switching": true, "frames": [ { "bmp": "nightlight.png", "count": 4, "h": 52, "w": 64 } ], "rotation aware": true }, { "id": "$Volshebnik33_GreenHouse", "type": "residential", "level": 2, "author": "Volshebnik33", "width": 2, "height": 2, "frames": [ { "bmp": "greenhouse.png", "count": 4, "h": 52, "w": 64 } ], "frames winter": [ { "bmp": "greenhouse_winter.png", "count": 4, "h": 52, "w": 64 } ], "animation": [{"id": "$Volshebnik33_GreenHouse_Night_Light", "x":0,"y":-36}] } ]

If in your first copied code there were lines that were not in these codes, then these should be attributes if you added them on the site. These lines need to be added to the code in one row, for example in one row with the plugin type.
If you don’t need animation or a winter look, you can simply remove them from the code, but so that other attributes are not violated, so that this does not happen, you can check the correctness of the json code on the site JSON Editor Online: edit JSON, query JSON[jsoneditoronline.org]
If everything is correct, then save the file and close.
Explanation of coordinates for animations
The coordinate count starts approximately from the leftmost pixel. For some reason, the numbers on the “y” axis are in the reverse order, up decreases and down increases.
Adding a plugin to the game
After the completed actions, you should have your folder with your full plugin.
There are two ways to add your plugin to TheoTown.

Method 1. Local plugin
This method allows you to add your plugin to the game as local, that is, you will not be able to use it in an online game.
Adding a plugin this way is very easy. Just copy the plugin folder and paste it into the TheoTown plugins folder along this path
C:\Users\username\TheoTown\plugins
Afterwards you need to go to TheoTown, if the game starts, then your plugin is working, if after loading you get an error screen, then there is an error in the json code.
This way you can check whether the animation image matches the plugin image, and indeed whether the plugin works as you want.

Method 2: Adding a plugin to the TheoTown forum
To add a plugin to the forum, you need to archive your plugin in a zip archive. Then you need to go to TheoTown forum page to add the plugin - TheoTown - Plugin Upload[forum.theotown.com]. There will be a detailed description for each line. After setting, click "Submit". Your plugin must be added. Your plugin will soon be reviewed by moderators. If your plugin is approved, you can search for your plugin in the game :)

That's all. I hope this guide was helpful to you.
Links that may be useful
1 Comments
Mr.Nibehrkryaker 18 Oct, 2024 @ 11:51am 
I wish devs would give modders a better documentation. Requirements key in json, for example, is not described at all. Great guide btw :3