Berserk tint

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
YeeTee2
Posts: 29
Joined: Sun Feb 07, 2021 1:36 pm

Berserk tint

Post by YeeTee2 »

I arise with a new question: How do I remove the tint in berserk?
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Berserk tint

Post by Player701 »

If you can use ZScript, this is probably the simplest way:

Code: Select all

class MyBerserk : Berserk replaces Berserk
{
    const EFFECT_TICS_THRESHOLD = 128 << 3; // see gzdoom.pk3, PowerStrength::GetBlend

    override bool TryPickup (in out Actor toucher)
    {
        bool result = Super.TryPickup(toucher);

        if (result)
        {
            let ps = Powerup(toucher.FindInventory('PowerStrength'));

            if (ps != null && ps.EffectTics < EFFECT_TICS_THRESHOLD)
            {
                ps.EffectTics = EFFECT_TICS_THRESHOLD;
            }
        }

        return result;
    }
}
Explanation: PowerStrength derives its blend color from its EffectTics value as long as 128 - (EffectTics >> 3) is greater than zero. Each game tick, EffectTics is incremented by 1. By setting the value of EffectTics to 128 << 3 as soon as the berserk is picked up, we can make the tint disappear immediately. Note that this doesn't affect the IDBEHOLDS cheat, but it can be rectified by moving the tint-disabling code to a separate inventory item that will monitor the player's inventory at all times, instead of only when a berserk gets picked up. You can then give the item to the player by means of Player.StartItem, an event handler, or an ACS script. You can even integrate this functionality into your player class itself if you so desire.

With DECORATE, the only way is to substitute PowerStrength with a custom inventory item and re-implement the fist weapon attack code so that it checks for your custom item and alters the damage accordingly. Then, modify the berserk pickup so that it gives the player your custom item instead of PowerStrength. Note that you will also have to create a new player class so that you can override the starting inventory and replace the vanilla fist with your own.
Post Reply

Return to “Scripting”