All Pickups to Inventory Mod?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
LucidMage
Posts: 4
Joined: Thu Nov 04, 2021 1:30 am
Location: New Zealand

All Pickups to Inventory Mod?

Post by LucidMage »

Is there a mod where all items (health, ammo, powerups, etc) are universally treated as inventory items when picked up? Part of me wants to play Doom like a collectathon or scavenger hunt.

If not, would anyone have an idea of how to go about scripting this? Maybe something with Event Handlers but I have no clue where to begin here. Replacing all items would do the job, though it would be nice to know about a less tedious method.

The closest mod I could find is this Use To Pickup mod, however this only prevents automatic pickups. A nice mod but not the behaviour I'm looking for.
User avatar
Caligari87
User Accounts Assistant
Posts: 5994
Joined: Thu Feb 26, 2004 3:02 pm
Discord: Caligari87#3089
Github ID: caligari87
Preferred Pronouns: He/Him

Re: All Pickups to Inventory Mod?

Post by Caligari87 »

My gut instinct says that you'll probably need to replace items in order to rewrite their activation conditions. However, something I would try first is an event handler that (un)sets the proper inventory flags for any spawned object.

Code: Select all

class ModifyPickups : EventHandler {
	override void WorldThingSpawned(worldevent e) {
		if (!e.thing) { return; } //nullcheck for the paranoid
		if (e.thing is "Health") { //Check if a health item spawned
			Inventory item = Inventory(e.thing); //Cast a pointer to the thing
			item.bAutoActivate = false; //Don't automatically use up the item
			item.binvbar = true; //Show item on inventory bar
		}
	}
}
Make sure to register the handler in MAPINFO of course. This may not work out-of-the-box but should at least show proof of concept. Obviously could be expanded to other things besides health objects but I figure that should be good enough for testing.

8-)
User avatar
LucidMage
Posts: 4
Joined: Thu Nov 04, 2021 1:30 am
Location: New Zealand

Re: All Pickups to Inventory Mod?

Post by LucidMage »

Looks like replacement classes are the way to go. Testing your code showed no change in behaviour, though I found other properties like ALWAYSPICKUP work as intended.

Aw well, worth a shot. Thanks for the suggestion.

Return to “General”