Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upShishkebab (New Melee Weapon) Ready to go! #2321
Conversation
NaturesWitness
added some commits
Jul 18, 2013
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 4, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 5, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
|
Okay did some more work on this, and I'm hoping someone can share their wisdom with me on a few things. First, noticed that there is no code for a target to take additional damage if a flaming weapon gets stuck IN them. This seems like a bit of an oversight, probably because so far, very few melee weapons have had flaming. Fixing this is beyond my coding ability, so I made an issue request and I'm hoping someone will add that in. Second, it looks to me that I'll have to make unique actions for EVERY flaming weapon I add, which seems needlessly redundant and would clog up iuse.cpp. Is there a way for me to make a FLAME_MELEE action, that looks at the source item, and looks at a list of items to see which one to turn it into when toggled? Lighting effects seem to be in the same bag, I'd have to add EVERY flame weapon to player.cpp to get light effects. Third, I thought it would be neat if while the shishkebab's on, there's a chance that it would go out randomly(Flame out). I think I know how to add this one, but I'm not certain I'll get it right. Finally, is there a way to add additional fire damage to each hit? Currently, it only does fire damage if you get a critical hit and set the target on fire. If anyone could clue me in on these things, I'd really appreciate it! |
i2amroy
reviewed
Aug 5, 2013
| if (t) // Effects while simply on | ||
| { | ||
| if (one_in(15)) | ||
| g->sound(p->posx, p->posy, 5, _("Your shishkebab crackles.")); |
This comment has been minimized.
This comment has been minimized.
i2amroy
Aug 5, 2013
Member
To have a chance to randomly go out while being carried just insert the "toggling" code from below with an rng() before it right here.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Oh wow thanks i2amroy for all the advice! This is why I love modding Cata so much; even if I don't know how to do something, if I just ask someone always helps me out. Like when I made the expanded martial arts traits; I never would have been able to finish it if people hadn't given me so many helpful tips. Knowing where to look in the code for examples of what I want to do is amazingly helpful. Cataclysm DDA may just have the most supportive mod base of any open-source game out there. On the fire damage though, I don't think it sets them on fire on every hit, I think it's just set so that if the game calls for a technique (ie you score a critical hit), if a weapon has the flaming tag it bypasses randomly selecting one of the techniques available and forces flaming. Which is kinda annoying, as it means a weapon with flaming can NEVER use any other offensive crit technique, so if a make a flame katana, it will never get rapid attacks, only flame ones. I might be reading the code wrong though, but when I play tested this I wasn't setting Zeds on fire at all. Got some other things to do this evening but I'll work on this later tonight. |
This comment has been minimized.
This comment has been minimized.
|
@i2amroy Yeah, I thought about setting it to only 50% chance, but it's only 3-4 turns of 3-8 damage. It doesn't really sound like that much does it? Compare with those flaming arrows that set monsters on fire for 10 turns. @NaturesWitness Flaming doesn't cause attacks to ignore other techniques, it happens 100% of the time, completely separate from other techniques. I should've made it a flag instead but I wasn't really thinking (I was going to make it a technique, then I realized it was likely to get crowded out by other techniques, but didn't think to change it to flag) and nobody pointed it out either. :p Overall the effect is the same, I think the only purpose of having separate flags and techniques vectors is for readability and maintenance, since techniques don't do anything unless you actually put them in pick_technique() and perform_technique(). |
This comment has been minimized.
This comment has been minimized.
|
Okay I know I'm doing something really stupid in here somewhere. For some reason, both the IF and the ELSE statements are coming back positive. I think the problem is I don't know the right command to check what the item is. I suppose I could give each item unique flags but that seems like a cheap and sloppy workaround. I know I should be able to figure this out myself but it's late and I'm tired and not thinking straight :( Anyone care to give me a hint? I also don't know how to get those code windows everybody else uses so this looks terrible. void iuse::shishkebab_off(game *g, player *p, item *it, bool t)
{
int choice = menu(true,
_("Using Fireblade:"), _("Turn on"), _("Use as Knife"), _("Cancel"), NULL);
switch (choice)
{
if (choice == 2)
break;
case 1:
{
p->moves -= 10;
if (rng(0, 10) - it->damage > 5 && it->charges > 0)
{
if (!p->has_amount("shishkebab_off", 1))
{
g->sound(p->posx, p->posy, 10,
_("With a whoosh, the shishkebab is covered in flames!"));
it->make(g->itypes["shishkebab_on"]);
it->active = true;
}
else (!p->has_amount("firemachete_off", 1))
;{
g->sound(p->posx, p->posy, 10,
_("With a whoosh, the No. 9 is covered in flames!"));
it->make(g->itypes["firemachete_on"]);
it->active = true;
}
}
else
g->add_msg_if_player(p,_("There is a small spark, but nothing else."));
}
break;
case 2:
{
iuse::knife(g, p, it, t);
}
}
}
void iuse::shishkebab_on(game *g, player *p, item *it, bool t)
{
if (t) // Effects while simply on
{
if (one_in(15))
g->sound(p->posx, p->posy, 5, _("Your fireblade crackles."));
}
else
{
int choice = menu(true,
_("Using Fireblade:"), _("Turn off"), _("Light something"), _("Cancel"), NULL);
switch (choice)
{
if (choice == 2)
break;
case 1:
{
if (!p->has_amount("shishkebab_on", 1))
{
g->add_msg_if_player(p,_("Your shishkebab sputters and goes out."));
it->make(g->itypes["shishkebab_off"]);
it->active = false;
}
else (!p->has_amount("firemachete_on", 1))
;{
g->add_msg_if_player(p,_("Your No. 9 sputters and goes out."));
it->make(g->itypes["firemachete_off"]);
it->active = false;
}
}
break;
case 2:
{
int dirx, diry;
if (prep_firestarter_use(g, p, it, dirx, diry))
{
p->moves -= 15;
resolve_firestarter_use(g, p, it, dirx, diry);
}
}
}
}
}I also don't know how to get those code windows everybody else uses so this looks terrible. |
This comment has been minimized.
This comment has been minimized.
|
I've taken the liberty of editing in one of those neat code windows into your post. You can open the edit window to see how it's done. And it seems like you want to be using an "else if" there, not an "else". @ejseto : z->add_effect(ME_ONFIRE, 1);
int tmp = rng(1,10);
if (tmp == 10) {
z->add_effect(ME_ONFIRE, 3);
} else if (tmp >= 8) {
z->add_effect(ME_ONFIRE, 2);
} else if (tmp >= 5) {
z->add_effect(ME_ONFIRE, 1);
}That would give a guaranteed 1 turn of fire (to simulate the extra "burning" damage), a 30% chance of 2 turns, a 20% chance of 3 turns, and a 10% chance of 4 turns. |
This comment has been minimized.
This comment has been minimized.
|
To be honest, I was skeptical about this at first, and it will probably get some flak from people, but we have a torch item that you can whack enemies with to set them on fire, so why not a sword that cuts them while it does it? |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the edit i2amroy knowing that will make it a lot easier to post code bits. Put in the ELSE IF commands, still getting same problem. Turning on a shishkebab turns it into a No. 9, and turning off a No.9 turns off both a shishkebab and a No. 9. Turning off an active No. 9 gives this: I must be using the wrong command to look for the item. I'll fiddle with it some more, but maybe I should just give each flame weapon a unique flag, IS_SHISHKEBAB, IS_FIREMACHETE, etc. and have the toggle code look for those. One concern I had with using has_amount was if a person had multiple flame weapons in inventory, it would probably bug out. I'm not sure if adding lots of unique flags like this is a good idea though, will it start to slow down the game? Also, can't seem to figure out how to get it to pull the name of the item for the menu text string. The pkill code here: g->add_msg_if_player(p,_("You take some %s."), it->tname().c_str());grabs the name of the item being used. What I can't figure out is how to use that in: int choice = menu(true,
_("Using Fireblade:"), _("Turn off"), _("Light something"), _("Cancel"), NULL);replacing Fireblade with the name of the item. Is this type of string even usable inside a menu listing? I'm really starting to wish I'd taken C++ in high school :( Perhaps giving each item its own pair of actions is the way to go after all. I was thinking of tweaking some of the flavor text and stall-out rates for each one, which would require unique actions anyway. I don't see myself making more than five flame weapons anyway; makeshift machete, regular machete, forged sword, katana, and possibly either a sledgehammer or some big two-handed sword like a claymore, just so we can have something with both FLAMING and WIDE. I saw melee.cpp has support for it so might as well try and use it :) That's ten new actions, and five more entries in active_light. Would that be considered clutter? (I'm kinda paranoid about this because I used to do a lot of stuff with modded units in an old RTS game called Total Annihilation, and having too many kinds of unique guns could overload the game, so you had to be careful.) Well I gotta go get some sleep it's nearly midnight here. Maybe tomorrow I'll try to write the .json entries for the rest of the weapons. I could use some advice on recipes/skill requirements for these, as well as their stats, such as how much weight and volume gets added, fuel capacity and how quickly fuel's consumed when in use. The current recipe assumes you're essentially taking a spraycan flamethrower, attaching it to a melee weapon, using some extra pipe to make the fuel nozzles along the blade, and using some pieces of leather to insulate the handguard from the heat. Haven't thought much about required tools yet, maybe soldiering iron and hacksaw? Or would welder be more appropriate? Eh, I'll sleep on it, good night everybody! PS - Just saw kevingranade's comment before I finished typing this. Hooray! Thanks kevin! One of my biggest fears with this was that someone like you or GlyphGriff would take one look at it and say it was too out there and couldn't be put in. I promise I'm going to do my very best to make this as balanced and fun as possible, and not be some silly munchkin thing. I really think this fits in well as an expansion of the concept of "craftable" weapons that we've got going recently with the archery expansion and Rivit's new guns. I hope this also inspires people to do more original things with melee weapons, which felt like they were getting left out in the "coolness factor" department. I'd love to see more items that use actions to have interesting effects, particularly "powered" melee weapons like this (The chainsaw was getting lonely!) Now all we need is for someone to build the Rod of Lordly Might. (Nah just kidding, that probably would be too out there.) PS - PS |
This comment has been minimized.
This comment has been minimized.
|
@i2amroy That sounds pretty reasonable. I don't play melee characters so my idea of balance is probably a bit skewed. @NaturesWitness As i2amroy pointed out, you're missing an "if" after that "else." Also, after that else, you've got a ; (at the beginning of the next line) which I believe basically nullifies that else, and the rest of that block gets executed as if that else weren't even there, which would explain why you're getting both items on deactivation. |
This comment has been minimized.
This comment has been minimized.
|
Thanks ejseto I can't believe I missed that ; thing. Actually I can believe it sadly, I seem to do that a lot. I remember the first time I tried compiling this, codeblocks gave me an error that a ; was missing so I blindly added it. I think I should have used a , instead. I'll try and work on this today, I think I'm in a different time zone from you guys so I'm guessing I can't run any of this by all of you until later tonight. Not sure how much I can do today though, got a lot of RL stuff to do. Two questions though, Int item = (item.id)And use item as a value to check against in the IF statement, is this on the right track? Second, I would like the title in the menu string to look at what item is being used so I don't have to just have some generic string like "Using Firesword". I' d like it to say " Using Shishkebab" when using a Shishkebab, "Using No. 9" when using a No. 9, etc. The action for pkill retrieves the item name so I think it's possible. I tried putting "Using %" similar to what pkill has, but it just gave me a % instead of the name, so I must have missed a code string somewhere. |
This comment has been minimized.
This comment has been minimized.
|
I was thinking about the description of the weapon, dousing the blade with |
This comment has been minimized.
This comment has been minimized.
|
That's actually sort of what I meant, my thinking was a piece of pipe goes up the back edge of the blade, and has holes along its length that aim towards the front edge of the blade with little fire jets. Picture the burner off a gas grill. WARNING - WARNING - WARNING This is sorta what I had in mind; pressurized flame jets, not just dumping liquid gas on the blade. |
This comment has been minimized.
This comment has been minimized.
|
Coolcool, I'm not sure how effective that would honestly be against e.g. |
This comment has been minimized.
This comment has been minimized.
|
To be honest, it doesn't add THAT much damage to flesh targets. This is really more of a one-off/utility weapon instead of a powerhouse. It functions as a torch, a lighter, a knife and is very effective against plants. I do like your idea of it primarily being focused on heating the blade though. I wonder, should I add extra cutting damage when it's turned on to simulate the heat doing extra damage to the target? I thought of also giving it the no_stick flag when on, as I figure a hot blade would be less prone to getting stuck. It works for butter, why not zombies? PS - Crap I don't think my picture actually made it on the post, I have to read up on how to attach images. |
This comment has been minimized.
This comment has been minimized.
|
Nah, I don't think it'd be hot enough to melt flesh or even fat on contact, |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 7, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
|
Okay I think I've got the framework for these figured out, so the next question is; how many types should I make? We've got the Shishkebab, a fairly weak and unreliable starting one, and the No. 9, a stronger and more dependable model for more experienced characters. Here's the other ones I was thinking of: Firebrand; An expert level weapon made from either a forged sword or a broadsword. I'm not sure where to go with this, on the one hand I'd like to use the forged sword so people have a high-level option where they can craft the blade themselves. But it takes a whopping 9 mechanical to make a forged sword. Should I reflect that in the difficulty to make the firebrand, and require something like skill 10? If I make it lower, it's just teasing people because they still can't make the recipe because they can't get the component (the forged sword). If I use the broadsword, people have to search high and low for a fairly rare item, and I have to make the recipe even harder than the one for the forged sword because the broadsword does more damage. And how do I set the fuel use/ reliability for these? I could really use some advice here as the only thing I'm worse at than game CODING is game BALANCE. Rising Sun; The top of the line model, made from a katana. Should I require some ridiculous skill level (12) for this? I feel strange requiring vastly different skill levels for these, as the mechanics of the project are largely the same. I also don't really like having the best model be made from the katana, as I feel the whole "Ooh it's from the Far East it must be the best sword ever!) thing is GREATLY overused in video games. But currently it's the best sword in Cata stat wise so I'm not sure what else to do. Finally, I'd like to make a large flame weapon that has WIDE, perhaps make that one be top of the line. But the only weapon with WIDE right now is the sledgehammer, and I'm not sure how well a blunt weapon fits with this whole concept. What I'd really like is a two-handed sword like a claymore that has WIDE to use as a base, but Cata doesn't have one and I have ZERO idea what a claymore's base stats should look like, so I can't just make one. So in essence, while I have this thing sorta figured out code wise, I'm still pretty lost STAT wise. For the moment, I think I'll mjust make the rest of these, and guess on stuff like stats and recipes as best I can. Once it's up and posted on the pull request, people can look at it easily and (hopefully) advise me on how to balance the stats. I think I'll also make a separate pull request for more large weapons that have WIDE, maybe someone more creative than me can make some and figure out how to put them in game. "Well then, I'm off to coding. So until we meet again and the case is solvED!" |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 7, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 7, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 7, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
|
Okay I think most of this is done, so now it just needs stats balanced, recipe tools and ingredients thought out some more, and maybe some better descriptions for the items. I'll probably do a version of the forged sword too (maybe call it flametongue). I really could use help with this part, as I'm terrible at setting stat values. I' also like to hear what people think of the text in the iuse.cpp menus, and if it's interesting and entertaining, or stupid and confusing. I just got tired of making all the entries cut and paste. |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 7, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
|
Sorry I haven't gotten around to reviewing this earlier. |
This comment has been minimized.
This comment has been minimized.
|
Thanks for looking at this kevin. Even I admit the katana description was pretty bad, I just ran out of ideas. I'll redo the descriptions, I think you've got the right idea with the heating the blade thing. I'll also work on the formatting thing, I ran astyle through codeblocks on the .cpp files but I forgot to format the .json stuff, I can't believe how bad the recipes look :( |
This comment has been minimized.
This comment has been minimized.
CataJenkins
commented
Aug 9, 2013
|
Build successful! |
This comment has been minimized.
This comment has been minimized.
|
I go offline for a week, and you get busy. Looking good. |
This comment has been minimized.
This comment has been minimized.
|
Btw, the weight system was overhauled recently, so your weights are way off, but I'll just fix that in the merge. |
This comment has been minimized.
This comment has been minimized.
|
Ok thanks kevin so I can let you handle this from here then? |
This comment has been minimized.
This comment has been minimized.
|
yep, in the process of merging a batch of PRs now... though my alarm just went off, time for t'ai chi. |
NaturesWitness commentedAug 4, 2013
With all the fancy new bows and exotic firearms being added lately, I thought we needed something new and exciting in the way of melee weapons. So we give you the "Shishkebab"! Essentially the same as the weapon of the same name in Fallout 3, this is a makeshift machete that has been combined with a crude flamethrower to make a primitive flaming sword. It's not incredibly powerful, but it's fairly simple to make. It also functions as a torch and a lighter when it's turned on, and can be used as a knife like any other edged weapon when off. I'm thinking of making some more powerful and difficult to build versions based on the stronger melee weapons (machete, broadsword, and katana), but first I'd like to see if there would be any interest in adding this to the game. I know we're trying to not get TOO out there when it comes to items (No lightsabers or magic spells), but I think this fits in the realm of feasibility fairly well and would give melee a nice boost to the "funky" makeshift weapons section. C'mon, archery gets mini-ballistas and repeating crossbows, firearms gets homemade pneumatic assault rifles that shoot pebbles, unarmed get ALL kinds of crazy martial arts styles, and the most fun melee gets is a wooden sword with nails in it?? We want cool things too!
Tested and works but I'd like to add some more items before it's pulled
Note:
This isn't my idea; I saw it in a post on the forums by Inquisitor Dust and thought I'd see how hard it would be to do the hard-coded actions for it. It came out so well I thought I'd post it and see what other people thought of it, and it includes too many files to easily post on the forums.
EDIT This is ready to go, tested and works. But if anyone has any suggestions for improvement, I'd still love to hear them!
This has changed a bit from the original description. Now adds four new "Firesword" weapons; the Shishkebab, No.9, Firebrand, and Rising Sun. They are based on the makeshift machete, regular machete, broadsword, and katana respectively. Although slightly heavier and more bulky than their counterparts, they have a fuel assembly and system of gas burners on the blade. When filled with gas and switched on, the blades are covered in flames, setting enemies on fire and lighting up dark areas. All four of these items are craft only, with the Shishkebab and No. 9 being fairly easy, and the Firebrand and Rising sun being much harder. The Shishkebab and No. 9 are also somewhat unreliable, sometimes taking multiple attempts to light, and also going out unexpectedly on occasion.