Post your modding questions here

Locked
User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

Spoiler

Code: Select all

special_tiles = {
        {
            image="anyimage.png",
            backface_culling=false,
            animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
        },
        {
            image="anyimage.png",
            backface_culling=true,
            animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
        },
    },
is this right
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

my previous post was right.
new question: how do you set a "player controlled value"?
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
Novacain
Member
Posts: 285
Joined: Sat Aug 31, 2013 01:03
Location: Skaaro

by Novacain » Post

So, I know it's possible, cause I've seen it done before, how can I have a .lua file load if another mod is installed? I want to add stairsplus support to one of my mods.
EXTERMINATE!!!
My Tronrealm modpack
My tronblocks mod

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

animation={type="vertical_frames", aspect_w=638, aspect_h=638, length=?
is the last one for fps or what?
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Topic: special nodes
Question: How do I use the Sproxel *.sxl files as nodes? Which codes are in the node definition needed?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

PING?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Post

I don't know anything about entities. You might want to look up information about them or look at some of the mob mods.

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

by twoelk » Post

Krock wrote:Topic: special nodes
Question: How do I use the Sproxel *.sxl files as nodes? Which codes are in the node definition needed?
you cannot use the *.sxl file directly.

you have to use this export script. With that you get a snippet of lua code describing a nodeboxe for each single voxel. You will have to built your init.lua around that.

You may also want to study this thread with some examples.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

twoelk wrote:
Krock wrote:Topic: special nodes
Question: How do I use the Sproxel *.sxl files as nodes? Which codes are in the node definition needed?
you cannot use the *.sxl file directly.

you have to use this export script. With that you get a snippet of lua code describing a nodeboxe for each single voxel. You will have to built your init.lua around that.

You may also want to study this thread with some examples.
Thanks, I solved my problem :)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

how do you:
#make a teleporting node?
#number controlled by chat command?
#a file with block coordinates?
#a secondary lua file?
#detect node type?
#act on the outcome?
#and use the force load feature?
Last edited by DeepGaze on Fri Feb 21, 2014 14:57, edited 1 time in total.
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

#how to make a node when stepped on teleports you to the other node
#:(
# what?
#thank you
#define if the node is an air or water or other
#:(
#:(
sorry for the confusion. the only reason I am hounding this topic is:, the tutorial for modding is great but lacks depth and only shows how to make a simple wood node. not trying to be offensive
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
Casimir
Member
Posts: 1206
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

So minetest.forceload_block(pos) does not generate the mapbock?

Code: Select all

somefunction(pos)
    print ("[loadmap] loading position ("..pos.x.." "..pos.y.." "..pos.z..")")
    minetest.forceload_block(pos)
end

minetest.register_on_generated(function(minp, maxp, seed)
    print ("[loadmap] chunk minp ("..minp.x.." "..minp.y.." "..minp.z..")")
end)
Only the first message gets printed.

(Ups, was in wrong thread.)

User avatar
Excalibur Zero
Member
Posts: 142
Joined: Tue Apr 02, 2013 19:45
GitHub: ExcaliburZero
Location: United States
Contact:

by Excalibur Zero » Post

DeepGaze wrote:how do you:
#make a teleporting node?
#number controlled by chat command?
#a file with block coordinates?
#a secondary lua file?
#detect node type?
#act on the outcome?
#and use the force load feature?
For your first question you could look at this mod which has nodes that teleport you by you clicking on them. (https://github.com/rocketslime11/waveroad)

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

thank you for the resource, but i fear it has swept over my head like a proverbial albatross. I am going to return to the project idea at a later date, but if anyone wants it:
you step onto this node and it moves the player forward until the player hits an air-like node
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Topic: Do not fully understand how to use a built-in method/function

Reason: From the name, it seems to be the method/function I require for what I am trying to do in a mod I am working on.

More Info: The method/function is "minetest.register_on_craft". However I cannot find any good information on how it is used. What I am trying to accomplish using this method/function is allow a crafting item to be used multiple times, but also have a chance of it "breaking".

Also I'm the type of person that requires an example to learn, I need to see it being used to fully understand it.

Please note that this isn't a finished product, and is still a work-in-progress and I have not tested the code.

But like I said, I couldn't find any good information on it's usage. PilzAdam gave me a small example of it being used, however it didn't use the main variable I'm looking to use, which is the "old_craft_grid".

How I currently have the code written is below in the spoiler.
Spoiler

Code: Select all

minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
    local seed = os.time()
    local recipe = minetest.get_craft_recipe(item)
    local inv = minetest.get_inventory({type="player", name=player})
    local rh = true
    if old_craft_grid = recipe('PoweredMachines:Copper_Plate') then
        math.randomseed( seed ),
        if math.random( 1, 100) < 15 then
            itemstack = 'PoweredMachines:BrokenHammer',
            inv:add_item("main", ItemStack('PoweredMachines:Copper_Plate'),
            rh = false
            return itemstack,
        end
        if rh then
            inv:add_item("main", ItemStack('PoweredMachines:Hammer'),
        end
    elseif old_craft_grid = recipe('PoweredMachines:Steal_Plate') then
        math.randomseed( seed ),
            if math.random( 1, 100) < 15 then
                itemstack = 'PoweredMachines:BrokenHammer',
                inv:add_item("main", ItemStack('PoweredMachines:Steal_Plate'),
                rh = false
                return itemstack,
            end
        if rh then
            inv:add_item("main", ItemStack('PoweredMachines:Hammer'),
        end
    end
end
end)

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

You can't do "if old_craft_grid = ", it will never work. What you need to do is to test each of the items in the craft grid to check it has the correct name. See an example about how to use it here: https://gist.github.com/Novatux/7179966

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Somehow I get doubled nodes, but I try to modify the clone of the 1st node:

Code: Select all

minetest.register_node("extranodes:unlocked_sign", minetest.registered_nodes["default:sign_wall"])
minetest.registered_nodes["extranodes:unlocked_sign"].description = "Unlocked sign"
minetest.registered_nodes["extranodes:unlocked_sign"].drop = "extranodes:unlocked_sign"

minetest.register_craft({
    output = 'extranodes:unlocked_sign 4',
    recipe = {
        {'default:wood','default:wood','default:wood'},
        {'default:wood','default:wood','default:stick'},
        {'','default:stick',''}
    }
}) 
...
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Nore wrote:You can't do "if old_craft_grid = ", it will never work. What you need to do is to test each of the items in the craft grid to check it has the correct name. See an example about how to use it here: https://gist.github.com/Novatux/7179966
Ah, okays. Thanks :D that helps a lot.

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

(sorry for re-asking)
a value controlled by a chat command?
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
LandMine
Member
Posts: 312
Joined: Tue May 01, 2012 16:44
Location: Mexico City
Contact:

by LandMine » Post

Is there an easy way to do the following......a mod that would allow a list to be displayed with the name of the players and the time they have been ALIVE? ............... for example a player spawns and the timer begins, then after lets say 10 min player dies, the timer goes back to 0:00 but the rest of the players timers remain normal, and the time SHOULD NOT reset when a player logs out that is if "BOB" has been 0:30 min alive and logs out, and comes back in his timer remains at 0:30 and continues.....

Also a kill counter, for example "BOB" kills "JOE" so on the list bob has a Kill: 1, which will continue to increase if bob kills more players and will go back to 0 if someone kills bob

So just to have an idea it would something like this:

NAME TIME ALIVE KILLS
Bob 01:30 5
James 00:23 1
Joe 00:02 0
Etc 00:01 0

So it would be from highest to lowest depending on ALIVE TIME. Please advice me on a way thanks in advanced
List Of My Creative Servers - http://planetminetest.com
The Walls - PvP Map - http://minetest.net/forum/viewtopic.php?id=2906

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

by Sokomine » Post

LandMine wrote: Is there an easy way to do the following......a mod that would allow a list to be displayed with the name of the players and the time they have been ALIVE?
The stats mod may either do that already or be adjustable.

Finding out who/what killed a player is currently impossible to my knowledge. That would be great to have for logging (=to know which players to get rid off) and for better messages.
A list of my mods can be found here.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

DeepGaze wrote:(sorry for re-asking)
a value controlled by a chat command?

Code: Select all

myPublicCon_trolled_Value = ""
minetest.register_chatcommand("setval", {
    params = "<variable_value>",
    description = "Con-trolls a value",
    privs = {interact=true},
    func = function(name, param)
        myPublicCon_trolled_Value = param
        minetest.chat_send_all(name.." sets the value to "..param)
    end,
})
EDIT: added BB-code code tags
Last edited by Krock on Wed Feb 26, 2014 12:18, edited 1 time in total.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
DeepGaze
Member
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze
Location: Take your best guess

by DeepGaze » Post

thank you
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards

User avatar
LandMine
Member
Posts: 312
Joined: Tue May 01, 2012 16:44
Location: Mexico City
Contact:

by LandMine » Post

Sokomine wrote:
LandMine wrote: Is there an easy way to do the following......a mod that would allow a list to be displayed with the name of the players and the time they have been ALIVE?
The stats mod may either do that already or be adjustable.

Finding out who/what killed a player is currently impossible to my knowledge. That would be great to have for logging (=to know which players to get rid off) and for better messages.
thank you sokomine i will look at the code and see what can be done, and i dont want to know who killed who, just how many people they have killed which would be great, thanks sokomine
List Of My Creative Servers - http://planetminetest.com
The Walls - PvP Map - http://minetest.net/forum/viewtopic.php?id=2906

User avatar
RHR
Member
Posts: 215
Joined: Mon Jan 27, 2014 20:07
GitHub: RHRhino

by RHR » Post

How can I replace the inventory formspec with an image file?

Locked

Who is online

Users browsing this forum: No registered users and 5 guests