Post your modding questions here

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

by Sokomine » Sat Mar 22, 2014 15:24

durtective6 wrote:series of items that upon right clicking on the ground, generates a small hollow cube (probably 5x5) w

Items can react to rightclick via on_rightclick(pos, node, clicker, itemstack, pointed_thing). For spawning entire buildings, schematics are helpful (place_schematic). If the intended building is as tiny as shown in your sample, using minetest.add_node might also be sufficient.
A list of my mods can be found here.
 

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

by durtective6 » Sat Mar 22, 2014 18:19

Sokomine wrote:Items can react to rightclick via on_rightclick(pos, node, clicker, itemstack, pointed_thing). For spawning entire buildings, schematics are helpful (place_schematic). If the intended building is as tiny as shown in your sample, using minetest.add_node might also be sufficient.


I plan on using the building shown in the screenshot in my previous post, but each version will have something instead of the red wool. How would I make it so an item spawns the building, I don't know what to do for it; I haven't really played around with these kind of things before. Thanks for the reply.
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Sun Mar 23, 2014 16:33

Is there any way to get an ore to spawn in both stone and desert stone without having to create a seperate minetest.register_ore? Like: wherein = "default:stone, default:desert_stone"?
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

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

by paramat » Sun Mar 23, 2014 23:48

DeepGaze wrote:any way to write a pseudo-air node?

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("modname:airlike", {
    description = "Airlike Node",
    drawtype = "airlike",
    paramtype = "light",
    sunlight_propagates = true,
    walkable = false,
    pointable = false,
    diggable = false,
    buildable_to = true,
    is_ground_content = false,
})

'is_ground_content = false' will stop cavegen eating the node if the node is added by a mod 'on generated chunk'.
Last edited by paramat on Sun Mar 23, 2014 23:49, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
ak399g
Member
 
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR

by ak399g » Mon Mar 24, 2014 23:09

I'm trying to write a mod that plays music at dawn and dusk.
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_globalstep(
    function(dtime)
        if minetest.env:get_timeofday() == 0.2
        then minetest.sound_play("sunsong")
        end
    end
)

minetest.register_globalstep(
    function(dtime)
        if minetest.env:get_timeofday() == 0.8
        then minetest.sound_play("sunsong")
        end
    end
)

This doesn't work. I don't know enough to know why.

Second: How would one go about writing a chat_command that stops time? I.E. "/stoptime" to halt the world clock, and "/starttime" to set it going again?
Last edited by ak399g on Mon Mar 24, 2014 23:23, edited 1 time in total.
aka SAFR
 

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

by Sokomine » Tue Mar 25, 2014 14:43

ak399g wrote:'m trying to write a mod that plays music at dawn and dusk.

Take a look at my bell mod at github. It does slightly more than you want (plays a sound each hour and repeats it as much times as the time demands).

ak399g wrote:Second: How would one go about writing a chat_command that stops time?

"/set time_speed 0" ought to do.
A list of my mods can be found here.
 

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

by kaeza » Wed Mar 26, 2014 02:13

Hybrid Dog wrote:
ak399g wrote:I'm trying to write a mod that plays music at dawn and dusk.
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_globalstep(
    function(dtime)
        if minetest.env:get_timeofday() == 0.2
        then minetest.sound_play("sunsong")
        end
    end
)

minetest.register_globalstep(
    function(dtime)
        if minetest.env:get_timeofday() == 0.8
        then minetest.sound_play("sunsong")
        end
    end
)

This doesn't work. I don't know enough to know why.

globalstep works ca. every 0.05s, I think, so minetest.env:get_timeofday() won't be exactly 0.8 or 0.2. You could use math.floor and check if the play_sound was already started 2s ago to avoid playing it more times.

Something like this should work
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 is_day
minetest.register_globalstep(
    function(dtime)
        local t = minetest.get_timeofday()
        local new_is_day = (t >= 0.2) and (t < 0.8)
        if is_day == nil then
            is_day = not new_is_day
        end
        if new_is_day ~= is_day then
            if new_is_day then
                minetest.sound_play("rooster") -- Dawn
            else
                minetest.sound_play("wolf") -- Dusk
            end
            is_day = new_is_day
        end
    end
)
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
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Wed Mar 26, 2014 18:22

Hybrid Dog wrote:I would let it only try to work every 10s:
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 is_day
local t0 = 0
minetest.register_globalstep(
    function(dtime)
        t0 = t0+dtime --[dtime] = ms
        if t0 < 10000 then
            return
        end
        t0 = 0
...

"dtime" is a double/float/decimal number, it counts in seconds. (ex. 0.06661337)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

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

by Amaz » Wed Mar 26, 2014 21:03

Is there any way to get items into bones that are in a detached inventory? I would like to get armor from Stu's armor mod into bones, and I'm using 0gb.us' inventory_plus mod. I don't mind modifying the bones mod itself...
 

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

by stu » Wed Mar 26, 2014 22:16

Amaz wrote:Is there any way to get items into bones that are in a detached inventory? I would like to get armor from Stu's armor mod into bones, and I'm using 0gb.us' inventory_plus mod. I don't mind modifying the bones mod itself...

Funny, I'd never even thought about that. You shouldn't really need to modify bones, perhaps use register_on_dieplayer in armor to transfer the detached inventory to main. I think that should work but I will try to add something like that myself, now that bones are in the default minetest_game (since a while back actually)
Last edited by stu on Wed Mar 26, 2014 22:19, edited 1 time in total.
 

NathanRandallHolt
New member
 
Posts: 2
Joined: Sat Mar 29, 2014 15:07

by NathanRandallHolt » Tue Apr 01, 2014 14:59

What does register_ore do if you specify sheet distribution? Does it create various flat deposits like clusters of magnetite and micro line in Dwarf Fortress? Does it create an intermittent sheet of ore that spans the world? If the latter, what determines the altitude of the sheet? Is it the min, the max, the average, or something else? Could someone provide an example of how to use it?
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Tue Apr 01, 2014 15:29

what value does return 'player:get_look_yaw()' (something between 1,5 and -4,6????) and how can i convert it into 0-360 degree?
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Tue Apr 01, 2014 18:16

Hybrid Dog wrote:
addi wrote:what value does return 'player:get_look_yaw()' (something between 1,5 and -4,6????) and how can i convert it into 0-360 degree?
I tried it out some time ago. I saved the yaw with get_look_yaw and added it back to the player but somehow it didn't work. "It [...] pretty randomly as of now."


uhh it all hurts in my head.
but i get closer to the solution:

that function returns a radiant like this:
Image
Degree-Radian Conversion [Public domain], by Inductiveload (Own work), from Wikimedia Commons

that can be easily converted to degrees :
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 grad = player:get_look_yaw()*180/math.pi

so now i have degrees. but the cero pount is on the left. this can be fixed with 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
grad = grad -90;
if grad < 0 then grad = grad + 360 end

ok now is the 0° on the top and 180° on the bottom.

but: 270° are on the left side and 90° are on the right side!?

is somebody good in math and is there a way to rotate this ?

one solution could be a switch case with 360 entries... but i hobe there is a better way.
Last edited by addi on Tue Apr 01, 2014 18:18, edited 1 time in total.
 

CWz
Member
 
Posts: 185
Joined: Tue Dec 24, 2013 17:01

by CWz » Thu Apr 03, 2014 11:42

Can someone please tell me what's wrong with this code. I can't seem to get it to work.

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 minetest.check_player_privs(name, {interact=false}) then
    minetest.after(3.5, player:setpos(x=0,y=15,z=0))
end
Last edited by CWz on Thu Apr 03, 2014 11:42, edited 1 time in total.
I am CWz on the following servers: Bluelobster, turtletango, VanessaE's servers, linuxgaming, redcrab, Silvercrab, ChainLynx, lord of the test server. If you see CWz on server other then those then chances are it's a Fake. you can contact me on irc.freenode.net or by PM if you are not sure
 

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

by Sokomine » Thu Apr 03, 2014 12:35

The player:setpos call is evaluated (and thus executed) immediately, and the return value of that function (whatever that may be) is passed on to minetesminetest.after. Use
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.after(3.5, myfunction, player,{x=0,y=15,z=0} )

and do the setpos in myfunction:
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
myfunction = function( player, pos )
      if( player and pos ) then
          player:setpos( pos );
     end
end

(untested)
A list of my mods can be found here.
 

User avatar
domtron vox
Member
 
Posts: 106
Joined: Thu Feb 20, 2014 21:07
GitHub: DomtronVox
IRC: Domtron
In-game: Domtron

by domtron vox » Thu Apr 03, 2014 14:00

addi wrote:
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 grad < 0 then grad = grad + 360 end



It would be better to do this instead:

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
grad = grad % 360 --returns the remainder after dividing by 360


This will force grad to be within 0-360 whether grad is positive or negative and will not effect it if it is in that range. As a bonus it will automatically convert 360 to 0.


As for get_look_yaw I have no clue what it is doing but if it is returning a normal radian value then your code local grad = player:get_look_yaw()*180/math.pi should convert the angle to degrees where 0/360 is on the right.

It sounds like your axis is flipped 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
    90
     |
0 -       - 180
     |
    270


so if you just subtract 90 each value moves clockwise one position

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
        0
        |
270 -       - 90
        |
       180


First of all you should subtract 180 to get 0 on the right. However, rotating your axis isn't what you want to do(that is if you want 0 to be on the left and 90 up). Instead you need to flip the entire axis 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
         90
        |
180 -       - 0
        |
        270


I'm not sure how to do this off the top of my head, but if I get some time I'll think about it.
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Thu Apr 03, 2014 14:49

uff i got breaked my head now and ... finaly found a solution:

the function player:get_look_yaw() returns a radian in that format:
Wikipedia wrote:Image
Degree-Radian Conversion [Public domain], by Inductiveload (Own work), from Wikimedia Commons



but a more common human readable use of degrees are that:
Image

my problem was converting the first one to the secound one so it can be used.

here the final function:
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 degree = player:get_look_yaw()*180/math.pi - 90; --transform rad into deg and move the cero point to the top.
        if degree < 0 then degree = degree + 360 end; --if there are some negative values fix it by adding 360° to it.
        degree = -(degree-360); this fixes the problem, that it counts up against clockwise. -> flip it to count clocwise now


and now we made that: Image
into that:Image


now i have headache but im happy that it works now. :)
if somebody has acces to write that down on the dev-wiki i think a lot of other people can save that thoughts i alredy made.

so minetest does not return "pretty randomly" values from now on.
Last edited by addi on Thu Apr 03, 2014 14:49, edited 1 time in total.
 

CWz
Member
 
Posts: 185
Joined: Tue Dec 24, 2013 17:01

by CWz » Thu Apr 03, 2014 15:06

Sokomine wrote:The player:setpos call is evaluated (and thus executed) immediately, and the return value of that function (whatever that may be) is passed on to minetesminetest.after. Use
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.after(3.5, myfunction, player,{x=0,y=15,z=0} )

and do the setpos in myfunction:
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
myfunction = function( player, pos )
      if( player and pos ) then
          player:setpos( pos );
     end
end

(untested)


I am trying to have it so a player who doesn't have interact gets teleported back to spawn after a short period of time.
I am CWz on the following servers: Bluelobster, turtletango, VanessaE's servers, linuxgaming, redcrab, Silvercrab, ChainLynx, lord of the test server. If you see CWz on server other then those then chances are it's a Fake. you can contact me on irc.freenode.net or by PM if you are not sure
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Thu Apr 03, 2014 15:15

CWz wrote:I am trying to have it so a player who doesn't have interact gets teleported back to spawn after a short period of time.

I've done that in my jail-feature in my server.

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 ttime = 0
minetest.register_globalstep(function(dtime)
    ttime = ttime + dtime
    if ttime < 8 then
        return
    end
    ttime = 0
    local players = minetest.get_connected_players()
    for _,player in ipairs(players) do
        local pos = player:getpos()
        if(pos.x < 20 and pos.x > -20 and
            pos.z < 20 and pos.z > -20) then
        player:setpos({x=0, y=5, z=0})
        minetest.chat_send_player(player:get_player_name(), "Go back!")
        end
    end
end)

It's possible to go around this protection by moving around alot.
Last edited by Krock on Thu Apr 03, 2014 15:16, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
mimilus
Member
 
Posts: 75
Joined: Thu Mar 06, 2014 09:08
GitHub: mimilus
IRC: Mimilus

by mimilus » Sat Apr 05, 2014 19:05

Hello

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
What's wrong whit this

minetest.register_node("castle:secret_stonewall",{
    description = "Stonewall secret Wall",
    tiles = { 'castle_stonewall.png' },
    drawtype= "nodebox",
    paramtype = "light",
    node_box = {
        type = "fixed",
        fixed = {
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
        },
        selection_box={
            type="fixed",
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
    },
    groups = {choppy=2,dig_immediate=2},
    }
})


I can't remove the node
minetest 0.4.9
Ubuntu 12.04
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sat Apr 05, 2014 19:40

mimilus wrote:
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("castle:secret_stonewall",{
    description = "Stonewall secret Wall",
    tiles = { 'castle_stonewall.png' },
    drawtype= "nodebox",
    paramtype = "light",
    node_box = {
        type = "fixed",
        fixed = {
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
        },
        selection_box={
            type="fixed",
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
    },
---groups = {choppy=2,dig_immediate=2},
    }
+++groups = {choppy=2,dig_immediate=2},
})

put the groups 1 line down.
Last edited by Krock on Sat Apr 05, 2014 19:40, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
mimilus
Member
 
Posts: 75
Joined: Thu Mar 06, 2014 09:08
GitHub: mimilus
IRC: Mimilus

by mimilus » Sat Apr 05, 2014 20:00

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("castle:secret_stonewall",{
    description = "Stonewall secret Wall",
    tiles = { 'castle_stonewall.png' },
    drawtype= "nodebox",
    paramtype = "light",
    node_box = {
        type = "fixed",
        fixed = {
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
        },
        selection_box={
            type="fixed",
            {0.375,-0.5,-0.5,0.5,0.5,0.5}, --NodeBox1
            {-0.5,-0.5,-0.5,-0.375,0.5,0.5}, --NodeBox2
    },
- -    }
++   },
groups = {choppy=2,dig_immediate=2},
})


Thx it works now
minetest 0.4.9
Ubuntu 12.04
 

NathanRandallHolt
New member
 
Posts: 2
Joined: Sat Mar 29, 2014 15:07

by NathanRandallHolt » Sun Apr 06, 2014 19:03

NathanRandallHolt wrote:What does register_ore do if you specify sheet distribution? Does it create various flat deposits like clusters of magnetite and micro line in Dwarf Fortress? Does it create an intermittent sheet of ore that spans the world? If the latter, what determines the altitude of the sheet? Is it the min, the max, the average, or something else? Could someone provide an example of how to use it?

I've experimented with register_ore with sheet distrubution, and it doesn't seem to do anything. I think if I want deposits similar to what I find in Dwarf Fortress, I'll have to implement all the ore placement myself. It seems reasonable to implement the entire map generation similar to the way the mg mod does.
Last edited by NathanRandallHolt on Sun Apr 06, 2014 19:05, edited 1 time in total.
 

User avatar
mimilus
Member
 
Posts: 75
Joined: Thu Mar 06, 2014 09:08
GitHub: mimilus
IRC: Mimilus

by mimilus » Mon Apr 07, 2014 15:31

Is there a tip for order items in inventory when we create nodes ?

In the inventory my nodes don't follow the order of creation in init.lua


Is it possible to group them by mod in the inventory ?
Last edited by mimilus on Mon Apr 07, 2014 16:35, edited 1 time in total.
minetest 0.4.9
Ubuntu 12.04
 

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

by Topywo » Mon Apr 07, 2014 16:13

mimilus wrote:Is there a tip for order items in inventory when we cran nodes ?

In the inventory my nodes don't follow the order of creation in init.lua


Is it possible to group them by mod in the inventory ?



I always thought the nodes/items are grouped by mod in the inventory and inside a mod the nodes/items are in alphabetical order following the name under 'description'. I've not checked if this is true.


Edit: Double quote removed.
Last edited by Topywo on Mon Apr 07, 2014 16:14, edited 1 time in total.
 

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

by durtective6 » Wed Apr 09, 2014 09:40

Hi, im trying to add something to my mod but don't know how. I've experimented and tried different stuff, but had no success.
How would i make a tool/item that, on the user right clicking, places a block (effectively this is an item that allows the user to have an infinite source of a block, e.g. cobble).
Thanks for any feedback.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Apr 09, 2014 10:05

Something 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
on_place = function(itemstack, placer, pointed_thing)
    local under = minetest.get_node(pointed_thing.under)
    local above = minetest.get_node(pointed_thing.above)
    -- check for rightclick
    local reg_node = minetest.registered_nodes[under.name]
    if reg_node.on_rightclick then
        reg_node.on_rightclick(pointed_thing.under, under, placer)
        return
    end
    -- place plant
    if above.name == "air" then
        above.name = "default:cobble"
        minetest.place_node(pointed_thing.above, above, placer)
        minetest.sound_play("default_place_node", {pos = np, gain = 0.5})
--        remove one item
--        itemstack:take_item(1)
--        return itemstack
    end
end
 

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

by durtective6 » Wed Apr 09, 2014 14:00

How would I merge that with a tool? Also I'm guessing the itemstack:take_item(1) means take 1 cobble from an available stack (I've never really played around with this kind of stuff); if this is the case, would I change (1) to (0) to make it so you can place an infinite amount?
Thanks for the help.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Apr 09, 2014 14:36

You put it into the item definition, just like on_use. Don't forget to add a "," at the end. The "take_item" part is commented, so it will do nothing. I just kept it in there for reverence.
 

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

by Kilarin » Fri Apr 11, 2014 20:34

Strange question:
I've created a tool, and I want to know what item is in the active inventory slot next (just to the right) of the slot where the tool is.

So, for example, if your inventory looks like:

[pickaxe] [99 stone] [shovel] [28 torches] [bucket of water] [empty] [99 glass] [50 wood]

and you are using the pickaxe. How could the pickaxe find out that there is a stack of 99 stone in the slot to the right of it?

Thanks

edit: Would this require a use of get_wield_index() to find the index where the pickaxe is, but then how do I pull the item at index+1 (checking to ensure index returned is<8 of course)
Any examples would be greatly appreciated.
Last edited by Kilarin on Fri Apr 11, 2014 20:44, edited 1 time in total.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron