Berserk Fist Auto-Switch
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.
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.
Berserk Fist Auto-Switch
I replaced the fists with a new weapon (which inherits from the original), but I use A_CustomPunch, so ZDoom doesn't automatically switch to the fists when the berserk pack is picked up. Is there any way to get ZDoom to automatically switch to the new fists when the player picks up the berserk pack? (But only the first time per level, as per the original.) I feel as if this could be acomplished via ACS.
Alternately, perhaps an extension of the A_CustomPunch code would be in order, adding a bool to have Doom recognize it as the "Berserk" weapon.
And before you ask, yes, I set it up so that they do more damage when the player has PowerStrength.
Alternately, perhaps an extension of the A_CustomPunch code would be in order, adding a bool to have Doom recognize it as the "Berserk" weapon.
And before you ask, yes, I set it up so that they do more damage when the player has PowerStrength.
Re: Berserk Fist Auto-Switch
Sorry, I can't help with your question, but are you sure that's right? I just tried in Zdoom and no matter how many times I picked up a berserk pack in a single level, I always auto-switched to the fists from whatever weapon I was carrying.Grimm wrote:(But only the first time per level, as per the original.)
- Zhs2
- Posts: 1301
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
- Contact:
Re: Berserk Fist Auto-Switch
Yes. [wiki]A_SelectWeapon[/wiki]. You'll want to inherit from the Berserk class and use this Action function to automatically switch to the player's new fist. Not to mention you'll want to add some state jumps in your fist weapon to check if you have PowerStrength since the Berserk pack only strengthens Doom's fist and not custom ones.Grimm wrote:Is there any way to get ZDoom to automatically switch to the new fists when the player picks up the berserk pack?
Re: Berserk Fist Auto-Switch
I'll post a few examples from my mod. 
As you can see, this replaces the original Berserk, but I changed the SelectWeapon from "Fist" to "Unarmed" (Unarmed is what I replaced the fist with).
If you have PowerStrength, this jumps to a much more powerful attack than the standard punch of this weapon.

Code: Select all
ACTOR WormBerserk : Berserk Replaces Berserk
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("PowerStrength")
TNT1 A 0 HealThing(100, 0)
TNT1 A 0 A_SelectWeapon("Unarmed")
Stop
}
}
Code: Select all
Fire:
PUN2 A 2
PUN2 B 0 A_Refire
PUN2 C 2
PUN2 D 0 A_FireCustomMissile("KingOfFlames",0,0,0,0)
PUN2 D 0 A_JumpIfInventory("PowerStrength",1,2) <---THIS IS IMPORTANT
PUN2 D 2 A_CustomPunch(20,1,0,1)
Goto Fire + 7
PUN2 D 2 A_CustomPunch(110,1,0,1)
PUN2 C 2 A_GiveInventory("HookCharge",99)
PUN2 B 4 A_Refire
PUN2 A 0 A_TakeInventory("HookCharge",99)
Goto Ready
Re: Berserk Fist Auto-Switch
I am 99% that after you pick it up the first time, the berserk pack simply acts as a health refill and nothing more in vanilla Doom. Could be wrong, but methinks not. Either way, that's how it will work in my mod, heh.
Thanks much for the examples, as always folks.
Thanks much for the examples, as always folks.
Re: Berserk Fist Auto-Switch
FYI: I just tested that to death. And 100% of the time picking up Berserk will switch you to Fists. It doesn't matter if you've already picked it up and then let it wear off, or if you pick up a second one while the first is still active.
Re: Berserk Fist Auto-Switch
The berserk pack doesn't wear off. It lasts until the end of the level (or until PowerStrength is forcibly taken via scripts)Renegade wrote:let it wear off
Re: Berserk Fist Auto-Switch
In Vanilla Doom you tested it?
Re: Berserk Fist Auto-Switch
10 years of playing doom and I leaned that this was the case earlier this year when playing DVII. I honestly thought it was a bug for a while.Shinjanji wrote:The berserk pack doesn't wear off. It lasts until the end of the level (or until PowerStrength is forcibly taken via scripts)
Does it make a difference? Are you trying to emulate behavior?Grimm wrote:In Vanilla Doom you tested it?
Re: Berserk Fist Auto-Switch
If you don't want to switch...
Doy! 
Code: Select all
Pickup:
TNT1 A 0 A_JumpIfInventory("PowerStrength,1,"NoAutoSelect")
TNT1 A 0 A_GiveInventory("PowerStrength")
TNT1 A 0 HealThing(100, 0)
TNT1 A 0 A_SelectWeapon("Fist")
Stop
NoAutoSelect:
TNT1 A 0 A_Healthing(100,0)
Stop
}
}

Re: Berserk Fist Auto-Switch
I did not know that...Shinjanji wrote:The berserk pack doesn't wear off. It lasts until the end of the level (or until PowerStrength is forcibly taken via scripts)Renegade wrote:let it wear off
Anyway, if you let the visual effect wear off there is still no effect on the auto-switch.
No I tested in ZDoom v2.2.0In Vanilla Doom you tested it?