Is it possible to support DeathMatch with randomized items?

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
GrayFace
Posts: 40
Joined: Mon Feb 13, 2023 1:34 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 7 x64
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Is it possible to support DeathMatch with randomized items?

Post by GrayFace »

I have random spawners for weapons and items that can be illustrated like this:

Code: Select all

ACTOR PistolWeaponSpawner replaces Pistol
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(CallACS("IsOption2")==1, "Option2")
	Option1:
		TNT1 A 0 A_SpawnItemEx("FirstPistolOption",0,0,0,0,0,0,0,SXF_TRANSFERSPECIAL | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID, 0, tid)
		stop
		
	Option2:
		TNT1 A 0 A_SpawnItemEx("SecondPistolOption",0,0,0,0,0,0,0,SXF_TRANSFERSPECIAL | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION | SXF_CLEARCALLERTID, 0, tid)
		stop
	}
}
RandomSpawner can't be used, because spawner has to check conditions.
When I start a DM, weapons and items spawned in this way behave like in single player - they don't respawn and upon pickup weapons disappear.
Is these a way to fix this? Ideally without ZScript for Zandronum support.
Heisanevilgenius
Posts: 93
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Is it possible to support DeathMatch with randomized items?

Post by Heisanevilgenius »

That's because when an item is spawned with A_SpawnItemEx, they behave like normal items and don't stay like deathmatch weapons.

I suppose one way to fix it is if you place all the different random item options in the same spot on the map, and use a script to remove all but one.

Ie, have one pistol option with TID 100, and another pistol option with TID 101 placed in the exact same place. ACS randomly picks which one to use and then does Thing_Remove to remove the one you don't want.
GrayFace
Posts: 40
Joined: Mon Feb 13, 2023 1:34 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 7 x64
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Is it possible to support DeathMatch with randomized items?

Post by GrayFace »

Heisanevilgenius wrote: Thu Jan 30, 2025 11:21 pm Ie, have one pistol option with TID 100, and another pistol option with TID 101 placed in the exact same place. ACS randomly picks which one to use and then does Thing_Remove to remove the one you don't want.
Won't fit my case. They're placed by the author of whatever WAD is being played with the mod, not by me.
GrayFace
Posts: 40
Joined: Mon Feb 13, 2023 1:34 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 7 x64
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Is it possible to support DeathMatch with randomized items?

Post by GrayFace »

I've figured it out! It's controlled by the DROPPED flag. I just need to transfer it to whatever has been spawned. I'd also take care of other flags that can be set from map editor, but not transferred by A_SpawnItemEx like DORMANT, FRIENDLY and INVISIBLE.
I wonder what flag "Translucent (25%)" from map editor translates to, also "Standing Still" in SLADE's one.
Post Reply

Return to “Scripting”