Replacing berserk fist with another melee weapon ....?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Replacing berserk fist with another melee weapon ....?

Post by ReX »

I have been looking through the ZDooM Wiki and these forums for information that will help me with the following:
  • 1. I want to replace the fist with a melee weapon (such as a lead pipe, wrench, or crowbar).
    2. I want the new weapon to have the same power as a berserk fist.
I have read this thread in the DooM Armory forum but want to streamline the definition. I will only be using four animation frames - the equivalent of PUNGA0, PUNGB0, PUNGC0, PUNGD0 (I will change the sprite names, of course). Simply replacing the berserk pickup with my replacement weapon will not do, as I don't want the screen turning to the red color (i.e., Powerup.Color 255,0,0,0.5).

Please tell me if the following is the way to proceed:
  • 1. I will need to create a new powerup type [e.g., PowerStrength, but minus the Powerup.Color].
    2. I will need to create the CustomInventory for the new weapon [e.g., Berserk with the modified PowerStrength minus the HealThing (100, 0)].
    3. Create a Weapon definition for the new weapon that works like the fist.
Is there a simpler way? Furthermore, where does PowerupGiver figure in all this, and will I need to create a new definition under that?

Many thanks.
User avatar
Cutmanmike
Posts: 11335
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by Cutmanmike »

You won't need to give him a beserk powerup I don't think, unless you want to powerup any other melee weapons when he picks it up. You can define the strength of the melee attack in the actual weapon when you define it.

I have no idea what the power of the berserk fist is though but I'm sure someone will confirm it for you.
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Replacing berserk fist with another melee weapon ....?

Post by Spleen »

If I understand correctly, the regular fist randomly does 2-20 damage and the berserk fist does 20-200.
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Replacing berserk fist with another melee weapon ....?

Post by Grimm »

I assume you mean you want it to get powered up like the fist when you get berserk? If so, no problem chief:

Code: Select all

ACTOR RexPowerStrength : Powerup native
{
  Powerup.Duration 1
  Powerup.Color 0,0,0,0
  +INVENTORY.HUBPOWER
}
ACTOR ReXBerserk : Berserk 
{
  Inventory.PickupMessage "whatever you want!" 
  States
  {
  Spawn:
    PSTR A -1
    Stop
  Pickup:
    TNT1 A 0 A_GiveInventory("RexPowerStrength")
    TNT1 A 0 A_SelectWeapon("Crowbar") //if you want it to switch to the crowbar.
    Stop
  }
}
actor Crowbar : Fist
{
  +WEAPON.WIMPY_WEAPON //remove if you wish
  +WEAPON.MELEEWEAPON
  Obituary "whatever" 
  States
  {
  Ready:
    PUNG A 1 A_WeaponReady
    loop
  Deselect:
    PUNG A 1 A_Lower
    loop
  Select: 
    PUNG A 1 A_Raise
    loop
  Fire:
    PUNG B 4
    PUNG C 0 A_JumpIfInventory("ReXPowerStrength","PowerFire")
    PUNG C 4 A_CustomPunch(2) //let's assume you want it to do normal punch damage at first
    PUNG D 5
    goto Ready
    PUNG C 4 A_CustomPunch(20) //pwn mode.
    PUNG D 5
    goto Ready
  }
}
Now if you just meant you want the weapon to do the same damage as the berserk fist ALL the time, all you need to do is change the fire frames to reflect the A_CustomPunch(20).
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by ReX »

Heh, heh. Thanks, Grimm. That's terrific, and I'm off to give it a try.

And yes, I do want the weapon to do the same damage as the berserk fist ALL the time. I will check out A_CustomPunch(20).
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by ReX »

Well, I tried out the definition, but GZDooM gave me a fatal error with the following message:

Script error, testwad1.wad:DECORATE " line 4:
Unknown native class 'RexPowerStrength'

I'm stumped, because even before Grimm posted his definition I figured I'd need to create a new powerup type. Does it have anything to do with having to create a definition under PowerupGiver?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Replacing berserk fist with another melee weapon ....?

Post by Graf Zahl »

Grimm made one mistake: You do not want to give a new powerup. Just give "PowerStrength" instead of "RexPowerStrength" and it should work.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by ReX »

Graf Zahl wrote:Just give "PowerStrength" instead of "RexPowerStrength" and it should work.
But what about the red screen color associated with PowerStrength? If I want to remove that won't I need to create a new powerup?
  • 1. Anyway, in Grimm's definition I renamed RexPowerStrength to PowerStrength, and predictably GZDooM gave a fatal error: "Redefinition of internal power class 'PowerStrength'.
    2. I commented out the PowerStrength definition, and next GZDooM gave a fatal error: Unexpected token string constant "PowerFire".
    3. I deleted Powerfire, and GZDooM gave a fatal error: Expected ',' , got ')' (so obviously I can't simply delete PowerFire; I need to have another constant in there, but I don't know what).
Bottom line: I can't get this to work right now.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by Enjay »

How about a different approach and forget the powerup altogether.

Code: Select all

actor Test1 : CustomInventory
{
  inventory.pickupmessage "Picked up a Crowbar"
  inventory.pickupsound "misc/w_pkup"
  states
  {
  Spawn:
    PSTR A -1
    stop
  Pickup:
    TNT1 A 0 A_GiveInventory ("Health", 100)
    TNT1 A 0 A_GiveInventory ("Crowbar")
    TNT1 A 0 A_SelectWeapon("Crowbar") 
    stop
  }
}



actor Crowbar : Fist
{
  +WEAPON.WIMPY_WEAPON //remove if you wish
  +WEAPON.MELEEWEAPON
  Obituary "whatever" 
  States
  {
  Ready:
    PUNG A 1 A_WeaponReady
    loop
  Deselect:
    PUNG A 1 A_Lower
    loop
  Select: 
    PUNG A 1 A_Raise
    loop
  Fire:
    PUNG B 4
    PUNG C 4 A_CustomPunch(20)
    PUNG D 5
    goto Ready
    }
}
That gives a new weapon (Crowbar) and 100% health.

It does behave differently to the Berserk in as much as the crowbar is a separate weapon so you could toggle between the crowbar and the fist and the crowbar would not be cancelled when you move on to another level. Personally, I'd see both of those as an advantage unless it's not what you want. If, of course, you wanted to make the player not have the fist from this point on, you could remove the fist weapon when the player picks up Test1. Anyway, it certainly gives you 100% health without the red haze and a weapon as powerful as the berserk punch. ;)
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by ReX »

Nigel, after messing around a bit I managed to get pretty much everything I want from your modified definition above. Here is what I have:

Code: Select all

//Based on definition created by Nigel 'Enjay' Rowand based on a definition by Grimm
//ZDooM forums: http://forum.zdoom.org/viewtopic.php?f=3&t=20410&p=399923

actor Crowbar1 : CustomInventory 30001
{
  SpawnID 255
  inventory.pickupmessage "Picked up a Crowbar"
  inventory.pickupsound "misc/w_pkup"
  states
  {
  Spawn:
    PSTR A -1
    stop
  Pickup:
    TNT1 A 0 A_GiveInventory ("Crowbar")
    TNT1 A 0 A_SelectWeapon("Crowbar") 
    stop
  }
}

actor Crowbar : Fist
{
  +WEAPON.MELEEWEAPON
  Obituary "%k shoved %o's crowbar where the sun don't shine." 
  States
  {
  Ready:
    BARG A 1 A_WeaponReady
    loop
  Deselect:
    BARG A 1 A_Lower
    loop
  Select: 
    BARG A 1 A_Raise
    loop
  Fire:
    BARG B 4
    BARG C 4 A_CustomPunch(20)
    BARG D 5
    goto Ready
    }
}
I am still having a couple of problems:
  • 1. Even though I have a sprite for the crowbar (named CBARA0), and have placed a thing (type 30001) in the map, the crowbar does not show up. Curiously, it's the berserk pack that shows up (which, after I pick up, properly brings up the HUD display with the crowbar). I have looked through the wiki, but I see nothing that allows me to assign the sprite to the particular item. In other words, how does the game know that CBARA0 is the crowbar as defined in DECORATE?
    2. I notice that a weapon position is not indicated. What this does is that if I switch from the crowbar to some other weapon, then want to switch back to the crowbar, I can't.
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Replacing berserk fist with another melee weapon ....?

Post by Grimm »

Well, normally, you define spawn frames in a weapon definition, which is what you pickup on the map. Since you're basically cutting the Berserk pack out of this entirely, you can just add spawn frames to the definition and have the player pick it up like usual. You can just add this to the existing crowbar definition:

Code: Select all

   Spawn:  
      BARG A -1
      LOOP
As for the weapon switching, you have to change that in KEYCONF, which is a wonderfully versatile little lump imo. Add in an entry titled KEYCONF and add this in:

Code: Select all

weaponsection ReXsWeapons
setslot 1 Crowbar
If you want the fists to be around too, add this:

Code: Select all

weaponsection ReXsWeapons
setslot 1 Fist
addslotdefault 1 Crowbar
That should be aces sir.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by Enjay »

Yes, as Grimm says, you have now changed the pickup part of the weapon to be nothing more than something that gives you a weapon. It no longer gives you any health, nor does it have any other associated Berserk capabilities. So the best option would be to remove the pickup actor totally and just give the weapon itself a spawn state. The spawn state is what is used for a weapon's pickup - as Grimm said.
Grimm wrote:If you want the fists to be around too, add this:

Code: Select all

weaponsection ReXsWeapons
setslot 1 Fist
addslotdefault 1 Crowbar
Interesting. I have usually just replaced the entire slot when adding multiple weapons to a slot. eg here is my Burghead weapon section:

Code: Select all

weaponsection "BGPA"

setslot 1 NJFist NJElectroBlade NJDaystick NJBoot
setslot 2 NJStracherShotgun NJStracherPistol 
setslot 3 NJPlasmaGun NJRapidChargeGun
setslot 4 NJThompson NJShotgun
setslot 5 NJLauncher2 NJLauncher1 NJRocketLauncher 
setslot 6 NJManstopper NJRailGun
setslot 7 NJPlasmaPistol
setslot 8 NJHyperBall2 NJHyperBall1 //NJWraithVerge NJFreezeGun
Is there any advantage to either method?

@ReX, something worth pointing out, the setslot command effectively removes everything that was allocated to that slot so if you use it, you have to make sure you put any weapons that you want to appear in that slot in your definition, even if they are the default Doom ones.

eg setslot 3 Fist

would allocated the fist to button 3 but also remove the shotgun and supershotgun from the slot.

setslot 3 Fist Shotgun SuperShotgun

Would put the fist, shotgun and supershotgun onto slot 3 and, when pressing button 3, they would be selected in the order SSG, SG, Fist.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by ReX »

Grimm & Enjay, thank you both for your help. I've gotten the whole shebang to work just like I wanted.

I have another minor, and unrelated, question: The HUD sprites were (probably) originally intended for a 320 * 240 monitor screen, or at least those relative proportions. I am playing the game on a wide-screen monitor, and the attack sequence shows the players arm being unnaturally cut off near the left side of the screen. Take a look at the screenshot.

Does this mean that I need to either:
  • 1. Offset the attack sprite frames to accommodate wide screens? And wouldn't that then mean the striking end of the weapon will be hitting the target left of the player's center, instead of right in the center?
    2. Redraw the sprites to make them extend further to the left to accommodate wide screens?
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Replacing berserk fist with another melee weapon ....?

Post by Grimm »

That's looking pretty good ReX. I would just extend the sprite, which would ensure maximum compatibility and keep it striking the center. It shouldn't be *too* much work. I'd offer to do it myself, if I wasn't so darn busy with my own mod. And you're quite welcome, by the way!
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing berserk fist with another melee weapon ....?

Post by Enjay »

Yeah, that's what I've done recently with some of my weapons (perhaps my Burghead mod had widened weapons, I don't remember). I just used my 1337 graphics skills (not) to tack a bit of arm/weapon/whatever on to the side of any sprite that appeared chopped off like your ones does. It's not too hard to do to get something reasonable looking and even a shoddy job looks better than a cut off sprite.
Locked

Return to “Editing (Archive)”