Post your modding questions here

Locked
User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

thisrandomer wrote:What does it mean when you try to run a mod and it says ServerError: LuaError: error: C:/Minetest\bin\..\mods\mobs/api.lua:1209: attempts to call field 'is_protected' (a nil value) ?
It means in line 1209 it is asking for the variable "is_protected". The variable is either non existent or is set to nil.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

l think it rather tries to get this variable from some table because it is called field.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

thisrandomer
New member
Posts: 2
Joined: Sun Oct 11, 2015 16:02

Re: Post your modding questions here

by thisrandomer » Post

Don wrote:
thisrandomer wrote:What does it mean when you try to run a mod and it says ServerError: LuaError: error: C:/Minetest\bin\..\mods\mobs/api.lua:1209: attempts to call field 'is_protected' (a nil value) ?
It means in line 1209 it is asking for the variable "is_protected". The variable is either non existent or is set to nil.
How do I fix this?

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

thisrandomer wrote:
Don wrote:
thisrandomer wrote:What does it mean when you try to run a mod and it says ServerError: LuaError: error: C:/Minetest\bin\..\mods\mobs/api.lua:1209: attempts to call field 'is_protected' (a nil value) ?
It means in line 1209 it is asking for the variable "is_protected". The variable is either non existent or is set to nil.
How do I fix this?
What mobs mod is this from?
Did you make any changes to the mod?
I am just guessing but the is_protected thing is from this.
http://dev.minetest.net/minetest.is_protected

You can look at that to see if it helps. If not please post the block of code at line 1209.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
BrunoMine
Member
Posts: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

keeping an item used in the craft?

by BrunoMine » Post

I want to keep an item used in the creation of another item revenue.
please. how can I do it?

User avatar
mrob27
Member
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27
Contact:

Re: Post your modding questions here

by mrob27 » Post

How is one expected to get the collisionbox or visual_size, and other useful properties, of an entity whose name is "_builtin:item"?

I would also appreciate it if someone could answer this post by Ferk from last month which seems to have been ignored.

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: keeping an item used in the craft?

by rubenwardy » Post

BrunoMine wrote:I want to keep an item used in the creation of another item revenue.
please. how can I do it?
See replacements.

http://rubenwardy.com/minetest_modding_ ... aft-shaped
https://github.com/rubenwardy/food/blob ... t.lua#L128
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

T3kW4ffl3
Member
Posts: 16
Joined: Thu Oct 08, 2015 20:36
GitHub: n0taD1m3
IRC: Uhm
In-game: TekWaffle

Re: Post your modding questions here

by T3kW4ffl3 » Post

I don't know if this has been asked but how do you add randomly generated structures, that are created in World Edit
Stay Toast
つಠ益ಠ༽つ # (ʘ言ʘ╬) -"WAFFLE!"
╰〳 ಠ 益 ಠೃ 〵╯ RAISE YOUR DONGERS

Irish
Member
Posts: 14
Joined: Mon Sep 14, 2015 22:39

Re: Post your modding questions here

by Irish » Post

Is there any kind of tutorial for starting out with World Edit?

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Irish wrote:Is there any kind of tutorial for starting out with World Edit?
In the mod folder there is a file that explains the commands. I think it's called chatcommands.txt
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

T3kW4ffl3
Member
Posts: 16
Joined: Thu Oct 08, 2015 20:36
GitHub: n0taD1m3
IRC: Uhm
In-game: TekWaffle

Re: Post your modding questions here

by T3kW4ffl3 » Post

T3kW4ffl3 wrote:I don't know if this has been asked but how do you add randomly generated structures, that are created in World Edit
Could someone please answer this?
Stay Toast
つಠ益ಠ༽つ # (ʘ言ʘ╬) -"WAFFLE!"
╰〳 ಠ 益 ಠೃ 〵╯ RAISE YOUR DONGERS

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

T3kW4ffl3 wrote:
T3kW4ffl3 wrote:I don't know if this has been asked but how do you add randomly generated structures, that are created in World Edit
Could someone please answer this?
All I can suggest is look at villages mod
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

T3kW4ffl3
Member
Posts: 16
Joined: Thu Oct 08, 2015 20:36
GitHub: n0taD1m3
IRC: Uhm
In-game: TekWaffle

Re: Post your modding questions here

by T3kW4ffl3 » Post

Thank you @Don
Stay Toast
つಠ益ಠ༽つ # (ʘ言ʘ╬) -"WAFFLE!"
╰〳 ಠ 益 ಠೃ 〵╯ RAISE YOUR DONGERS

User avatar
iangp
Member
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp
Location: Brasil - ES

Re: Post your modding questions here

by iangp » Post

Some one know if I can place nodes directly at Sqlite3 data base?
I want understand how to do it
The table look like these:
<pos,data>
pos -> a strange integer
data -> a blob of data

I want work with a bunch of nodes (Another MT-MC map converter... for getting all nodes of the MC map [this part it's done, conversion algorithm for MT it's done, now I'm adding the data to conversion table], I'm using the pymclevel...)

It's very slow use lua for place nodes so... I want use python sqlite3 connector
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

maybe you can find some informations about it there
https://github.com/minetest/minetest/tree/master/src

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
iangp
Member
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp
Location: Brasil - ES

Re: Post your modding questions here

by iangp » Post

Jeez O_ô
the source code in C++ (I'm not a C programmer, It's a uggly thing, but powerful)...
thanks HybridDog...
if the python access the database directly the conversion could be more faster...
someday I'll study the code...

but now python it is creating a '.csv' file but it's very slow...
and lua mod access the csv and place the nodes...
I already test with a single wall of blocks and looks tasty ^_^
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


User avatar
iangp
Member
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp
Location: Brasil - ES

Re: Post your modding questions here

by iangp » Post

Image
Image
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Post your modding questions here

by rubenwardy » Post

I just see a grey circle with a horizontal bar across it ^

I suggest pasteboard.co or imgcru.sh
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
iangp
Member
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp
Location: Brasil - ES

Re: Post your modding questions here

by iangp » Post

rubenwardy wrote:I just see a grey circle with a horizontal bar across it ^

I suggest pasteboard.co or imgcru.sh
https://goo.gl/photos/rN2BDaEEN5cJncVK9
https://goo.gl/photos/EX2KDCax5R4NC3oP6
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Post your modding questions here

by Sokomine » Post

T3kW4ffl3 wrote: I don't know if this has been asked but how do you add randomly generated structures, that are created in World Edit
My mg_villages mod does that. I havn't officially released it yet because I need to write a lot of documentation about it, but it ought to be easy enough to just use it. I've even created some example village types that show how to add your own houses.
A list of my mods can be found here.

User avatar
iangp
Member
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp
Location: Brasil - ES

Re: Post your modding questions here

by iangp » Post

Hybrid Dog wrote:maybe you can find some informations about it there
https://github.com/minetest/minetest/tree/master/src
I found the position algorithm!

It seems easy to implement...
I think i'm on the right way

Code: Select all


#include "database.h"
#include "irrlichttypes.h"


/****************
 * Black magic! *
 ****************
 * The position hashing is very messed up.
 * It's a lot more complicated than it looks.
 */

static inline s16 unsigned_to_signed(u16 i, u16 max_positive)
{
	if (i < max_positive) {
		return i;
	} else {
		return i - (max_positive * 2);
	}
}


// Modulo of a negative number does not work consistently in C
static inline s64 pythonmodulo(s64 i, s16 mod)
{
	if (i >= 0) {
		return i % mod;
	}
	return mod - ((-i) % mod);
}


s64 Database::getBlockAsInteger(const v3s16 &pos)
{
	return (u64) pos.Z * 0x1000000 +
		(u64) pos.Y * 0x1000 +
		(u64) pos.X;
}

v3s16 Database::getIntegerAsBlock()
{
	v3s16 pos;
	pos.X = unsigned_to_signed(pythonmodulo(i, 4096), 2048);
	i = (i - pos.X) / 4096;
	pos.Y = unsigned_to_signed(pythonmodulo(i, 4096), 2048);
	i = (i - pos.Y) / 4096;
	pos.Z = unsigned_to_signed(pythonmodulo(i, 4096), 2048);
	return pos;
}

God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


User avatar
Merlin
Member
Posts: 63
Joined: Tue Dec 09, 2014 22:07
GitHub: sct-0
In-game: my
Location: germany

Re: Post your modding questions here

by Merlin » Post

How does that whole animation stuff work?

I am planning on making some mods which add different categories of animal mobs (like farm animals), and so far I've been understanding a lot by examining PilzAdams Simple Mobs and the answer to my last question from 4aiman (thanks again mate!), but set_animation and the animation table are still a big riddle to me.
Any in depth explanation of that stuff would be greatly appreciated (and I guess not only by me).

User avatar
mrob27
Member
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27
Contact:

Re: Post your modding questions here

by mrob27 » Post

[color=#1781B7]Merlin[/color] wrote:How does that whole animation stuff work?
I am planning on making some mods which add different categories of animal mobs (like farm animals), and so far I've been understanding a lot by examining PilzAdams Simple Mobs and the answer to my last question from 4aiman (thanks again mate!), but set_animation and the animation table are still a big riddle to me.
Any in depth explanation of that stuff would be greatly appreciated (and I guess not only by me).
I analysed @PilzAdam's Simple Mobs and can answer your question for the sheep. Perhaps this is what you're looking for (but there are probably other ways to do animation in Minetest).

@PilzAdam used a DirectX .x file to specify the sheep's shape, appearance and animation using an armature or kinematic chain model. The position and orientation of the sheep is given by six coordinates (x, y, z, pitch, yaw, roll). Parts of the sheep like the head and legs are attached to the main body. Each part has its own 6 position/rotation coordinates that are relative to the position of the main body. Armature parts are sometimes called "bones" because the whole model is like a skeleton with many moving parts attached to each other. But bones don't have to move on a single fixed joint, they can move in any way permitted by the 6 coordinates. They can even change in size during animation.

There is no calculation of physics within the individual parts of the sheep. The whole thing has velocity and acceleration, and it collides with something (ground, wall, etc.) and stops moving in that direction when it collides; but there is no separate collision of individual parts of the sheep. When the sheep stops, the legs and head stop with it.

In mobs_sheep.x, the main body of the sheep is Armature_Root, the legs are Armature_Bone_001, Armature_Bone_002, Armature_Bone_003 and Armature_RR_leg, and the head is Armature_Head. The first thing we see is a bunch of matrices giving the relative size and orientation (rotation) of each of the bones in the start position.

Next is the skin. This is a mesh (a table of polygons, in this case "quads" which are four-sided polygons) starting with the line that says "Mesh { //Cube_000 Mesh". First there are 500 sets of 3D coordinates, which are the vertices (corners) of the polygons. Then we have 125 polygons, each given as something like "4;24;25;26;27;," which means a quad that uses vertices 24 through 27 as its four corners. Then we have "mesh normals", which are vectors telling what direction each vertex should be considered to be pointing, these are used in calculating lighting and reflection of light off of the surface. Then we have a MeshMaterialList which isn't really being used, because this object uses a texture (PNG file) instead. Then we have the MeshTextureCoords table, which tells where each vertex gets its colour given as a 2-dimensional coordinate within the PNG file (which goes from 0.00 to 1.00 in both directions X and Y)

When the parts of an armature move, different parts of the skin will follow different bones as they move. Some parts of the skin can be told to follow multiple bones with fractional amounts, called "skin weights". These are given in the SkinWeights tables in mobs_sheep.x, with entries for each vertex (500 vertices total, with a table for each of the 6 parts of the sheep). All the skin weights are 1.00, that means that each piece of the sheep moves by itself and there is no partial movement of the skin near the joints.

Finally we have the animation. Each of the 6 pieces has a set of animation frames, called AnimationKey, that is given in three parts: position, rotation, and scale. Each AnimationKey has 165 frames.

The AnimationKey tables are fairly boring, almost every line of data is identical. But go down to "Animation { {Armature_RR_leg} AnimationKey {" and skip down to the "Rotation" section and eventually you'll see this:

Code: Select all

      80;4;   -0.000000, 1.000000, 0.000000,-0.000000;;,
      81;4;   -0.023017, 0.996971,-0.000000,-0.000000;;,
      82;4;   -0.087830, 0.988440,-0.000000,-0.000000;;,
      83;4;   -0.171026, 0.977486,-0.000000,-0.000000;;,
      84;4;   -0.235816, 0.968955,-0.000000,-0.000000;;,
      85;4;   -0.258819, 0.965926,-0.000000,-0.000000;;,
   [more lines here]
      99;4;    0.023017, 0.996971, 0.000000,-0.000000;;,
      100;4;  -0.000000, 1.000000, 0.000000,-0.000000;;,
Frames 80 through 100 tell that this piece (one of the legs) should rotate. It doesn't rotate much: the furthest it gets is about 0.25 in either direction, with 0.96 on the other coordinate, these are the sine and cosine of 15 degrees. So they set up the legs to move 15 degrees forwards and back when the sheep walks.

That's all we find in mobs_sheep.x, but there is one more important part in how the animation is specified.

In init.lua, or in sheep.lua if your mod has the animals in separate init files, the sheep's animations are specified like this:

Code: Select all

	animation = {
		speed_normal = 15,
		stand_start = 0,
		stand_end = 80,
		walk_start = 81,
		walk_end = 100,
	},
This means that when the sheep is walking, Minetest should use animation frames 81 through 100 to specify how each of the armature parts are moved.

Notice that when the sheep is standing, it uses animation frames 0 through 80. These frames don't move the legs at all, but the head moves a little during frames 1-58 (look for "1;4; 0.000000, 0.000000, 0.706989, 0.707223;;,"). Also, frames 101 through 164 aren't being used at all.

We don't know what tools @PilzAdam used to create this, but Blender exports to DirectX and appears to be able to create this type of model. Here is a link to the Armatures section of the Blender online documentation: Armatures. There are a lot of very complex things you can do in Blender models, but Minetest will only support the ones that are directly provided by Irrlicht.

There is a page on the Minetest wiki about this: Using Blender

As I mentioned at the start, there are other ways to get models into MineTest. For example, my portalgun mod originally by @UjEdwin uses "Alias Wavefront OBJ files" that were made in SketchUp. This page describes the texture and mesh file formats supported by Irrlicht.
Last edited by mrob27 on Sun Oct 18, 2015 00:42, edited 2 times in total.

User avatar
Merlin
Member
Posts: 63
Joined: Tue Dec 09, 2014 22:07
GitHub: sct-0
In-game: my
Location: germany

Re: Post your modding questions here

by Merlin » Post

Now, thank YOU!
Your explanation is amazing! Thanks (again) for taking the time to write this.
Animation was/is nearly the last riddle on my list to be able to create my mobs.
You helped me loads, I'll go looking for some tutorials on making such models.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

I am trying to learn how to save a simple table and then read from it. Can someone point me to the right info to learn it?

All I want to do is have a table like this

Code: Select all

mytable = {
   item1 = "something",
   item2 = "something",
   item3 = 4
   }
It needs to save strings and numbers. When I have tried I always get an error of expected string, got nil
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

Locked

Who is online

Users browsing this forum: No registered users and 1 guest