Post your modding questions here

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Tue Apr 28, 2015 20:37

paramat wrote:Mgv6 has lots of offsets, noise often generates patterns that align with (x=0, z=0) or points at noise 'spread' distances from there, so offsets help to break up those alignments. When hmmmm took over mapgen 3 years ago he luckily didn't bother with offsets to keep thing simpler, they are a headache for sure.

Oh. I see what you mean. An offset that's not represented in the noise parameters. Yeah, it'd be nice if noise were more...composable, and could be parameterized more generically. Then USERS of the noise wouldn't have to know or care. But that ship sailed a long time ago....
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Tue Apr 28, 2015 22:52

I'm trying to figure out how to define biomes.
I can see that I can control what altitudes a biomes can appear at by changing y_min and y_max.
And that I can set heat_point and humidity_point to set the temperature and moisture requirements of my biome.
But how can I control biome frequency?
Meaning: Do I have to define biomes in such a way that only ONE biome type can match any given combination of altitude, temp, and humidity?
OR, is there a way to say "out of these 3 possible biome matches choose with odds biome1=10% biome2=30% biome3=60% ?

sorry for my ignorance, this is my first time playing with biomes.

<EDIT> And one more question, would there be any possible way for me to control biomes based on the X and Z coords as well? Or will I have to build a complete customized biome system to do that?
 

User avatar
Johnny Joy
Member
 
Posts: 43
Joined: Fri Sep 05, 2014 20:26
GitHub: johnnyjoy
In-game: jjb

How to look up replacements?

by Johnny Joy » Wed Apr 29, 2015 01:46

In a mod, how it is possible to look up the replacement pairs in a recipe from an item or item name?
 

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 » Wed Apr 29, 2015 07:52

Do you want to get a recipe for an output?

lua_api.html: Item Handling

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 recipe = minetest.get_craft_recipe("mod:output_item")

if recipe.replacements then
    for i=1, #recipe.replacements do
        print(recipe.replacements[i][0] .. " to " .. recipe.replacements[i][1])
    end
end
 

User avatar
Johnny Joy
Member
 
Posts: 43
Joined: Fri Sep 05, 2014 20:26
GitHub: johnnyjoy
In-game: jjb

Re: Post your modding questions here

by Johnny Joy » Wed Apr 29, 2015 15:52

I'm just modifying he default furnace code to handle stackable replacements. Since the c++ code will ignore replacements, unless there is only 1 item left in the fuel inventory(like a lava bucket), then any replacements for items greater than 1 would need to be handled in the lua code, for now. I planed to place the replacement for the consumed fuel into one of the 4 dst slots, assuming one was free. This allows for bottles of fuel to be used and for the bottles to be returned rather than lost.

Thanks.

rubenwardy wrote:Do you want to get a recipe for an output?

lua_api.html: Item Handling

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 recipe = minetest.get_craft_recipe("mod:output_item")

if recipe.replacements then
    for i=1, #recipe.replacements do
        print(recipe.replacements[i][0] .. " to " .. recipe.replacements[i][1])
    end
end
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Wed Apr 29, 2015 16:12

> Do I have to define biomes in such a way that only ONE biome type can match any given combination of altitude, temp, and humidity?

Yes.

> would there be any possible way for me to control biomes based on the X and Z coords as well?

No, not in the biome API =)
 

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

How to prevent a message

by BrunoMine » Wed Apr 29, 2015 16:16

How to prevent a message from appearing in the global chat
Example of my code:
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_chat_message(function(name, message)
   if name == "Admin" then
      minetest.chat_send_player(name, "[ADMIN]" .. name .. ": " .. message)
      return false
   end
end)


out:
<BrunoMine> Hi
[ADMIN]BrunoMine: Hi

If possible tell me how to change the text color
 

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 » Wed Apr 29, 2015 17:04

You can't stop the "<brunomine>" bit as that is done on the client. Other players don't see that, though.
 

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

Re: Post your modding questions here

by BrunoMine » Wed Apr 29, 2015 17:12

rubenwardy wrote:You can't stop the "<brunomine>" bit as that is done on the client. Other players don't see that, though.

Understood.
 

User avatar
Johnny Joy
Member
 
Posts: 43
Joined: Fri Sep 05, 2014 20:26
GitHub: johnnyjoy
In-game: jjb

Re: Post your modding questions here

by Johnny Joy » Wed Apr 29, 2015 21:35

Sorry, no replacements were returned, but they are clearly defined in the recipe. Minetest version 4.1.12

Recipe
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_craft({
        type = "fuel",
        recipe = "farming:bottle_ethanol",
        burntime = 240,
        replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})


rubenwardy wrote:Do you want to get a recipe for an output?

lua_api.html: Item Handling

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 recipe = minetest.get_craft_recipe("mod:output_item")

if recipe.replacements then
    for i=1, #recipe.replacements do
        print(recipe.replacements[i][0] .. " to " .. recipe.replacements[i][1])
    end
end
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed Apr 29, 2015 22:49

paramat wrote:
Kilarin wrote:would there be any possible way for me to control biomes based on the X and Z coords as well?
No, not in the biome API =)

I don't suppose there is any chance you could be talked into expanding your biome API to include a biome_function(minp,maxp) that is checked each time the map generator thinks a certain biome would fit, and returns true or false, true means generate the biome and false means look for another fit this time???? :)

With that I could control biomes as I need in the fractured game, and anyone who wanted could easily make some biomes more frequent and others rarer.

Otherwise, I'll need to build my own biome generator. There are examples out there at least. :)

Thanks!
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Thu Apr 30, 2015 21:12

The idea is okay but sorry, we can't do this because it's added complexity (slower mapgen) for essentially one use.
Hmmmm and myself decided that biomes should be located using random noise only, without any N-S, E-W, centre-edge etc. variation (the removed indev mapgen had centre-edge variation).
Luckily lua mod biomes (added to mgv5/v7 stone terrain) are now fairly fast using the luavoxelmanip, a variation of paragenv7 might work for you with extra code to locate biomes as you wish, you can use schematics to place trees very fast instead of my lua tree generation code. Remember to clear MTGame biomes and decorations so you have stone terrain only, paragenv7 code does this already.
 

Amaz
Member
 
Posts: 328
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Post your modding questions here

by Amaz » Thu Apr 30, 2015 21:50

I tried/am trying to get biomes in a certain location for lott, which uses a modified paragenv7...
This code would slot in from line 137 of default paragenv7:
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 nixz = 1
   for z = z0, z1 do
      for x = x0, x1 do -- for each column do
         local n_temp = nvals_temp[nixz] -- select biome
         local n_humid = nvals_humid[nixz]
         local n_ran = nvals_random[nixz]
         local biome = false
         if minp.x > -700 and minp.x < -500
         and minp.z > 500 and minp.z < 700 then
            biome = 13 -- (Shire)
         elseif minp.x > -1000 and minp.x < 1000
         and minp.z > 700 and minp.z < 1000 then
            biome = 1 -- (Angmar)
         elseif minp.x > -500 and minp.x < -50
         and minp.z > 400 and minp.z < 700 then
            biome = 3 -- (Trollshaws)
         elseif minp.x > -50 and minp.x < 150
         and minp.z > -350 and minp.z < 700 then
            biome = 2 -- (Snowplains)
         elseif minp.x > 200 and minp.x < 300
         and minp.z > -200 and minp.z < -100 then
            biome = 7 -- (Lorien)
         elseif minp.x > 150 and minp.x < 300
         and minp.z > -400 and minp.z < -300 then
            biome = 9 -- (Fangorn)
         elseif minp.x > 350 and minp.x < 450
         and minp.z > -200 and minp.z < 650 then
            biome = 10 -- (Mirkwood)
         elseif minp.x > 750 and minp.x < 1000
         and minp.z > 500 and minp.z < 700 then
            biome = 11 -- (Iron Hills)
         elseif minp.x > 750 and minp.x < 1000
         and minp.z > -800 and minp.z < -500 then
            biome = 8 -- (Mordor)
         elseif minp.x > 500 and minp.x < 750
         and minp.z > -700 and minp.z < -450 then
            biome = 6 -- (Ithilien)
         elseif minp.x > 0 and minp.x < 350
         and minp.z > -600 and minp.z < -400 then
            biome = 12 -- (Rohan)
         elseif minp.x > 350 and minp.x < 500
         and minp.z > -1000 and minp.z < -600 then
            biome = 5 -- (Gondor)
   --      else
   --         biome = 4 -- (Dunlands)
         end

It pretty much just replaces the noise with a set of coords. It would be very easy to use math.random and make the biome borders wonder around a bit. The only problem I can see is that the border runs along chunk lines, and so could look rather ugly... I hope it helps.
Paramat may be able to help more... (Which would be good for both of us!!)
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Fri May 01, 2015 00:22

paramat wrote:The idea is okay but sorry, we can't do this because it's added complexity (slower mapgen) for essentially one use

Understood. thanks for considering it!

Paramat wrote:Luckily lua mod biomes (added to mgv5/v7 stone terrain) are now fairly fast using the luavoxelmanip

Thats what I'm going to have to figure out how to use. thank you!

Amaz wrote:I tried/am trying to get biomes in a certain location for lott, which uses a modified paragenv7...
This code would slot in from line 137 of default paragenv7:

Thank you so very much! Every example helps!

I'm sure I'll be back with more questions as soon as I get more time to dig into this. :)
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Fri May 01, 2015 14:45

Amaz wrote:It would be very easy to use math.random and make the biome borders wonder around a bit.


Good idea, you can make the biome borders curvy not by using math.random, but by using a noise 'nvals_border' multiplied by a parameter 'border_amp' which is the rough variation of the border in nodes, so try roughly 64 or whatever and adjust it to taste, you end up with rectangular biomes with curvy edges.
Border noise should have 'spread' values roughly of average biome size, persistence of around 0.5, and only need 2 or 3 octaves, so will be fast.
Best to use 2 border noises, one for each of x and z.
Last edited by paramat on Fri May 01, 2015 22:30, edited 1 time in total.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Fri May 01, 2015 22:29

So, just rename the temperature and humidity noise code to borderx and borderz.
Then the optimised code will be to check x and z, not checking minp or maxp:
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 nixz = 1
       for z = z0, z1 do
          for x = x0, x1 do -- for each column do
             local biome = false
             local noisy_x = x + nvals_borderx[nixz] * border_amp
             local noisy_z = z + nvals_borderz[nixz] * border_amp
             if noisy_x > -700 and noisy_x < -500
             and noisy_z > 500 and noisy_z < 700 then
                biome = 13 -- (Shire)
             elseif noisy_x > -1000 and noisy_x < 1000
             and noisy_z > 700 and noisy_z < 1000 then
                biome = 1 -- (Angmar) ...............
 

Dr. Console
New member
 
Posts: 4
Joined: Sat Jan 17, 2015 16:12

Re: Post your modding questions here

by Dr. Console » Sun May 03, 2015 15:04

Topic: How do I use a model created in Blender for a craftitem.
Reason: I wan't to lern how to create mods, an because of this I started to make a simple mod ading some food.
And I want to have a can of Juice in the hand and not a thick version of the inventory icon.
until now i have this code:
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_craftitem("juices:can_applejuice", {
   description = "Can of apple juice",
   inventory_image = "can_applejuice_inv.png",
   visual = "mesh",
   mesh = "appleJuiceCan.3ds",
   textures = {"appleJuiceCan_tex.png"},
   on_use = minetest.item_eat(4, "juices:can_empty")
   })

Hope that someone can help me.

NG
Dr. Console
 

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 » Sun May 03, 2015 16:51

You should make it as a mesh node, with minetest.register_node.

Here is a video I found after a quick google, haven't watched all of it: https://www.youtube.com/watch?v=KfH8-OJ56ok
 

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

Re: Post your modding questions here

by Don » Sun May 03, 2015 17:02

I am trying to place a schematic as a decoration. When it places the schematic does not replace the existing nodes. Just wondering how to make it work?

Also, can someone give me a little guidance with the parameters?
I am using sidelen = 80, and fill_ratio = 0.0002 but it places too many. If I do fill_ratio = 0.0001 then I can not finnd any.
I am just starting to learn about mapgen stuff and not sure how the parameters work.
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
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Sun May 03, 2015 18:51

You need 0.4.12dev and use 'force placement' in flags:
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
flags = "place_center_x, place_center_z, force_placement",

But also make sure all air nodes in your schematic have probability 0 or are changed to "ignore", otherwise the air nodes will replace the terrain.
My biomesdev mod might help as an example.
Last edited by paramat on Mon May 04, 2015 14:08, edited 1 time in total.
 

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

Re: Post your modding questions here

by Don » Mon May 04, 2015 01:22

paramat wrote:You need 0.4.12dev and use 'force placement' in flags:
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
flags = "place_center_x, place_center_z, force_placement",

But also make sure all air nodes in your schematic have probability 0 or are changed to "ignore", otherwise the air nodes will replace the terrain.
My biomesdev mod might help as an example.

0.0001 may be too small a number to work, try sidelen = 16 and a larger number. 16 will work with any mapchunk size, not just mapchunks of 5x5x5 mapblocks.

I tried sidelen = 16 and around a thousand numbers. Still can not get it to do what I want. I am just not getting it.
I want a schematic to be placed in the desert. Want it to be one schematic per desert. I know it will not be exact. Some deserts may have none and others have 2 or 3. I just can not get it to do that. Either the schematic is everywhere or does not place.
Is there a link to some info about it. I do not understand the different settings so I am just guessing at what to change.
I checked your biomesdev mod. I see what you have done but do not understand why you used those settings. I searched for info on it but came up empty.
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
 

Dr. Console
New member
 
Posts: 4
Joined: Sat Jan 17, 2015 16:12

Re: Post your modding questions here

by Dr. Console » Mon May 04, 2015 12:59

Is there a way to let a recipe randomly generate a defined sideproduct while cooking?
E.g. if sand is in the furnance it generates glas and with a 1/5 chance a copper lump.

At the moment my code looks like this and doesn't run:
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_craft({
   type = 'cooking',
   local rand = math.random([1[, 10]])
   if rand > 5 then
         bla bla bla


NG
Dr. Console
 

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 May 04, 2015 13:21

Unfortunately not Dr. Console. The craft system isn't that flexible, you'd have to make your own craft system.

That code is invalid, you can't put statements there, only table entries.
 

Dr. Console
New member
 
Posts: 4
Joined: Sat Jan 17, 2015 16:12

Re: Post your modding questions here

by Dr. Console » Mon May 04, 2015 13:33

Seems like there will be some things which need further tweaking xD
Well, even if is isn't possible, is there a way to adress the other 3 outputslots of the furnace?
Everytime i insert a table of outputs like

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
output = {'default:sand', 'own:ash'}


is get an error that there're not enougth output slots

15:14:01: ERROR[main]: ========== ERROR FROM LUA ===========
15:14:01: ERROR[main]: Failed to load and run script from
15:14:01: ERROR[main]: C:\Program Files\minetest-0.4.12\bin\..\mods\more_ores\init.lua:
15:14:01: ERROR[main]: Crafting definition (cooking) is missing an output
15:14:01: ERROR[main]: stack traceback:
15:14:01: ERROR[main]: [C]: in function 'register_craft'
15:14:01: ERROR[main]: ...ram Files\minetest-0.4.12\bin\..\mods\more_ores\init.lua:33: in main chunk
15:14:01: ERROR[main]: ======= END OF ERROR FROM LUA ========
 

minetestcr
Member
 
Posts: 57
Joined: Fri Feb 13, 2015 21:31

Re: Post your modding questions here

by minetestcr » Mon May 04, 2015 13:50

Hello!


I'm trying to define spawnpoint for a server with Traxie21's ServerExtended, but had no luck.
the clients spawn at random locations, and when they exit and come back, they spawn at the last point they were.
Anybody has a clue? or another mod?

I'm using minetest 0.4.12-dev with ServerExtended Unstable (https://forum.minetest.net/viewtopic.php?f=11&t=4716)

thanks!
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Post your modding questions here

by stu » Mon May 04, 2015 14:08

Dr. Console wrote:Is there a way to let a recipe randomly generate a defined sideproduct while cooking?
E.g. if sand is in the furnance it generates glas and with a 1/5 chance a copper lump.

You could use minetest.register_on_craft to add the sideproducts directly to the player's inventory.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Mon May 04, 2015 14:16

Don

> 0.0001 may be too small a number to work, try sidelen = 16 and a larger number.

Actually i was wrong there, the fill ratio will be the same with any sidelen and will probably not help your problem.
For a low density decoration you are best leaving sidelen unset, sidelen will then be auto-set to the default of mapchunk size (usually 80x80).
One decoration per desert is probably impossible using the bioome API, as it processes a whole chunk at a time, so will either place an average of 1 per chunk or 0 per chunk. You will need a custom lua on-generated function to do what you want and place a schematic, don't know how though for exactly 1 schematic per desert.
 

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

Re: Post your modding questions here

by Don » Mon May 04, 2015 14:24

paramat wrote:Don

> 0.0001 may be too small a number to work, try sidelen = 16 and a larger number.

Actually i was wrong there, the fill ratio will be the same with any sidelen and will probably not help your problem.
For a low density decoration you are best leaving sidelen unset, sidelen will then be auto-set to the default of mapchunk size (usually 80x80).
One decoration per desert is probably impossible using the bioome API, as it processes a whole chunk at a time, so will either place an average of 1 per chunk or 0 per chunk. You will need a custom lua on-generated function to do what you want and place a schematic, don't know how though for exactly 1 schematic per desert.

Ok. Thanks. That makes sense. I will read about on_generate and see if I can make that work.
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
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Mon May 04, 2015 14:27

minetestcr wrote:Hello!


I'm trying to define spawnpoint for a server with Traxie21's ServerExtended, but had no luck.
the clients spawn at random locations, and when they exit and come back, they spawn at the last point they were.
Anybody has a clue? or another mod?

I'm using minetest 0.4.12-dev with ServerExtended Unstable (https://forum.minetest.net/viewtopic.php?f=11&t=4716)

thanks!

Just add "static_spawnpoint = 0,0,0" to your mintest.conf
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
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Mon May 04, 2015 20:32

Don,
One way could be to calculate mgv6 biome noise per column (see my landup mod to see how, strip out all the noises except 'biome' noise, which is > 0.4 in deserts and locates them), and if it reaches a high value of roughly 1.2-1.5 then place your decoration somewhere in the mapchunk. This won't gaurantee 1 decoration per desert but it will be 0, 1 or 2 per desert if you carefully adjust the noise threshold.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 19 guests

cron