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!