All Pickups to Inventory Mod?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

All Pickups to Inventory Mod?

Postby LucidMage » Mon Dec 27, 2021 2:01 am

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
LucidMage
 
Joined: 04 Nov 2021
Location: New Zealand

Re: All Pickups to Inventory Mod?

Postby Caligari87 » Mon Dec 27, 2021 9:52 am

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 allExpand view
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
Caligari87
User Accounts Assistant
 
Joined: 26 Feb 2004
Discord: Caligari87#3089
Github ID: caligari87

Re: All Pickups to Inventory Mod?

Postby LucidMage » Tue Dec 28, 2021 6:11 pm

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.
User avatar
LucidMage
 
Joined: 04 Nov 2021
Location: New Zealand


Return to General

Who is online

Users browsing this forum: TommyGalano5 and 5 guests