rabidrage Posted October 20, 2015 Well, guys, I've done my best to stay off of here and figure stuff out for myself, but this one's got me all kinds of confused. Since I added the CWeapMace to my weapon complement in Doom, I figured it should probably have the benefits of the Berserk Pack added to it as well as to the Fist. Is there a simple way to do this? I looked at the Berserk Pack's decorate definition, and there's nothing that specifically points it to the Fist. I've seen ways to replace the Fist, but no way to edit a second weapon so that its damage is multiplied by the same amount. Any help would be, as usual, greatly appreciated. In other news, I'm hoping to have an alpha of the map presentable by the end of the month. 0 Share this post Link to post
scifista42 Posted October 20, 2015 The Fist uses A_Punch for its attack. A_Punch is hardcoded to multiply damage 10-times if the player has PowerStrength in his inventory. PowerStrength is the item given by a Berserk. A simple way to replicate the effect for any weapon without using A_Punch is described in the 2nd example on this page. 0 Share this post Link to post
rabidrage Posted October 21, 2015 Thanks, that seemed to work, albeit with a lot of trial and error. But supposing I want the attack to still behave like A_CMaceAttack? I've noticed the Mace seems to be able to hit multiple monsters at once--I don't think it's been doing it now in Berserk mode, since I've had to redefine the characteristics like damage, range, etc. under CustomPunch. I even went and used the range for the sword in the example because I don't know what numerical distance was originally applied to the Mace's range. It seems like it has the same range both ways, but it's difficult to be sure. 0 Share this post Link to post
scifista42 Posted October 21, 2015 Oh, you don't need CustomPunch at all! The example is meant to show how A_JumpIfInventory allows you to make a weapon with different behaviours depending on presence of certain type of item (in this case PowerStrength) in player's inventory. The weapon will check for said inventory item and then jump to a respective attack state, each of which can be entirely different, and defined however you want! 0 Share this post Link to post
rabidrage Posted October 21, 2015 Okay, that part is good. However, if I try to redefine the parameters A_CMaceAttack I get an error ("you cannot pass parameters to A_CMaceAttack"). I'm still a bit fuzzy on how to keep CMaceAttack the same and just multiply the damage it does. A_JumpIfInventory works like a charm, but the next step is a tricky one. I don't know what's hardcoded into CMaceAttack or how to change it, or even how to replicate it. 0 Share this post Link to post
scifista42 Posted October 21, 2015 I briefly looked at A_CMaceAttack reference, and I immediately see that 1) it cannot have any parameters and 2) is restricted to CWeapMace and derived classes, meaning that you shouldn't use it in a random Doom weapon replacement unless it inherits from CWeapMace. However, I think you would achieve "multiplied damage" by calling A_CMaceAttack several times within 1 tic, the code would look like this:ABCD EEEEE 0 A_CMaceAttackWhere ABCD is sprite name, E is subsprite letter, and E is entered as many times as much you want to multiply the damage. I am honestly surprised that there is no "generalized" version of this function that would take parameters like damage amount. Maybe there is, I just can't find it. If it exists, it should be listed among these functions. 0 Share this post Link to post
Arctangent Posted October 21, 2015 Nope. It's some weird lacking in the weapon functions, considering how useful ray-based melee weapons are. 0 Share this post Link to post
rabidrage Posted October 21, 2015 Yeah, it seems a bit odd that it's so restrictive. I had looked at that myself and didn't know what to do with it. But your solution seems to work pretty well, Scifista42. There are only a couple tiny things that nag at me now that I've implemented it. The first is one I can ignore because it actually makes sense--it causes the Mace attack to repeat faster. No reason a rush of super adrenaline wouldn't do that. The only other problem is that when you swing at a wall, it only makes a sound with every other hit. Any idea why? Regardless of such minor problems, you're a genius. :) Keeping CMaceAttack is important to keep the range consistent, and to take advantage of certain Mace-specific abilities. You can damage more than one enemy per swing and you don't even have to be fully facing anyone to hit them. I love it! 0 Share this post Link to post
scifista42 Posted October 21, 2015 rabidrage said:There are only a couple tiny things that nag at me now that I've implemented it. The first is one I can ignore because it actually makes sense--it causes the Mace attack to repeat faster. No reason a rush of super adrenaline wouldn't do that. The only other problem is that when you swing at a wall, it only makes a sound with every other hit. Any idea why? The first problem probably happens because you simply replaced the line of code with your weapon's attack with my code, without adjusting frame durations. Say that the original line of code was:ABCD E 5 A_CMaceAttackThe number "5" (or any other number which you had there) determines frame duration in tics. If you simply replaced it with:ABCD EEEEE 0 A_CMaceAttackThe duration of "5" is no longer there, which means that the overall weapon's attack duration will be that much shorter. To keep the frames unchanged in regards of durations, you should have done it like this:ABCD EEEEE 0 A_CMaceAttack ABCD E 5 The second problem is probably caused by a SNDINFO-defined limit of identical sounds that can be played at once. You can include custom SNDINFO into your wad with this limit increased for the particular sound that your weapon makes. 0 Share this post Link to post
rabidrage Posted October 21, 2015 You're right! I wanted to multiply the damage by 10 just like Berserk does for the fist, which means that by this method it would technically play the sound 10x per hit. Just to be safe, I upped the limit to 30 with this entry in SNDINFO: $limit FighterHammerHitWall 30 So the Mace is now a hugely powerful weapon when paired with Berserk, but players are gonna need it. 0 Share this post Link to post