Armor drop on death

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

I couldn't figure out how to fix this error. Could someone help me please?
Love MINECRAFT... will settle for Minetest

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

This is a good idea... Armor lasts ages... Will be good to have it drop when you die.
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

Even better if it gets pulverizes when you die
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

Any chance of that happening?
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

It is better dropping than being pulverized because the player who killed you can then get the armor and use it.
Love MINECRAFT... will settle for Minetest

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Achilles wrote:This is a good idea... Armor lasts ages... Will be good to have it drop when you die.
Achilles wrote:Even better if it gets pulverizes when you die
Achilles wrote:Any chance of that happening?
Don't post like that! Use you edit button, right there under the post.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

Ah OK... The only thing is I thought people could see the edit... Prefered if they couldn't which was why i just used more posts... sorry
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

mcfan wrote:It is better dropping than being pulverized because the player who killed you can then get the armor and use it.
I know... but it would be more realistic if the armor was destroyed, unless you could have an object that would repair the armor, so that it can be used after you kill someone...
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

I am currently working on some updates for my armor mod, including support for unified inventory and the new unified skins,
I also plan to make armor a lot more configurable and will make item drop on die an option.

So you're best just waiting another day or two, I am hoping to get all this done over the weekend.

btw, you might have got my attention sooner if you had posted this on the 3d_armor modpack topic ;-)
Last edited by stu on Fri Apr 11, 2014 20:18, edited 1 time in total.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

stu, if you're up to making armor be dropped on_death, make it configurable, please :)

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

The current git master of minetest-3d_armor now supports armor drop on death.
For items to physically drop requires that you do not use the bones mod.
Please report any problems in the the 3d_armor mod topic, not here.
4aiman wrote:stu, if you're up to making armor be dropped on_death, make it configurable, please :)
This is configurable but defaults to true, which to me makes sense now that bones are part of minetest_game.
Last edited by stu on Sun Apr 13, 2014 23:07, edited 1 time in total.

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

Great, I'll try it
Love MINECRAFT... will settle for Minetest

User avatar
Achilles
Member
Posts: 247
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles
Location: Excuse Me???? -_-

by Achilles » Post

Same here :)
The Ironic Thing About Common Sense Is That It Isn't Very Common

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

well, I tried it but I didn't want to remove the older armor mod that I liked so much and have revised to be so nice. So I tried to take the drop armor code from it and it didn't work. Could you post code that we could add to the death(or dropondie) mod that would work?
Love MINECRAFT... will settle for Minetest

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

mcfan wrote:well, I tried it but I didn't want to remove the older armor mod that I liked so much and have revised to be so nice. So I tried to take the drop armor code from it and it didn't work. Could you post code that we could add to the death(or dropondie) mod that would work?
This is untested but should give you an idea, best I can do as I no longer have a working installation of the old version.

Code: Select all

minetest.register_on_dieplayer(function(player)
    local name = player:get_player_name()
    local pos = player:getpos()
    if name and pos then
        local player_inv = player:get_inventory()
        local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"})
        for _,v in ipairs(armor.elements) do
            local stack = armor_inv:get_stack("armor"..v, 1)
            if stack:get_count() > 0 then
                armor_inv:set_stack("armor"..v, 1, nil)
                player_inv:set_stack("armor"..v, 1, nil)
                local obj = minetest.add_item(pos, stack)
                if obj then
                    local x = math.random(1, 5)
                    if math.random(1,2) == 1 then
                        x = -x
                    end
                    local z = math.random(1, 5)
                    if math.random(1,2) == 1 then
                        z = -z
                    end
                    obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
                end
            end
        end
        armor:set_player_armor(player)
    end
end)

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

Got this error

6:19:11: ERROR[main]: ServerError: LuaError: error: ...sr/share/minetest/games/MiniTest/mods/death/init.lua:76: attempt to index global 'armor' (a nil value)
16:19:11: ERROR[main]: stack traceback:
Love MINECRAFT... will settle for Minetest

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

mcfan wrote:Got this error

6:19:11: ERROR[main]: ServerError: LuaError: error: ...sr/share/minetest/games/MiniTest/mods/death/init.lua:76: attempt to index global 'armor' (a nil value)
16:19:11: ERROR[main]: stack traceback:
If you insist on putting the code your 'death' mod then it will need to depend on 3d_armor to ensure that the armor api is loaded first.
Better to just put the code at the end of armor.lua
Last edited by stu on Wed Apr 16, 2014 20:29, edited 1 time in total.

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

Now this error:

17:43:39: ERROR[main]: ServerError: LuaError: error: ...minetest/games/MiniTest/mods/armor/3d_armor/init.lua:570: attempt to index global 'armor' (a nil value)
17:43:39: ERROR[main]: stack traceback:
Love MINECRAFT... will settle for Minetest

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

mcfan wrote:Now this error:

17:43:39: ERROR[main]: ServerError: LuaError: error: ...minetest/games/MiniTest/mods/armor/3d_armor/init.lua:570: attempt to index global 'armor' (a nil value)
17:43:39: ERROR[main]: stack traceback:
What did you do, depend or move the code? I am not a mind reader, there is no line 570 in my copy of 3d_armor/init.lua

Edit: I fired my crystal ball, it says that you should remove the code from init.lua and put it at the end of armor.lua like I told you.
Last edited by stu on Wed Apr 16, 2014 22:17, edited 1 time in total.

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

There is no armor.lua . There is a armor_api.lua though.
Love MINECRAFT... will settle for Minetest

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

I have a older version for this though(P.S. I like the older version better) and I've revised it soo much where I don't want to have to make the changes again.
Love MINECRAFT... will settle for Minetest

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

mcfan wrote:I have a older version for this though(P.S. I like the older version better) and I've revised it soo much where I don't want to have to make the changes again.
I must send that ball off to the polisher, clearly you are using an ancient version, you could try replacing
armor.elements with {"head", "torso", "legs", "shield"} (braces included).

P.S. What is it about the older version you like better?
Last edited by stu on Thu Apr 17, 2014 20:59, edited 1 time in total.

User avatar
mcfan
Member
Posts: 120
Joined: Wed Mar 26, 2014 15:02
Location: Out in MC land

by mcfan » Post

Ok. Well I might be updating to your new version now. Our server just had a terrible glitch and was ruined.
I had made enchanted diamond armor and everything for it. I wish that you would also keep a version with boots and without the shields- a MC like version
Love MINECRAFT... will settle for Minetest

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

mcfan wrote:Ok. Well I might be updating to your new version now. Our server just had a terrible glitch and was ruined.
I had made enchanted diamond armor and everything for it. I wish that you would also keep a version with boots and without the shields- a MC like version
I strongly recommend that you do use the latest version for minetest-0.4.9, if you do not want shields then simply remove the shields mod from the modpack (delete the shields folder). Armor definitions are unchanged so you should easily be able to incorporate any customizations you might have made to the old version. If you want it to look more like minecraft then I would suggest you try the crafting mod by BlockMen (requires version 2.0.1)

Edit: Not entirely accurate, some armor definitions have changed but the way in which armor is defined has not (added for clarity)
Last edited by stu on Fri Apr 18, 2014 20:53, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests