Bigger swords

Kosmos
Member
 
Posts: 131
Joined: Sun Sep 11, 2016 12:42
In-game: KosmosHD

Bigger swords

by Kosmos » Tue Jan 10, 2017 19:10

Hi,
I looked a lot MineCraft videos and i tought why MT have no big swords like Minecraft.
I have a picture for example.

Minecraft Lucky sword:
http://imgur.com/hIRDKCr

-Kosmos
 

User avatar
octacian
Member
 
Posts: 594
Joined: Mon Dec 21, 2015 22:18
Location: Canada
GitHub: octacian
IRC: octacian
In-game: octacian

Re: Bigger swords

by octacian » Tue Jan 10, 2017 22:32

IDK, I guess people just haven't make any big swords. It's not that it's not possible in MT, all you have to do is change the wield_scale property of the itemdef. For example:

Code: Select all
minetest.register_craftitem("swords:big", {
  description = "Big Sword",
  inventory_image = "big_sword_texture.png",
  wield_scale = { x = 2, y = 2, z = 2, },
})


The above should make a sword twice the size as normal swords. I haven't actually tried it, but that's my understanding.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.
 

User avatar
GreenDimond
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Bigger swords

by GreenDimond » Thu Jan 12, 2017 04:52

Now how to get this to work with weildview/3Darmor? :D
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

Kosmos
Member
 
Posts: 131
Joined: Sun Sep 11, 2016 12:42
In-game: KosmosHD

Re: Bigger swords

by Kosmos » Thu Jan 12, 2017 20:23

octacian wrote:IDK, I guess people just haven't make any big swords. It's not that it's not possible in MT, all you have to do is change the wield_scale property of the itemdef. For example:

Code: Select all
minetest.register_craftitem("swords:big", {
  description = "Big Sword",
  inventory_image = "big_sword_texture.png",
  wield_scale = { x = 2, y = 2, z = 2, },
})


The above should make a sword twice the size as normal swords. I haven't actually tried it, but that's my understanding.

Great. I had test it. But i don't know how i can use it for my mod.-There sometimes to much errors or i haven't the damage what i havw wrote. (I'm a bad programmer). Do you know what's wrong?

-Kosmos
 

User avatar
octacian
Member
 
Posts: 594
Joined: Mon Dec 21, 2015 22:18
Location: Canada
GitHub: octacian
IRC: octacian
In-game: octacian

Re: Bigger swords

by octacian » Fri Jan 13, 2017 00:39

Kosmos wrote:The above should make a sword twice the size as normal swords. I haven't actually tried it, but that's my understanding.

Great. I had test it. But i don't know how i can use it for my mod.-There sometimes to much errors or i haven't the damage what i havw wrote. (I'm a bad programmer). Do you know what's wrong?

-Kosmos[/quote]

Sorry, forgot. It's minetest.register_item for tools, not minetest.register_craftitem. I personally think the functions should be put into one, but whatever. Hope it works!
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.
 

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

Re: Bigger swords

by stu » Fri Jan 13, 2017 18:26

GreenDimond wrote:Now how to get this to work with weildview/3Darmor? :D

Not possible with wieldview sadly, however, it is with wield3d ;-)

Image

Here is the full code, it has the same properties as the default diamond sword. The last part is not absolutely necessary however it does position the sword better in the hand. Note that the mod 'swords' would need to soft-depend on wield3d for that to work.

Code: Select all
minetest.register_tool("swords:big_sword", {
   description = "Big Sword",
   inventory_image = "swords_big_sword.png",
   wield_scale = {x=3, y=3, z=2},
   tool_capabilities = {
      full_punch_interval = 0.7,
      max_drop_level=1,
      groupcaps={
         snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
      },
      damage_groups = {fleshy=8},
   },
   sound = {breaks = "default_tool_breaks"},
})

if minetest.global_exists("wield3d") then
   wield3d.location["swords:big_sword"] = {
      "Arm_Right",
      {x=0, y=5.5, z=8},
      {x=-90, y=225, z=90},
      {x=0.25, y=0.25}
   }
end
Last edited by stu on Sun Jan 15, 2017 18:16, edited 1 time in total.
 

Kosmos
Member
 
Posts: 131
Joined: Sun Sep 11, 2016 12:42
In-game: KosmosHD

Re: Bigger swords

by Kosmos » Fri Jan 13, 2017 19:55

How you can get so big swords if you press F7?
Last edited by Kosmos on Fri Jan 13, 2017 20:16, edited 1 time in total.
 

User avatar
octacian
Member
 
Posts: 594
Joined: Mon Dec 21, 2015 22:18
Location: Canada
GitHub: octacian
IRC: octacian
In-game: octacian

Re: Bigger swords

by octacian » Fri Jan 13, 2017 20:05

Wow, wrong yet again. lol

Thanks for correcting me stu and providing the right code :rotfl:
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.
 

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

Re: Bigger swords

by stu » Fri Jan 13, 2017 20:18

octacian wrote:Wow, wrong yet again. lol

Thanks for correcting me stu and providing the right code :rotfl:

I was not meaning to 'correct' your code, there was nothing wrong with it other than register_tool which you already pointed out yourself. I was mostly showing how it is possible to see this effect in multiplayer or 3rd person. The code is essentially just a carbon copy of the default diamond sword from MTG ;-)
 

User avatar
Gael de Sailly
Member
 
Posts: 741
Joined: Sun Jan 26, 2014 17:01
Location: Lyon, France
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly Ginkgoo

Re: Bigger swords

by Gael de Sailly » Sat Jan 14, 2017 10:54

Kosmos wrote:Hi,
I looked a lot MineCraft videos and i tought why MT have no big swords like Minecraft.

What is the purpose of such a sword, except imitating Minecraft on principle, and masking the player's view?
Just realize how bored we would be if the world was perfect.
 

User avatar
GreenDimond
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Bigger swords

by GreenDimond » Sat Jan 14, 2017 23:01

stu wrote:
GreenDimond wrote:Now how to get this to work with weildview/3Darmor? :D

Not possible with wieldview sadly, however, it is with wield3d ;-)



Here is the full code, it has the same properties as the default diamond sword. The last part is not absolutely necessary however it does position the sword better in the hand. Note that the mod 'swords' would need to soft-depend on wield3d for that to work.

Code: Select all
minetest.register_tool("swords:big_sword", {
   description = "Big Sword",
   inventory_image = "swords_big_sword.png",
   wield_scale = {x=3, y=3, z=2},
   tool_capabilities = {
      full_punch_interval = 0.7,
      max_drop_level=1,
      groupcaps={
         snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
      },
      damage_groups = {fleshy=8},
   },
   sound = {breaks = "default_tool_breaks"},
})

if minetest.global_exists(wield3d) then
   wield3d.location["swords:big_sword"] = {
      "Arm_Right",
      {x=0, y=5.5, z=8},
      {x=-90, y=225, z=90},
      {x=0.25, y=0.25}
   }
end


Tried this, failed to remember to put the last part, and it worked with wrong placement. Added the rest of the code and now it is telling me
2017-01-14 14:58:58: ERROR[Main]: ModError: Failed to load and run script from /home/alex/.minetest/mods/test/init.lua:
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: core.global_exists: table: 0x404e1c40 is not a string
2017-01-14 14:58:58: ERROR[Main]: stack traceback:
2017-01-14 14:58:58: ERROR[Main]: [C]: in function 'error'
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: in function 'global_exists'
2017-01-14 14:58:58: ERROR[Main]: /home/alex/.minetest/mods/test/init.lua:46: in main chunk
2017-01-14 14:58:58: ERROR[Main]: Check debug.txt for details.

Yes, I added wield3d as soft dependency. Wat do?
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

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

Re: Bigger swords

by stu » Sun Jan 15, 2017 18:19

GreenDimond wrote:Tried this, failed to remember to put the last part, and it worked with wrong placement. Added the rest of the code and now it is telling me
2017-01-14 14:58:58: ERROR[Main]: ModError: Failed to load and run script from /home/alex/.minetest/mods/test/init.lua:
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: core.global_exists: table: 0x404e1c40 is not a string
2017-01-14 14:58:58: ERROR[Main]: stack traceback:
2017-01-14 14:58:58: ERROR[Main]: [C]: in function 'error'
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: in function 'global_exists'
2017-01-14 14:58:58: ERROR[Main]: /home/alex/.minetest/mods/test/init.lua:46: in main chunk
2017-01-14 14:58:58: ERROR[Main]: Check debug.txt for details.

Yes, I added wield3d as soft dependency. Wat do?

Sorry, my bad, `minetest.global_exists` is expecting a string. I have now corrected the code above.

Code: Select all
if minetest.global_exists("wield3d") then
   wield3d.location["swords:big_sword"] = {
      "Arm_Right",
      {x=0, y=5.5, z=8},
      {x=-90, y=225, z=90},
      {x=0.25, y=0.25}
   }
end

Pro Tip: The value z=8 determines how far forward the object is translated.
 

User avatar
GreenDimond
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Bigger swords

by GreenDimond » Mon Jan 16, 2017 22:21

stu wrote:
GreenDimond wrote:Tried this, failed to remember to put the last part, and it worked with wrong placement. Added the rest of the code and now it is telling me
2017-01-14 14:58:58: ERROR[Main]: ModError: Failed to load and run script from /home/alex/.minetest/mods/test/init.lua:
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: core.global_exists: table: 0x404e1c40 is not a string
2017-01-14 14:58:58: ERROR[Main]: stack traceback:
2017-01-14 14:58:58: ERROR[Main]: [C]: in function 'error'
2017-01-14 14:58:58: ERROR[Main]: /usr/share/minetest/builtin/common/strict.lua:9: in function 'global_exists'
2017-01-14 14:58:58: ERROR[Main]: /home/alex/.minetest/mods/test/init.lua:46: in main chunk
2017-01-14 14:58:58: ERROR[Main]: Check debug.txt for details.

Yes, I added wield3d as soft dependency. Wat do?

Sorry, my bad, `minetest.global_exists` is expecting a string. I have now corrected the code above.

Code: Select all
if minetest.global_exists("wield3d") then
   wield3d.location["swords:big_sword"] = {
      "Arm_Right",
      {x=0, y=5.5, z=8},
      {x=-90, y=225, z=90},
      {x=0.25, y=0.25}
   }
end

Pro Tip: The value z=8 determines how far forward the object is translated.

Now the game loads but it doesn't affect object position. I am still holding it by the blade in front of the handguard. Changing z= doesnt do a single thing.
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

Kosmos
Member
 
Posts: 131
Joined: Sun Sep 11, 2016 12:42
In-game: KosmosHD

Re: Bigger swords

by Kosmos » Wed Jan 18, 2017 14:53

Gael de Sailly wrote:
Kosmos wrote:Hi,
I looked a lot MineCraft videos and i tought why MT have no big swords like Minecraft.

What is the purpose of such a sword, except imitating Minecraft on principle, and masking the player's view?

You look dangerouser in PvP.

-Kosmos
 

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

Re: Bigger swords

by stu » Wed Jan 18, 2017 18:20

GreenDimond wrote:Now the game loads but it doesn't affect object position. I am still holding it by the blade in front of the handguard. Changing z= doesnt do a single thing.

Well you must have done something wrong as the code works fine for me as you can see. I have attached a minimal working test mod, I hope this helps.
Attachments
swords.zip
LICENSE CC0 1.0 Universal (CC0 1.0)
(849 Bytes) Downloaded 27 times
 

Dragonop
Member
 
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
Location: Argentina
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
 

User avatar
GreenDimond
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Bigger swords

by GreenDimond » Thu Jan 19, 2017 15:55

stu wrote:
GreenDimond wrote:Now the game loads but it doesn't affect object position. I am still holding it by the blade in front of the handguard. Changing z= doesnt do a single thing.

Well you must have done something wrong as the code works fine for me as you can see. I have attached a minimal working test mod, I hope this helps.

I̶n̶ ̶y̶o̶u̶r̶ ̶m̶o̶d̶,̶ ̶t̶h̶e̶ ̶s̶w̶o̶r̶d̶ ̶i̶s̶ ̶f̶l̶o̶a̶t̶i̶n̶g̶ ̶n̶e̶a̶r̶ ̶m̶y̶ ̶f̶e̶e̶t̶.̶ ̶I̶f̶ ̶i̶t̶ ̶w̶e̶r̶e̶ ̶u̶p̶ ̶m̶o̶r̶e̶,̶ ̶i̶t̶ ̶w̶o̶u̶l̶d̶ ̶b̶e̶ ̶p̶e̶r̶f̶e̶c̶t̶.̶
EDIT: See next post.
Last edited by GreenDimond on Thu Jan 19, 2017 16:17, edited 1 time in total.
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

User avatar
GreenDimond
Member
 
Posts: 1299
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Bigger swords

by GreenDimond » Thu Jan 19, 2017 16:07

A̶l̶s̶o̶,̶ ̶n̶o̶ ̶m̶a̶t̶t̶e̶r̶ ̶h̶o̶w̶ ̶I̶ ̶c̶h̶a̶n̶g̶e̶ ̶t̶h̶e̶ ̶x̶/̶y̶/̶z̶ ̶=̶ ̶s̶t̶u̶f̶f̶,̶ ̶i̶t̶ ̶s̶t̶a̶y̶s̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶.̶ ̶I̶ ̶c̶h̶a̶n̶g̶e̶d̶ ̶i̶t̶ ̶t̶o̶ ̶t̶h̶i̶s̶ ̶j̶u̶s̶t̶ ̶t̶o̶ ̶s̶e̶e̶ ̶w̶h̶a̶t̶ ̶c̶h̶a̶n̶g̶e̶d̶ ̶w̶h̶a̶t̶ ̶a̶n̶d̶ ̶i̶t̶ ̶d̶i̶d̶ ̶n̶o̶t̶h̶i̶n̶g̶.̶
{̶x̶=̶0̶,̶ ̶y̶=̶5̶0̶0̶0̶,̶ ̶z̶=̶1̶0̶0̶0̶}̶,̶ ̶-̶-̶ ̶0̶ ̶5̶.̶5̶ ̶8̶
{̶x̶=̶1̶0̶0̶0̶,̶ ̶y̶=̶1̶1̶0̶0̶,̶ ̶z̶=̶1̶1̶2̶0̶}̶,̶ ̶-̶-̶ ̶-̶9̶0̶ ̶2̶2̶5̶ ̶9̶0̶
{̶x̶=̶5̶0̶,̶ ̶y̶=̶5̶0̶}̶ ̶-̶-̶ ̶0̶.̶2̶5̶ ̶0̶.̶2̶5̶
EDIT: Apparently I had a mod enabled that messed with the positioning. I dunno which one though. Will figure out later. It works!
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 


Return to General Discussion



Who is online

Users browsing this forum: No registered users and 2 guests