[Mod] Throwing, PilzAdam version [throwing]

User avatar
SAMIAMNOT
Member
Posts: 416
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie
Location: Desert

Re:

by SAMIAMNOT » Post

DeepGaze wrote: real bomb explodes at target
Grenade?
I test mines.

User avatar
LodeRunner
Member
Posts: 25
Joined: Mon Nov 17, 2014 03:14
Location: Random Desert Biome

Re: [Mod] Throwing, PilzAdam version [throwing]

by LodeRunner » Post

Folks,

I've been trying to learn lua and minetest by reading the code for a bunch of mods. One of the items that I'm most interested in is the bow/arrow model, as I'd like to eventually create additional mobs who use bows also, sort of like the skeletons from MC but not exactly. Therefore, I had some questions:

1) Just as a learning experience, I tried to adapt the TNT arrow from the original throwing mod to this one. However, it uses the iron-TNT item from the nuke mod which is not what I prefer. I'd like to stick with the existing TNT mod that is part of the base install. However, when looking at the code, I don't think that I can detonate the default TNT by just hitting it or having it hit something else--I don't think that it's coded for that. Being new to lua, I wasn't sure if the code for how detonation happens should be taken from tnt:tnt or from the code for the arrow itself.

2) Other than including a reference to tnt:tnt in the crafting recipe and the depends.txt, would I need to reference the tnt:tnt lua code in any way? Does lua use cross-referencing like this, or does all the code have to reside in the lua file for the arrow?

3) Does this item (a TNT arrow) already exist for this version of the throwing mod?

4) I had also thought about creating an arrow that would attach a "torch" to wherever the arrow hits/lands, thereby allowing to get torches to otherwise inaccessible locations. Does a "torch arrow" already exist?

5) Would it make sense to develop an api.lua file that would hold common code about arrows? It seems that this mod has lots of potential, not only for players but new mobs as well. Not knowing enough to know better, this seemed like a legit question.

Thanks for any help!
LodeRunner
Wait...didn't I just explore this cavern?

User avatar
SAMIAMNOT
Member
Posts: 416
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie
Location: Desert

Re: [Mod] Throwing, PilzAdam version [throwing]

by SAMIAMNOT » Post

Im not sure about the coding part but from what I remember you nee a fuse to detonate TNT. If you arent planning to make Skelly throw gunpowder and fire along with his TNT you might have to reference to the detonating code. If the TNT mod uses a function to detonate the TNT just referring to the function should do the trick.
Sorry if my advice doesnt help. I sont know Lua but I do code in Python and JavaScript so I do kinda know what Im talking about. Kinda.
Im interested in this mod youre talking about, its a fascinating concept.
I test mines.

User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: [Mod] Throwing, PilzAdam version [throwing]

by Calinou » Post

LodeRunner wrote:Folks,

I've been trying to learn lua and minetest by reading the code for a bunch of mods. One of the items that I'm most interested in is the bow/arrow model, as I'd like to eventually create additional mobs who use bows also, sort of like the skeletons from MC but not exactly. Therefore, I had some questions:

1) Just as a learning experience, I tried to adapt the TNT arrow from the original throwing mod to this one. However, it uses the iron-TNT item from the nuke mod which is not what I prefer. I'd like to stick with the existing TNT mod that is part of the base install. However, when looking at the code, I don't think that I can detonate the default TNT by just hitting it or having it hit something else--I don't think that it's coded for that. Being new to lua, I wasn't sure if the code for how detonation happens should be taken from tnt:tnt or from the code for the arrow itself.

2) Other than including a reference to tnt:tnt in the crafting recipe and the depends.txt, would I need to reference the tnt:tnt lua code in any way? Does lua use cross-referencing like this, or does all the code have to reside in the lua file for the arrow?

3) Does this item (a TNT arrow) already exist for this version of the throwing mod?

4) I had also thought about creating an arrow that would attach a "torch" to wherever the arrow hits/lands, thereby allowing to get torches to otherwise inaccessible locations. Does a "torch arrow" already exist?

5) Would it make sense to develop an api.lua file that would hold common code about arrows? It seems that this mod has lots of potential, not only for players but new mobs as well. Not knowing enough to know better, this seemed like a legit question.

Thanks for any help!
Carbone has a modified throwing mod with torch arrows (places a torch at landing location), dig arrows (digs at landing location) and build arrows (builds obsidian glass at landing location). However, the torches will always be placed on their “ceiling” variation.

User avatar
LodeRunner
Member
Posts: 25
Joined: Mon Nov 17, 2014 03:14
Location: Random Desert Biome

Re: [Mod] Throwing, PilzAdam version [throwing]

by LodeRunner » Post

Samiamnot and Calinou,

Thanks for your feedback.

S - That helps me to flesh out what I was thinking. I wasn't sure about referencing the function, but I thought that might be necessary. Detonation will be the real trick here, methinks. If I do a skeleton-related mob, I was initially thinking of just normal arrows, that way I could confirm one piece of the puzzle at a time. Other projectiles would come later. *evil grin*

C - Thanks for the tip. Using the graphic for ceiling attachment may not be an issue at the start. I was just wanting to do a proof-of-concept mod for myself. If I were to get anything useful, I'd let everyone know what I developed, but I'm a bit too far away from that to say at the moment.

I'll keep working on this when I can. I have family members who are ill right now, so my time to invest is sporadic.
LodeRunner
Wait...didn't I just explore this cavern?

User avatar
LodeRunner
Member
Posts: 25
Joined: Mon Nov 17, 2014 03:14
Location: Random Desert Biome

Re: [Mod] Throwing, PilzAdam version [throwing]

by LodeRunner » Post

Folks,

Just in case this issue has plagued anyone, I wanted to cross-post a link to another discussion.

Several people asked if there was a way to have mobs drop their respective items when killed by arrows, as this didn't seem to be happening. Swords worked fine, but not arrows.

Here is a solution that may be helpful for people:

viewtopic.php?f=11&t=3063&p=162717#p162717

I have tested it with hostile and non-hostile mobs, and it appears to work, but please see the boldface caveat in the explanation, as that may have an effect on its use.

Moderator - if cross-posting like this is a breach of policy, my apologies. Please adjust as you see fit.
LodeRunner
Wait...didn't I just explore this cavern?

User avatar
Samson1
Member
Posts: 95
Joined: Wed Apr 01, 2015 19:41
GitHub: MoJo4000
IRC: Samson1
In-game: Samson1

Re: [Mod] Throwing, PilzAdam version [throwing]

by Samson1 » Post

What this mod needs are much better textures for the textures that it has at the moment are so got that it does not look like an arrow, the bow does not have a pull back time and it does not have any animation. You can not have dig arrows/build arrows. I would think about changing the default textures and re making the mod

User avatar
benrob0329
Member
Posts: 1341
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
IRC: benrob0329
In-game: benrob03
Location: Michigan
Contact:

Re: [Mod] Throwing, PilzAdam version [throwing]

by benrob0329 » Post

I use [throwing] enhanced, it's based off of this mod. As for the animation, this isn't currently possibe with the way that the HUD works.

User avatar
Samson1
Member
Posts: 95
Joined: Wed Apr 01, 2015 19:41
GitHub: MoJo4000
IRC: Samson1
In-game: Samson1

Re: [Mod] Throwing, PilzAdam version [throwing]

by Samson1 » Post

Do you think you could make the arrow stick into blocks? like wooden fence and wood and so on?

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Throwing, PilzAdam version [throwing]

by Echoes91 » Post

If you're interested, my throwing enhanced mod which was forked from this one has now more complex reload and damage systems (with different reload times and stiffness), improved textures and contents (crossbows, spears and many different arrows) and it's still being developed.
If you like sticking arrows have a look at the basic bow mod, which already implements it; I'm also looking at its code but I'm still not sure if adding such a feature.

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: [Mod] Throwing, PilzAdam version [throwing]

by pithy » Post

Would it be possible to make this work with an armor mod so that you put your bow in your shield slot to allow you to throw arrows?

saavedra29
Member
Posts: 31
Joined: Mon Mar 06, 2017 00:19
GitHub: saavedra29

Re: [Mod] Throwing, PilzAdam version [throwing]

by saavedra29 » Post

Hello, thank's for this great code.
I'm making some changes to fit it in my own needs. But since i focus on realism i want to make it impossible for the bow to reload and shoot if at least (for example) 2 seconds haven't past since the last shot. But on this mod i can shoot every single moment i press the key. The "punch" function confuses me.

Code: Select all

obj:punch(self.object, 1.0, {
    full_punch_interval=1.0,
    damage_groups={fleshy=damage},
}, nil)
Here i see two 1.0s and thought one of them would create some forced delay. But it doesn't. Does anyone have an idea how to implement this "delay"?

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Throwing, PilzAdam version [throwing]

by Echoes91 » Post

saavedra29 wrote:Hello, thank's for this great code.
I'm making some changes to fit it in my own needs. But since i focus on realism i want to make it impossible for the bow to reload and shoot if at least (for example) 2 seconds haven't past since the last shot. But on this mod i can shoot every single moment i press the key. The "punch" function confuses me.

Code: Select all

obj:punch(self.object, 1.0, {
    full_punch_interval=1.0,
    damage_groups={fleshy=damage},
}, nil)
Here i see two 1.0s and thought one of them would create some forced delay. But it doesn't. Does anyone have an idea how to implement this "delay"?
My throwing enhanced mod has a reload system implemented with different reload time for each bow and crossbow. Have a look if you're interested :)

saavedra29
Member
Posts: 31
Joined: Mon Mar 06, 2017 00:19
GitHub: saavedra29

Re: [Mod] Throwing, PilzAdam version [throwing]

by saavedra29 » Post

Echoes91 wrote:
saavedra29 wrote:Hello, thank's for this great code.
I'm making some changes to fit it in my own needs. But since i focus on realism i want to make it impossible for the bow to reload and shoot if at least (for example) 2 seconds haven't past since the last shot. But on this mod i can shoot every single moment i press the key. The "punch" function confuses me.

Code: Select all

obj:punch(self.object, 1.0, {
    full_punch_interval=1.0,
    damage_groups={fleshy=damage},
}, nil)
Here i see two 1.0s and thought one of them would create some forced delay. But it doesn't. Does anyone have an idea how to implement this "delay"?
My throwing enhanced mod has a reload system implemented with different reload time for each bow and crossbow. Have a look if you're interested :)
Thank's. It looks very sophisticated! Since i don't mess with modding the last months i'll just try it on online servers. It looks great.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests