Changing dropitem without making a new monster
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!)
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!)
Changing dropitem without making a new monster
Let's say I have a shotgun replacement that isn't a shotgun at all, like an ability or something.
However I don't want zombie shotgunners to drop that ability, but instead drop their shotguns.
I also don't want to create a new monster to replace them, as that would break compatibility with monster changing mods.
How exactly could I do it and is it even possible in Decorate or ACS?
Thanks in advance.
However I don't want zombie shotgunners to drop that ability, but instead drop their shotguns.
I also don't want to create a new monster to replace them, as that would break compatibility with monster changing mods.
How exactly could I do it and is it even possible in Decorate or ACS?
Thanks in advance.
- m8f
-
- Posts: 1464
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Location: Siberia (UTC+7)
- Contact:
Re: Changing dropitem without making a new monster
A very simple solution comes to mind, but it's not Decorate or ACS.
- Dan_The_Noob
- Posts: 880
- Joined: Tue May 07, 2019 12:24 pm
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Changing dropitem without making a new monster
can you be more specific about what you are trying to achieve overall?
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: Changing dropitem without making a new monster
I must credit Ed the Bat for this trick, but I did something like this with ww-mixed3; Chaingunners drop a weapon that differs from the weapon that appears on Chaingun spawns, but the Chaingunners themselves are not replaced at all.
Firstly, neither your new ability nor the shotgun will have the "replaces" tag on them. Replace the weapon instead with an actor like this one:
The important part is that this actor, on spawn, checks itself for the +TOSSED flag, which means it is checking whether it has been placed in the map, or if it's been dropped by an enemy. In this case, if TOSSED is true, jump to the other state and drop the shotgun. If it is false, it falls through and drops the ability instead.
Firstly, neither your new ability nor the shotgun will have the "replaces" tag on them. Replace the weapon instead with an actor like this one:
Code: Select all
ACTOR SMGSpawner : CustomInventory replaces Chaingun
{
States
{
Spawn:
TNT1 A 0 NoDelay A_CheckFlag("TOSSED", "DropSMG")
TNT1 A 0 A_DropItem("PPSH41")
Stop
DropSMG:
TNT1 A 0 A_DropItem("OuchSMG")
Stop
}
}
Re: Changing dropitem without making a new monster
Thank you WildWeasel!
I was planning on using a custominventory anyways as I wanted the ability to be only picked up once and then the regular shotgun would be spawned.
And I was also hoping for a way to check if the actor was somehow dropped by an enemy, as I knew that those have different properties than regularly spawned actors.
But I had no idea if that was even possible, so thank you for the great help!
I was planning on using a custominventory anyways as I wanted the ability to be only picked up once and then the regular shotgun would be spawned.

And I was also hoping for a way to check if the actor was somehow dropped by an enemy, as I knew that those have different properties than regularly spawned actors.
But I had no idea if that was even possible, so thank you for the great help!
Re: Changing dropitem without making a new monster
It is possible to make this system in Zscript ?
I've tried to do this but i got a script warning :
Accessing deprecated function A_CheckFlag - deprecated since 2.3.0
I've tried to do this but i got a script warning :
Accessing deprecated function A_CheckFlag - deprecated since 2.3.0
- SanyaWaffles
- Posts: 868
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: Changing dropitem without making a new monster
you'd use within an anonymous function instead.
Code: Select all
bTOSSED == true
Re: Changing dropitem without making a new monster
I'm sorry but I need an exemple, I'm feeling stuck.SanyaWaffles wrote:you'd usewithin an anonymous function instead.Code: Select all
bTOSSED == true
- SanyaWaffles
- Posts: 868
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: Changing dropitem without making a new monster
Using the example posted, this is how you'd do it in ZScript.
Code: Select all
class SMGSpawner : CustomInventory replaces Chaingun
{
States
{
Spawn:
TNT1 A 0 NoDelay
{
// all pre-existing flags are prefixed with b
// and are boolean values
// you use return ResolveState(state) for jumps
if (invoker.bTOSSED)
return ResolveState("DropSMG");
// to not perform a jump, simply pass null
return ResolveState(null);
}
TNT1 A 0 A_DropItem("PPSH41");
Stop;
DropSMG:
TNT1 A 0 A_DropItem("OuchSMG");
Stop;
}
}
Last edited by SanyaWaffles on Mon Dec 16, 2019 9:57 pm, edited 1 time in total.
Re: Changing dropitem without making a new monster
I tried with your exemple, but I got a script error :
Self pointer used in ambiguous context; VM execution may abort!
Self pointer used in ambiguous context; VM execution may abort!
- SanyaWaffles
- Posts: 868
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
- Contact:
Re: Changing dropitem without making a new monster
try using invoker.bTossed instead. I updated the code. It was late at night when I wrote it, apologies.
Re: Changing dropitem without making a new monster
I deeply apologize for the long bump, but there's been something that's been plaguing my mind, but I didn't know if I should post about it or not.
Some time ago I've sent a test build to my friend who, because of hardware limitations, had to use an older version of GZDoom.
And they told me about a worrying message spam in the console. The message being:
UNKNOWN FLAG 'TOSSED' in 'ACTOR'
I've tested it with the newest LZDoom version (3.84) and the issue is also there.
I wanted to ask if there is a way to fix it without creating an LZDoom-specific version with those checks removed.
I'll provide a working example in case it should work, but I just did something wrong. Use with LZDoom or pre-4.x GZDoom.
EDIT: As it turns out, checking for "TOSSED" flag wasn't needed to begin with.
CustomInventories have a state designed for just what I've been looking for.
The Drop state. It's entered if a CustomInventory actor is dropped by a monster.
Some time ago I've sent a test build to my friend who, because of hardware limitations, had to use an older version of GZDoom.
And they told me about a worrying message spam in the console. The message being:
UNKNOWN FLAG 'TOSSED' in 'ACTOR'
I've tested it with the newest LZDoom version (3.84) and the issue is also there.
I wanted to ask if there is a way to fix it without creating an LZDoom-specific version with those checks removed.
I'll provide a working example in case it should work, but I just did something wrong. Use with LZDoom or pre-4.x GZDoom.
EDIT: As it turns out, checking for "TOSSED" flag wasn't needed to begin with.
CustomInventories have a state designed for just what I've been looking for.
The Drop state. It's entered if a CustomInventory actor is dropped by a monster.
- Attachments
-
test.wad
- (397 Bytes) Downloaded 29 times