GetReplacee

From ZDoom Wiki
Jump to navigation Jump to search


Actor

native static class<Actor> GetReplacee (class<Actor> cls)
native clearscope static class<Actor> GetReplacee (class<Actor> cls) (New from 4.11.1)

Usage

Gets the actor class which the specified actor class is replacing. The class the function gets is the last class in the replacement chain, not the direct replacement. For instance, if cls is replacing DoomImp, and DoomImp itself is replacing ZombieMan, then it is ZombieMan which serves as the replacee, and thus what the function gets.

Parameters

  • cls: the actor class to get its replacee.

Return value

The actor class which the specified actor class is replacing, as a class pointer. If the specified class has no replacee, it itself is returned.

Examples

On pickup, this item gives the player a security armor and whatever item the Soulsphere2 is replacing, which in this case the original soulsphere.

class SomeItem : CustomInventory
{
    States
    {
    Spawn:
        SOUL ABCD 6 Bright;
        Loop;

    Pickup:
        TNT1 A 0
        {
            class<Actor> rep = GetReplacee("Soulsphere2");
            A_GiveInventory((class<Inventory>)(rep));
            A_GiveInventory("GreenArmor");
        }
        Stop;
    }
}

class Soulsphere2 : Soulsphere replaces Soulsphere
{
    Default
    {
        Inventory.Amount 75;
    }
}

See also