Post your modding questions here

User avatar
Glorfindel
Member
 
Posts: 129
Joined: Tue Jul 07, 2015 20:05
GitHub: the1glorfindel
IRC: Glorfindel DoomWeaver
In-game: Glorfindel

Re: Post your modding questions here

by Glorfindel » Mon Jan 25, 2016 15:13

Is there a tutorial for creating textures for mods? What program is used usually, gimp?
 

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

Re: Post your modding questions here

by rubenwardy » Mon Jan 25, 2016 16:06

 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Mon Jan 25, 2016 17:13

everamzah wrote:The original furnace does not use a node timer, so why should Dragonop's claycrafter? I'd like to also point out that in minetest_game there are only two nodes which use node timers: Bones, and TNT. In my experience they are not always reliable.

the original furnace is bad, it doesn't work when the chunk isn't loaded, same for farming
 

Dragonop
Member
 
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop

Re: Post your modding questions here

by Dragonop » Mon Jan 25, 2016 18:19

Hybrid Dog: I will try but I don't think I want to do everything again.
Any suggestion when using timers? An example would help too, thanks btw.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Mon Jan 25, 2016 19:10

The conveyor_belt mod uses them: viewtopic.php?id=7350
 

Dragonop
Member
 
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop

Re: Post your modding questions here

by Dragonop » Mon Jan 25, 2016 21:24

Ah, I see, thanks Hybrid Dog. I'm in my way to rewrite my mod completely to make it "better", this will help.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Thu Jan 28, 2016 09:06

Does hp_max in the object properties table have any effect on players?
Every time a mod API is left undocumented, a koala dies.
 

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

Re: Post your modding questions here

by Merlin » Fri Jan 29, 2016 19:47

Hi,
I would like to add more animations to the animation table of PilzAdam's Simple Mobs (like the walk and stand animations).
I looked into the code of the API, but as it is not commented I have difficulties understanding what's going on.
Can anyone explain to me how I would go about adding new animations?
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Jan 29, 2016 20:12

as far as l know the animations are in the model file
 

User avatar
qwertymine3
Member
 
Posts: 194
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: Post your modding questions here

by qwertymine3 » Fri Jan 29, 2016 21:00

Merlin wrote:Hi,
I would like to add more animations to the animation table of PilzAdam's Simple Mobs (like the walk and stand animations).
I looked into the code of the API, but as it is not commented I have difficulties understanding what's going on.
Can anyone explain to me how I would go about adding new animations?


I'm not an expert on animation - but I've been playing around with the mob code for some time - so I think I can explain it:

+ User facing Def

+ Internal Def

+ To the point


I hope this helps
Avatar by :devnko-ennekappao:
 

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

Re: Post your modding questions here

by Merlin » Sat Jan 30, 2016 01:59

That sounds good, I'll try playing around with it and come back if any more questions occur.
I can model and already adapted my own chicken model to the code which is already there, I just wish for more diversity.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Sat Jan 30, 2016 05:06

When attaching an entity to another, how is the rotation argument formatted? Is it something like roll/pitch/yaw, or is it a direction vector?
Every time a mod API is left undocumented, a koala dies.
 

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

Re: Post your modding questions here

by Merlin » Sat Jan 30, 2016 22:25

Hey, I tried out what qwertymine3 had suggested, and it worked (thanks a bunch!), I just have one last bug:

The animation (pick) I added plays two times in a row instead of just one, the bug does not exist in the model and therefor must be caused by the code.
Here are the snippets I changed:

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
elseif type == "pick" and self.animation.current ~= "pick"  then
            if
               self.animation.pick_start
               and self.animation.pick_end
               and self.animation.speed_normal
            then
               self.object:set_animation(
                  {x=self.animation.pick_start,y=self.animation.pick_end},
                  self.animation.speed_normal, 0
               )
               self.animation.current = "pick"
            end


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

         if self.state == "stand" then
            if math.random(1, 4) == 1 then
               self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
            end
            self.set_velocity(self, 0)
            self.set_animation(self, "stand")
            if math.random(1, 100) <= 50 then
               self.set_velocity(self, self.walk_velocity)
               self.state = "walk"
               self.set_animation(self, "walk")
            elseif math.random(1, 100) >= 60 then
               self.set_velocity(self, 0)
               self.state = "pick"
               self.set_animation(self, "pick")
            end


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
   elseif self.state == "pick" then
            if math.random(1, 100) <= 30 then
               self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
            end
            self:set_animation("pick")
            self.set_velocity(self, 0)
            if math.random(1, 100) >= 10 then
               self.set_velocity(self, 0)
               self.state = "stand"
               self:set_animation("stand")
            end


I know that it can happen that, due to the math.random in the code above, the animation is executed two times (or more), which is fine by me, problem is, even when I set it to math.random(1, 100) >= 0 (which is always true), the animation plays two times.

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
animation = {
      speed_normal = 15,
      stand_start = 0,
      stand_end = 33,
      walk_start = 50,
      walk_end = 62,
      pick_start = 34,
      pick_end = 42,
   }
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

I have two questions.

by BrunoMine » Sun Jan 31, 2016 02:08

About method:
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.setting_set("name", "value")

He did not keep the values set after a server shutdown.

What the correct way to remove an element HUD?
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
waypoint = {
    hud_elem_type = "waypoint",
    name = "My pos",
    number = "0x000000",
    world_pos = {x=0,y=0,z=0}
}
player:hud_add(waypoint)
...
player:hud_remove(waypoint)

The above example does not remove the HUD of the waypoint.
Another question: how to know the id of an element of HUD?
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: I have two questions.

by Byakuren » Sun Jan 31, 2016 05:40

BrunoMine wrote:About method:
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.setting_set("name", "value")

He did not keep the values set after a server shutdown.

What the correct way to remove an element HUD?
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
waypoint = {
    hud_elem_type = "waypoint",
    name = "My pos",
    number = "0x000000",
    world_pos = {x=0,y=0,z=0}
}
player:hud_add(waypoint)
...
player:hud_remove(waypoint)

The above example does not remove the HUD of the waypoint.
Another question: how to know the id of an element of HUD?


The hud_add method returns an HUD id. So you can do
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
local id = player:hud_add(hud_def)
...
player:hud_remove(id)
Every time a mod API is left undocumented, a koala dies.
 

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

Re: Post your modding questions here

by Merlin » Sun Jan 31, 2016 19:43

How do I make a mob randomly drop something (while the mob is still alive), or rather, how do I make a chicken lay an egg?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Sun Jan 31, 2016 19:57

Merlin: check out Mobs Redo mod, especially the chicken.lua code.

https://github.com/tenplus1/mobs
 

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

Re: Post your modding questions here

by Merlin » Sun Jan 31, 2016 20:47

I don't quite get what this chunk of code does:

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
hit_node = function(self, pos, node)

      local num = math.random(1, 10)
      if num == 1 then
         pos.y = pos.y + 1
         local nod = minetest.get_node_or_nil(pos)
         if not nod
         or not minetest.registered_nodes[nod.name]
         or minetest.registered_nodes[nod.name].walkable == true then
            return
         end
         local mob = minetest.add_entity(pos, "mobs:chicken")
         local ent2 = mob:get_luaentity()
         mob:set_properties({
            textures = ent2.child_texture[1],
            visual_size = {
               x = ent2.base_size.x / 2,
               y = ent2.base_size.y / 2
            },
            collisionbox = {
               ent2.base_colbox[1] / 2,
               ent2.base_colbox[2] / 2,
               ent2.base_colbox[3] / 2,
               ent2.base_colbox[4] / 2,
               ent2.base_colbox[5] / 2,
               ent2.base_colbox[6] / 2
            },
         })
         ent2.child = true
         ent2.tamed = true
         ent2.owner = self.playername
      end
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Mon Feb 01, 2016 08:57

That piece of code is for throwing eggs, it picks a number from 1 to 10, if it's 1 then it checks the node above to see if it's free (air, grass etc) and spawns a chicken, then sets it's texture to that of a baby chick and halves it's size, sets it to child, sets tamed and owner name.

Congratulations: you have a the proud owner of a baby chicken :)
 

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

Re: Post your modding questions here

by Merlin » Mon Feb 01, 2016 09:44

Looking through what mobs redo already offers, I think I'm going to base my mod on mobs redo rather than on simple mobs.
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

Save settings permanently

by BrunoMine » Mon Feb 01, 2016 11:31

About method:
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.setting_set("name", "value")

He did not keep the values set after a server shutdown.
We can save permanently?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Mon Feb 01, 2016 12:37

using /set -n <name> <value> does the same sadly, would be handy to have a -f in there to FORCE the setting and save to minetest.conf
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Tue Feb 02, 2016 17:01

TenPlus1 wrote:using /set -n <name> <value> does the same sadly, would be handy to have a -f in there to FORCE the setting and save to minetest.conf

l'd prefer a minetest.save_settings().
lt shouldn't be called forcing because force is too vague…
A -sd (save directly) option could mean saving it directly after the setting was set.
If you use lubuntu (or similar) and want to disable access to your disk, hit alt+print(+s)+u. l don't know if minetest crashes then, l only know that it doesn't start.
 

Azmarok
New member
 
Posts: 1
Joined: Fri Feb 05, 2016 05:20
In-game: Azmarok

Re: Post your modding questions here

by Azmarok » Fri Feb 05, 2016 05:25

Topic: How do I make decorations appear underground (ex. in caves)
Why: I'm making a mod that tries to encourage exploration. There is one item, called a rock, which is very important for making some items.
More info:
My current code for spawning the rock is:

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_decoration({
    deco_type = "simple",
    decoration = "huntandgather:rock",
    place_on = {
        "default:stone",
    },
    y_min = -32000,
    y_max = 32000
})


My other section of code for spawning sticks on the ground works just fine, however:
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_decoration({
    deco_type = "simple",
    decoration = "default:stick",
    place_on = {
        "default:dirt",
        "default:dirt_with_grass",
        "default:dirt_with_grass_footsteps",
        "default:dirt_with_dry_grass",
        "default:dirt_with_snow",
    },
    biomes = {
        "coniferous_forest",
        "deciduous_forest",
        "rainforest",
        "rainforest_swamp",
        "savanna",
        "taiga"
    }
})

(i overrote the default stick to make it a node)

Basically, when I go into a cave, there are no rocks to be seen, and I dont know why.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Fri Feb 05, 2016 20:42

Cave generation doesn't work like biome generation with decorations like grass, flowers and trees... you have to use on_generate to place decoration underground, like this:

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_on_generated(function(minp, maxp)

   -- place stones between -30 and -3000
   if minp.y > -30 or maxp.y < -3000 then
      return
   end

   -- place them on top of coal blocks
   local coal = minetest.find_nodes_in_area_under_air(minp, maxp, "default:stone_with_coal")
   local bpos

   for n = 1, #coal do

      bpos = {x = coal[n].x, y = coal[n].y + 1, z = coal[n].z }

      -- not on all coal blocks, only 1 in every 8
      if math.random(1, 8) == 1 then
         minetest.set_node(bpos, {name = "yourmod:stone"})
      end
   end
end)
 

amadin
Member
 
Posts: 471
Joined: Tue Jun 16, 2015 16:23
GitHub: Amadin

Attach to an object with using set_attach function

by amadin » Tue Feb 09, 2016 10:43

In multiplayer, if the player is attached to an object (for example a horse) with using set_attach function, and the object is out of sight of another player (as well as the second player logged later than the first was attached), then the second player lost the first player model. It's look like a horse without player but player is on the horse.
How to fix this?
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Wed Feb 10, 2016 00:07

Is the position for players always the bottom of the collisionbox, or is it just hardcoded 1 below the collisionbox origin?
Every time a mod API is left undocumented, a koala dies.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Wed Feb 10, 2016 15:53

The eye position ()mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm,,,,,m ,mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm (ignoring bobbing) is 1.625 m higher than the position got with player:getpos(), so l assume if pos is player:getpos() then the collision box is {pos.x-0.5, pos.y, pos.z-0.5, pos.x+0.5, pos.y+2, pos.z+0.5}. Sorry for the ms, something issmm,m, sorry, was, on my keyboard.
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Wed Feb 10, 2016 16:21

How to know if ALT is pressed by the player?
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Wed Feb 10, 2016 16:34

drkwv wrote:How to know if ALT is pressed by the player?

You can't detect hardware keys, but you can detect game keys by using get_player_control.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 39 guests

cron