Used

virtual bool Used (Actor user)

Usage

Used to execute some code upon interacting with an actor by using it. It is called when the player presses use against the actor, provided it does not have the USESPECIAL flag set and the action special assigned to it is not UsePuzzleItem. Although, if the actor satisfies one or both of these conditions, but its action special activation process fails, the function gets a chance to be called still.

Parameters

  • user: a pointer to the using actor.

Return value

The return value is a boolean that signifies the success or failure of the use action, with true being success and false being failure.

Examples

This odd barrel explodes immediately when the player uses it while possessing the BFG.

class OddBarrel : ExplosiveBarrel
{
    override bool Used (Actor user)
    {
        if (user && user.CountInv("BFG9000"))
        {
            A_Die();
            return true;
        }

        return false;
    }
}

See also

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.