modding tutorial. Yes, I'm partially new.

ilikecheesecake
Member
 
Posts: 11
Joined: Sun Dec 15, 2013 14:16

modding tutorial. Yes, I'm partially new.

by ilikecheesecake » Sun Dec 15, 2013 15:10

Hi! I've been playing MT for a few months now, and have started modding about 2 weeks ago. Well, here goes my first tutorial!

A mod is a modified version of a game, not really a lot has changed. Maybe 5 to 10 features, maybe a lot more, but the whole game didn't change. For example, Call of Duty is a very intense game, especially the programming. It would take years to program a game even half identical to the game. That's where modding comes in. If you mod the game, it can add features little by little, eventually getting better, or even worse if your mod is buggy. Let's get started!

LUA is a object oriented programming language. That means there are objects communicating with one another using so called 'methods', or 'functions'. These functions are like jobs. For example, you can have a remote object. one method might be to change the channel. You could use this by using the change channel method on a remote object. Here's a simple (JAVA) code to let you see how objects work.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
public class ObjectTutorial {
  class Remote {
    int channel;
    public Remote(int ch) {
      this.channel = ch;
    }
    public void changeChannel(int channelnum) {
      this.channel = channelnum;
    }
    public int getChannel() {
      return channel;
    }
  }
  public static void main(String[] args) {
    Remote remote = new Remote(70);
    int channel1 = remote.getChannel();
    System.out.println("CURRENT CHANNEL: " + channel1);
    remote.changeChannel(25);
    System.out.println("CHANNEL NOW: " + remote.getChannel());
  }
}

correct me if i'm wrong, but it should output:
CURRENT CHANNEL: 70
CHANNEL NOW: 25

.

Anyway, let's get modding!

First, make a directory called whatever you want to name your mod. I recommend placing a mod folder in the desktop, and putting your mod's folder in that. For example, /desktop/mods/modname.
Now, in the folder, put a folder called textures, and another called sounds.
so now, it should look like this:
desktop:mods:modname:
textures
sounds

.


Now, make 2 files, init.lua, and depends.txt.
in the texture folder, create a block. Basically, just put a single color 60*60 png image in it for now. Name it let's say, block.
Now, in the init.lua file, type:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("modname:block", {
  tiles = {"block.png"},
  description = "block",
  groups = {cracky=2}
})
Now, drop the modname folder into the /mods folder in minetest directory.
for example, /minetest-version-num/mods/awesomemod/

DONE!
Boot up minetest, and hit configure, and enable your mod!
Video tut coming soon!
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Sun Dec 15, 2013 15:14

Lua is not really object orientated.

You can kind of create classes, but they are really just tables.

likecheesecake wrote:A mod is a modified version of a game


This is not really true for Minetest's Lua Mods.
A mod is a collection of scripts and resources that define or change nodes, ingame items, and functionality.

ALL CONTENT (NODES, ITEMS, TOOLS) IS DEFINED BY LUA MODS.

http://dev.minetest.net/terminology

Developers Wiki wrote:Mods are plugins that use the Lua modding API to modify, extend or add features and blocks.



You should not use 60x60 images. Use the 2^n scale:

  • 16 x 16
  • 32 x 32
  • 64 x 64
  • 128 x 128
  • 256 x 256
  • 512 x 512
  • 1024 x 1024
Last edited by rubenwardy on Sun Dec 15, 2013 15:19, edited 1 time in total.
 

ilikecheesecake
Member
 
Posts: 11
Joined: Sun Dec 15, 2013 14:16

by ilikecheesecake » Sun Dec 15, 2013 15:40

ok, thanks. I made a video. like i said, I started modding 2 weeks ago. about 13 days to be exact. Here's my video. http://www.youtube.com/watch?v=l0rar1pPoRk
 

User avatar
hoodedice
Member
 
Posts: 1372
Joined: Sat Jul 06, 2013 06:33

by hoodedice » Mon Dec 16, 2013 09:19

You didn't explain what each piece of code does. Currently, to someone new to programming, both your java code and Lua code are as clear as mud. Try to explain what you're doing and why you're doing it, what you can do, what are you limited by, etc.
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
 

ilikecheesecake
Member
 
Posts: 11
Joined: Sun Dec 15, 2013 14:16

by ilikecheesecake » Tue Dec 17, 2013 19:37

hoodedice wrote:You didn't explain what each piece of code does. Currently, to someone new to programming, both your java code and Lua code are as clear as mud. Try to explain what you're doing and why you're doing it, what you can do, what are you limited by, etc.

A little constructive advice maybe? Please don't be rude.
 

ilikecheesecake
Member
 
Posts: 11
Joined: Sun Dec 15, 2013 14:16

by ilikecheesecake » Tue Dec 17, 2013 19:38

hoodedice wrote:You didn't explain what each piece of code does. Currently, to someone new to programming, both your java code and Lua code are as clear as mud. Try to explain what you're doing and why you're doing it, what you can do, what are you limited by, etc.

A little constructive advice maybe? Please don't be rude.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron