Isy's Archery Mod

Hi Everyone!

I was interested in adding some stuff to this awesome game but didn’t know where to start, so I started thinking and thought of the time I was playing cata and found myself a shiny longbow, unfortunately I didn’t have 10 strength and, as you all know, you cannot gain stats ingame (without weird mutations and I’m not into that). So I found myself getting some steroids in the form of savegame editing :). While some of the longtime players might know that you just need 10 strength if you want to archer reliably, new folks don’t.

That’s why I took the liberty to add 4 new bows to the game and 1 new recipe (well new its the same as the longbow recipe). The new recipe is for a shortbow that requires 8 strength, so now you can craft a 8 strength bow instead of having to search for a compound bow.

There are a few issues though… I have found out myself that archery is quite OP, I found myself running around with a longbow and 100 arrows and 2 shot every zombie I found. (this was in 0.4 though without the durability system). Anyway as fixing the archery problem requires editing already existing code I did not do that. But I feel it requires nerfing the fast reload times of the bows as that really did make it easy to rapid fire your way to victory.

Another problem is the fact that the strength requirements for bows are hard-coded into the game and you can’t use uneven numbers as strength requirement because of this. I also did not know if I could edit certain stats on the bows, “ranged_damage” en “to_hit” to be precise as these were both 0 on the existing bows. If those are just editable it would make balancing the bows I added way easier.

Anyways, attached in this post is a .rar with the files (ranged.json recipes.json mapitemsdef.cpp and edits.txt). Edits.txt is a summary of what I edited and I strongly recommend reading it.
If you want to add this to your game you’ll have to get the source code and replace the current 3 files (not edits.txt) with the files in the .rar . HOWEVER I have not compiled or tested the game in ANY way to see if the changes work. I haven’t done any of this because my goal with this is to get it added to the main game (I know it sounds smug, but I’m just trying to add some spices to an already great dish). I’d prefer to spend my time to add more stuff to the game instead of altering the current game.

I do know that just 4 bows is not a lot, but I’d like to see this as a small start, if this is received well by the devs I’d like to work on adding some more to the archery thing before moving on to something else. Some plans I had in might were adding chickens you could kill for feathers so you could feather arrows to make them more stable (current arrows are just wooden sticks with pointy ends, at least the crafted ones, in my mind).

Current state:

-Added 4 new bows, composite bow, recurve bow, reflex bow and the shortbow. The latter being a less strength requirement alternative to the longbow
-Added Arrowheads, craftable from scrap and steel lumps
-Added Feathers, which are dropped by crows
-Added Wooden shafts, same recipe as the old wooden arrow
-Wooden arrows are now crafted with arrowheads, feathers and wooden shafts
-Buffed the compound bow to make it the best bow, but also the rarest

To do:

-Make a distinction between crafted bows and arrows from found, industrially produced, bows and arrows
-Add more types of arrows
-Make a system to adjust the draw weight, tension of the bow (gonna be tricky)
-Whatever awesome suggestions you guys come up with!

If this makes just 1 guy excited I would be honored.
-Isy

(P.S. English is not my first language and my keyboard and I have a love-hate relationship so if you see any errors, that’s why.)

Edit: Removed the .rar file and just attached the Edits.txt (contains some useful information) and added my github link https://github.com/Isylwin/Cataclysm-DDA/tree/Archery
Edit2: Check out Flare’s Archery Expansion! http://smf.cataclysmdda.com/index.php?topic=863.0


Edits.txt (2.64 KB)

Very exciting indeed.

Still, for distribution, rars attached to forum posts are not the way to go.

The thing to do is to make an account on GitHub, and familarize yourself with the basics there.

There is some work on your part to set your environment up correctly, but once that done, it makes things all the more doable for everyone involved:

For the dev team, for you, and for users.

The first thing you’ll need to do, of course, is to fork the CleverRaven repository into your newly created account, and work off of that.

Thanks Williham for your response.

I’ve looked into it, but I’m probably being a retard…

I’ve created a GitHub account and forked CleverRaven’s repo. Then I downloaded GitHub for windows (their app thinghy).
I proceeded by cloning the repo I forked to my local machine and then I made a branch, naming it Archery, and edited the files that I previously edited.
I then commited the changes and ended up here.

[URL=http://imageshack.us/photo/my-images/401/wutwut.png/]

I could probably find out what I have to do now but it seemed wiser to me to ask someone who just flat out knows.

I’m not familiar with the particulars of their app, but what you need to do is to push your local changes to your repo, and then submit a pull request.

Once you push your branch to your repo, and view your repo on GitHub, it should offer you the option to make a pull request.

There’s a durability system for weapons now?

EDIT: I am inept at Github, how do I install mod?

I believe I got the github thinghy alright, it would be great if someone could confirm that so I can make a guide on how I did it (with the new app of github for windows, as windows is the primary OS for most people I think)

@Morrigi: I thought I saw that somewhere in the changelog but after checking I couldn’t find it again. I’m afraid it’s something my mind created when I saw the durability parameter in the .json files.

Yep, that’s about right.

You might want to mind your commits and ensure that they are a little bit cleaner, but the pull request and fork and everything is in order.

Thanks for directing this to Github, Wito :).

The mod is almost ready for merging into mainline, in my opinion - just needs some attention to the accuracy field (which is confusing at present, admittedly), and the addition of the ALWAYS_TWOHAND flag.

For your remaining uncertainty about modding those items: The ranged_damage field can be edited freely, yes. And a quick check in itype.h indicates that it can even be negative, if that’s required for balancing. The to_hit field can ALSO be edited, but that’s melee accuracy, so… you probably don’t have reason to change that.

And we are indeed in need of a Windows-friendly Github tutorial, so if you wanna write on up, that would be awesome :).

Hey Soron, thanks for your feedback!

I’m reading this just before heading to bed (I’m europian) so I’ll make a start in the morning with that github tut, I’ll just post it in the current github post.

As for the balancing, I’ll look into it again and change some parameters to balance it more. I won’t send it to you guys till I add some more stuff though so you don’t have to check my work whenever I make one little addition. I think it’ll be less work for you guys if you can check it in bulk.

-Isy

Just cross-referencing: have you seen this mod?
http://smf.cataclysmdda.com/index.php?topic=863.msg9322

If you’re gonna use some of that mod to balance, keep in mind everything after the 30kg bow is severely overpowered. There are no drawbacks for those end game bows, all of the draw back (haha) is concentrated in the build cost. It takes a lot of bulky materials, and it takes days to finish crafting.

@KA101 Nope I haven’t done my research :confused:

@Flare I hadn’t seen your mod before making all this, so everything I added is based on the current (10 june actually) source code. Although your mod is wicked awesome, I really like your idea on taking draw weight in effect. I also haven’t balanced anything that currently exists (I don’t want to alter the current game in any way at the moment), I actually think the bows I added just add to the OPness at the moment. Anyway, I don’t know what your intentions are with your changes, but if they were to get them added to the base game I’m more than happy to scrap my mod and help (if you want ofcourse) with yours. I’m sorry for posting this without doing my research.

i’ve been waiting for an archery expansion to make it into mainline for a while - and was happy to see slings in.

can’t remember where i saw this first - it might even have been in the thread about flare’s mod, but in regards to flight arrows…

… duct tape arrows.

but if you want to go the feather fletching there are already crows in the game (last i checked) that could drop feathers

Yeah, if you wanna tinker with existing stuff, the first thing I’d do is add fletching, and have unfletched arrows give terrible range and accuracy.

(dammit, dictionary, fletching is too a word!)

Hey,

I’m currently working on adding fletching to the game, which will also nerf the archery (which I see as OP). Because you’ll have to make arrowheads, shafts and get feathers before you get the wooden arrows you can currently just craft in the game.

However, I’ve run into an issue… I want to add feathers as a drop from crows but I don’t really know how to do that. I’ve found mtype.h with the flags (like MF_FUR, which is exactly what I want but with feathers of course) and I’ve found mtypedef.cpp where I can add it to the crows. The issue is that I don’t know where to define the flag and also I don’t know if I have to edit anything else except defining the flag and adding the flag.

Thanks in advance
-Isy

I assume you intend to obtain feathers only through butchering - if so, the relevant code is in game.cpp, in the complete_butcher function.

If you are looking for feathers being dropped when a crow dies, then you would need to define a new map item group in mapitems.h, populate that group with feathers in mapitemsdef.cpp, and then add that group to monitemsdef.cpp.

Hey guys,

First off, thanks DinoCat for the info! Second off, I’d like to tell that the new version is out with fletching (if you want to call it that :p). An important note though, I haven’t compiled and played it yet to see if it works, going to do that right after posting this, but it might take a while. In the meanwhile someone with more coding experience than me i.e. has coded anything before in C++ could check my code to see if it correct (I would be eternally grateful). Edit: compiled and played the game, current version (there should be 2 bug fixes) should work, I haven’t killed any crows though to see if they really work as intended Also, I don’t know why, but in game.cpp a lot of deletion and addition got recognized as edits (while the code stayed the same). This clogged up the overview of the changes made to that file, the real changes are at line 8700. If someone knows why that happens and what can be done against it please tell (I’m using codeblocks). Anyway here’s a changelog of what changed since the last version:

-Added Arrowheads, craftable from scrap and steel lumps
-Added Feathers, which are dropped by crows
-Added Wooden shafts, same recipe as the old wooden arrow
-Wooden arrows are now crafted with arrowheads, feathers and wooden shafts
-Buffed the compound bow to make it the best bow, but also the rarest
-Balanced the bows out that were added in the first version, allowing the player to better choose their bow playstyle

To do:

-Make a distinction between crafted bows and arrows from found, industrially produced, bows and arrows
-Add more types of arrows
-Make a system to adjust the draw weight, tension of the bow (gonna be tricky)
-Whatever awesome suggestions you guys come up with!

Nice, I like the way you’re going with this. The lack of a arrowhead when crafting arrows has been bothering me for a while :stuck_out_tongue:

The phantom line changes may be due to your editor swapping out UNIX-style newlines for DOS-style newlines, not free to look at it to chek at the moment though.

Kevin you are talking chinese to me, but that’s probably my fault haha. I’ll look into what you just said on the almighty google later, next thing up after completing this is the mod list update.

Another quick question though, if I want to check my code for little errors or see if my changes work, will compiling to the trick? Or do I need to play the game till I find my changes having effect?

[quote=“Isylwin, post:19, topic:1694”]Kevin you are talking chinese to me, but that’s probably my fault haha. I’ll look into what you just said on the almighty google later, next thing up after completing this is the mod list update.

Another quick question though, if I want to check my code for little errors or see if my changes work, will compiling to the trick? Or do I need to play the game till I find my changes having effect?[/quote]

Ah, the eternal, “does it compile” question. The compiler will catch many syntax errors (forgetting a comma or semicolin, wrong number of parentheses, etc), but it’s quite easy to convince the compiler that you know what you’re doing, but still do something that will break the program, especially in c/c++.

tl;dr, no, you really need to go in the game and check that your changes do what you wanted them to do.