Guidelines for creating a very, very, very basic mod

User avatar
qyron
Member
 
Posts: 50
Joined: Sat Jan 07, 2012 00:07

Guidelines for creating a very, very, very basic mod

by qyron » Sat Nov 09, 2013 22:33

First and before anything else: I have absolutely no experience in coding so the very most basic pointers will mean a lot for me.


How and what I have came up with
I was enjoying some fresh oysters when suddenly it came to me that it could be very interesting having it in Minetest. Some reasons it would be fun to add those pebble-like creatures to the game:
a) life! It would add some "life" to underwater landscapes
b) food!! Having another food source in game, available for harvesting - at first - and for cultivating - later on - is always nice
c) pearls!!!

So, what do I need: can someone give me a few pointers of how and where to start? Like a basic "script" for a mod that I can tinker with and see where I can go.
Also, feedback about this idea would be a plus. My intention is to start low and slow (start by having the damn things spawn, how and where I want it) and increment slowly on it.

I have somewhat of a guideline in my mind of what I want to achieve:
1) spawning
2) limit spawn to depth range
3) define cluster size
4) define change of spontaneous spawning
5) enable harvesting
5) enable usability
6) more to come
Minetest is not Minecraft. Stop trying to make them look alike.

Currently running Minetest 0.4-13 from Debian Backports.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sat Nov 09, 2013 23:16

qyron wrote:First and before anything else: I have absolutely no experience in coding so the very most basic pointers will mean a lot for me.


How and what I have came up with
I was enjoying some fresh oysters when suddenly it came to me that it could be very interesting having it in Minetest. Some reasons it would be fun to add those pebble-like creatures to the game:
a) life! It would add some "life" to underwater landscapes
b) food!! Having another food source in game, available for harvesting - at first - and for cultivating - later on - is always nice
c) pearls!!!

So, what do I need: can someone give me a few pointers of how and where to start? Like a basic "script" for a mod that I can tinker with and see where I can go.
Also, feedback about this idea would be a plus. My intention is to start low and slow (start by having the *** things spawn, how and where I want it) and increment slowly on it.

I have somewhat of a guideline in my mind of what I want to achieve:
1) spawning
2) limit spawn to depth range
3) define cluster size
4) define change of spontaneous spawning
5) enable harvesting
5) enable usability
6) more to come
Okay, I can answer your spawning question.
Evergreen wrote:Okay, here is some example code for an ore. (keep in mind, this works with any node, not just ores)

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_ore({
    ore_type       = "scatter",
    ore            = "mod:stone_with_ore",
    wherein        = "default:stone",
    clust_scarcity = 8*8*8,
    clust_num_ores = 8,
    clust_size     = 3,
    height_min     = -31000,
    height_max     = 64,
})


To quote the dev wiki:

ore_type: See Ore types
ore: The name of the ore node
wherein: The node that the ore will generate inside of
clust_scarcity: Ore has a 1 out of clust_scarcity chance of spawning in a node.
clust_num_ores: Number of ores in a cluster
clust_size: Size of the bounding box of the cluster
height_min: The lowest level that the ore will generate at
height_max: The highest level that the ore will generate at
noise_threshhold: If noise is above this threshold, ore is placed. Not needed for a uniform distribution
noise_params: NoiseParams structure describing the perlin noise used for ore distribution


Also, the possible ore types are:

scatter

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
Randomly chooses a location and generates a cluster of ore.
If noise_params is specified, the ore will be placed if the 3d perlin noise at
that point is greater than the noise_threshhold, giving the ability to create a non-equal
distribution of ore.


sheet

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
Creates a sheet of ore in a blob shape according to the 2d perlin noise described by noise_params.
The relative height of the sheet can be controlled by the same perlin noise as well, by specifying
a non-zero 'scale' parameter in noise_params.  IMPORTANT: The noise is not transformed by offset or
scale when comparing against the noise threshhold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size.
clust_scarcity and clust_num_ores are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.



EDIT:

Remember to register the ore as a node first.

Like so:

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("yourmod:stone_with_yourore", {
    description = "Your Ore",
    tiles = {"default_stone.png^yourmod_mineral_yourore.png"},
    groups = {cracky=3},
    drop = 'yourmod:yourore_lump',
    sounds = default.node_sound_stone_defaults(),
})

Also remember to change "yourmod" with your mod name, and "youore" with the name of your ore.
Last edited by Evergreen on Sat Nov 09, 2013 23:17, edited 1 time in total.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Sat Nov 09, 2013 23:35

Maybe the clams-mod from the sea-modpack can help you further.

https://forum.minetest.net/viewtopic.php?id=4627
 

User avatar
qyron
Member
 
Posts: 50
Joined: Sat Jan 07, 2012 00:07

by qyron » Sun Nov 10, 2013 18:04

Evergreen

Kudos for you for the great tips. I believe I can get my hands dirty with this and try it out. Just one thing: by using an ore template, won't the oysters spawn inside the block instead atop of it?

Topywo

I'll check your suggestion, as well. Thanks.
Minetest is not Minecraft. Stop trying to make them look alike.

Currently running Minetest 0.4-13 from Debian Backports.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sun Nov 10, 2013 18:07

qyron wrote:Evergreen

Kudos for you for the great tips. I believe I can get my hands dirty with this and try it out. Just one thing: by using an ore template, won't the oysters spawn inside the block instead atop of it?

Topywo

I'll check your suggestion, as well. Thanks.
Yes, that is the main problem. When I'm not sure how to do something, I usually look in
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-folder/games/minetest_game/mods
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Mon Nov 11, 2013 02:22

For mobs as such, sapiers mobf-mod or simple mobs may be helpful. In this special case, the clams-mod may be more fitting. Entities ought not to spawn in too large amounts, so better do one slightly larger one than a group.
A list of my mods can be found here.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron