Page 1 of 1

[ZS] Monster drops ammo instead of weapon until certain map?

Posted: Wed Jun 15, 2022 1:42 pm
by Guest
How would I make the Shotgun and Chaingun guys drop their respective weapons only after a certain map is reached in my wad? For example I have a lot of Shotgun Guys in maps 01 and 02 but I have secret areas with Shotguns in them, how would I prevent players from just getting the SG off the killed enemies in these maps, but from map03 onward, they drop SGs like normal? I want to keep the replacement monster the same actor and not have to make an inherited clone that only drops ammo.

Re: [ZS] Monster drops ammo instead of weapon until certain

Posted: Wed Jun 15, 2022 11:52 pm
by Blue Shadow
Something like this, I suppose:

Code: Select all

class ShotgunGuy2 : ShotgunGuy replaces ShotgunGuy
{
    void SGGuy_NoBlocking ()
    {
        // On maps 1 and 2, drop shells, otherwise drop the default item.
        if (Level.levelnum < 3)
        {
            A_NoBlocking(false);
            A_DropItem("Shell");
        }
        else
        {
            A_NoBlocking();
        }
    }

    States
    {
    Death:
        SPOS H 5;
        SPOS I 5 A_Scream;
        SPOS J 5 SGGuy_NoBlocking;
        SPOS K 5;
        SPOS L -1;
        Stop;
    XDeath:
        SPOS M 5;
        SPOS N 5 A_XScream;
        SPOS O 5 SGGuy_NoBlocking;
        SPOS PQRST 5;
        SPOS U -1;
        Stop;
    }
}
If you're confused by A_NoBlocking, read [wiki=A_NoBlocking]its documentation[/wiki].

Re: [ZS] Monster drops ammo instead of weapon until certain

Posted: Thu Jun 16, 2022 2:28 am
by Cherno
Ebenezer Fottingnotch wrote:I want to keep the replacement monster the same actor and not have to make an inherited clone that only drops ammo.
However, I don't see another solution.

Re: [ZS] Monster drops ammo instead of weapon until certain

Posted: Thu Jun 16, 2022 10:08 am
by Apeirogon
Its possible with event handlers WorldThingSpawned/CheckReplacement virtuals, but it will make map compatible with gzdoom only.

Re: [ZS] Monster drops ammo instead of weapon until certain

Posted: Thu Jun 16, 2022 12:03 pm
by Guest
[quote="Blue Shadow"]Something like this, I suppose:

[snip]

[/quote]

That's workable enough, thanks. Wasn't quite sure how to declare the levelnum thing in ZScript until now.