[SOLVED] Something weird with custom Berserk

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Jekyll Grim Payne
 
 
Posts: 1076
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

[SOLVED] Something weird with custom Berserk

Post by Jekyll Grim Payne »

Could somebody please explain what I'm doing wrong?
This is a custom Berserk I'm using with a bunch of effects.

Code: Select all

Class BD_Berserk : Berserk replaces Berserk
{
Default {
inventory.pickupsound "pickups/berserk";
	}
	
States
	{
	Pickup:
		TNT1 A 0 {
			if (bdoom_weapons == 2) { //this determines which weapon set is active; obviously I'm using bdoom_weapons 2 for this
				A_GiveInventory("Modernberserk_Strength");
				A_GiveInventory("Modernberserk_Regen");
				A_GiveInventory("Modernberserk_Speed");
				A_GiveInventory("Modernberserk_Protection");
				}
			else 
				A_GiveInventory("PowerStrength");
			HealThing(100, 0);
			A_SelectWeapon("BD_Fist");
			}
		stop;
	}
}

Class Modernberserk_Strength : PowerStrength
{
Default {
	powerup.duration -40;
	powerup.color "RedMap";
	}
}

Class ModernBerserk_Regen : PowerRegeneration
{
Default {
	powerup.duration -40;
	powerup.strength 5;
	powerup.color "none";
	}
}

Class ModernBerserk_Speed : PowerSpeed
{
Default {
	powerup.duration -40;
	speed 1.3;
	powerup.color "none";
	}
}

Class ModernBerserk_Protection : PowerProtection
{
Default {
	+NOPAIN;
	powerup.duration -40;
	Damagefactor 0.5;
	powerup.color "none";
	}
}
In the Fist attack state I have

Code: Select all

           if (countinv("Modernberserk_Strength") > 0)
                return ResolveState("BerserkLP1");
and BerserkLP1 is a more powerful attack state.

The weirdness: after 40 seconds the screen starts blinking, but when the blinking ends, RedMap palette remains active, although somehow it becomes brighter. The jump in the Fire state

Code: Select all

still
happens even though ModernBerserk_Strength shouldn't even be in my inventory anymore. However all the other effects (speed, protection, regeneration) no longer apply.

Could anyone point it what I'm missing?
Last edited by Jekyll Grim Payne on Mon Oct 22, 2018 6:00 am, edited 1 time in total.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Something weird with custom Berserk

Post by Marisa the Magician »

PowerStrength is apparently hardcoded to have infinite duration (look in gzdoom.pk3/zscript/inventory/powerups.txt, line 462 and down. The duration is completely ignored.
User avatar
Jekyll Grim Payne
 
 
Posts: 1076
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Something weird with custom Berserk

Post by Jekyll Grim Payne »

Yeah, and I also realized I don't even need it anyway since I define a different attack state manually. Thanks!
Post Reply

Return to “Scripting”