Summon Monster Via Item Pickup

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze 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.
User avatar
Misery
Posts: 157
Joined: Sun Nov 04, 2018 4:57 pm

Summon Monster Via Item Pickup

Post by Misery »

How do you remove +FRIENDLY flag from monsters summoned via A_SpawnItemEx, and is it possible to script a short delay before they're summoned?

Code: Select all

Class FakeRedKey : CustomInventory

{

	Default
	{
		//$Category Original
		//$Title Fake Red Key
		//$Sprite RSKU
		Inventory.Icon "STKEYS5";
		Inventory.PickupSound "misc/k_pkup";
		Inventory.PickupMessage "Yes, the Red Key!";
	}

	States
	{
		Spawn:
			RSKU A 10;
			RSKU B 10 Bright;
			Loop;
		Pickup:
			TNT1 A 70;
			TNT1 A 0 A_SpawnItemEx ("Archvile", -64, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION);
			Stop;
	}
}
User avatar
difficultoldstuff
Posts: 35
Joined: Fri Jul 17, 2020 5:38 am
Operating System Version (Optional): Windows 7
Graphics Processor: nVidia with Vulkan support

Re: Summon Monster Via Item Pickup

Post by difficultoldstuff »

Try this, might help:

Code: Select all

TNT1 A 0
{
    Actor act = A_SpawnItemEx("Archvile", -64, flags: SXF_NOCHECKPOSITION); // YUP, OPTIONAL ARGUMENTS ARE OPTIONAL
    if (act)
    {
        act.bFriendly = false;
        act.SetState(act.FindState("Waiting")); // SET ITS STATE TO THE DELAYED ONE
    }
} // NO ; HERE!
You'd need to add the Waiting state yourself for that monster in this case. Other way around is to initially spawn a "spawner" object, that will have the delay and proper monster setup in its own logic. Also, don't wanna be an ass, but this is mostly a Scripting issue, not Assets! ;)

Love, good luck!

Return to “Assets (and other stuff)”