Berserk Fist Auto-Switch

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.
Locked
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Berserk Fist Auto-Switch

Post by Grimm »

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.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Berserk Fist Auto-Switch

Post by Enjay »

Grimm wrote:(But only the first time per level, as per the original.)
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.
User avatar
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

Post by Zhs2 »

Grimm wrote:Is there any way to get ZDoom to automatically switch to the new fists when the player picks up the berserk pack?
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.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: Berserk Fist Auto-Switch

Post by Ceeb »

I'll post a few examples from my mod. :)

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
	}
}
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).

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
If you have PowerStrength, this jumps to a much more powerful attack than the standard punch of this weapon.
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Berserk Fist Auto-Switch

Post by Grimm »

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.
User avatar
Renegade
Posts: 83
Joined: Mon Dec 31, 2007 6:39 pm
Location: Alberta, Canada
Contact:

Re: Berserk Fist Auto-Switch

Post by Renegade »

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.
User avatar
Medricel
Posts: 1138
Joined: Sat Nov 20, 2004 9:47 am

Re: Berserk Fist Auto-Switch

Post by Medricel »

Renegade wrote:let it wear off
The berserk pack doesn't wear off. It lasts until the end of the level (or until PowerStrength is forcibly taken via scripts)
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Berserk Fist Auto-Switch

Post by Grimm »

In Vanilla Doom you tested it?
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Re: Berserk Fist Auto-Switch

Post by skadoomer »

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)
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.
Grimm wrote:In Vanilla Doom you tested it?
Does it make a difference? Are you trying to emulate behavior?
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: Berserk Fist Auto-Switch

Post by Ceeb »

If you don't want to switch...

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
   }
}
Doy! :roll:
User avatar
Renegade
Posts: 83
Joined: Mon Dec 31, 2007 6:39 pm
Location: Alberta, Canada
Contact:

Re: Berserk Fist Auto-Switch

Post by Renegade »

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

Return to “Editing (Archive)”