Breaking poison damage?

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
Ravick
Posts: 2051
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Breaking poison damage?

Post by Ravick »

Hi there.

Is it possible to create an inventory item that stops player from taking poison damage?
I mean, player got hit by a Poison Cloud or so, and is taking damage from it seconds later, then he uses an item from his inventory, and then the hurting stops. Is it possible? How could it be done?
It could be in DECORATE, ACS or Zscript.

Thaks in advanced. :)
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Breaking poison damage?

Post by Blue Shadow »

This should work, and requires ZScript:

Code: Select all

class Antidote : CustomInventory
{
    States
    {
    Spawn:
        PTN1 ABC 3;
        Loop;

    Pickup:
        TNT1 A 0
        {
            if (player && player.poisoncount)
            {
                player.poisoncount = 0;
                return true;
            }

            return false;
        }
        Stop;
    }
} 
User avatar
Ravick
Posts: 2051
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Re: Breaking poison damage?

Post by Ravick »

Thanks!! :D

___

edit: I'm still a n00b in ZScript... so, I apologize if the question is dumb: This function checks if player has any poisoncount, and, if so, sets it to zero? :?:
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Breaking poison damage?

Post by Blue Shadow »

Yes. poisoncount is the duration of the poison. It ticks down to zero where upon the player is healed from the poison.

What the item does is check if the player is poisoned, and if so, it's picked up and the player is healed from the poison. If the player is not poisoned, it cannot be picked up.
User avatar
Ravick
Posts: 2051
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Re: Breaking poison damage?

Post by Ravick »

Thank you. :)

I guess it'd work in the Use state as well (?)
I'll test myself n' play around with Zscript. :D
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Breaking poison damage?

Post by Blue Shadow »

Yes.
Post Reply

Return to “Scripting”