Loot Markers

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Loot Markers

Post by Sir Robin »

Here's a simple little informative gameplay mod I thought up while working on my Wumpus game because I was working with map markers there.

How many times does this happen to you: You see a health/armor/ammo drop but you're too full to take it so yo plan to come back for it later. Later when you need it you're thinking, "Ok, where were all those drops I skipped?" You can mark them on your map with the built-in markers, but you only get 10 of them, and they're just numbers, you have to remember which number marks which loot, and you can't clear a single one off without clearing them all.
Also: You find a locked door, you think you remember seeing the key somewhere - did you forget to pick it up? Where was that?

Here is Loot Markers. It is a mod that automatically marks loot drops on your map and clears them when you pick it up.

Tested with Doom/2, Heretic, Hexen, Chex, Strife, and a handful of add-ons. Shouldn't conflict with other mods because it's pretty simple.




Spoiler:
Items are marked when the player sees them. When an item is moved, the mark location is updated only if the player sees the item moving. The mark is removed if the player sees the spot where the item used to be and the item is not there. In this way this mod is not a cheat, it doesn't allow the player to track items that aren't seen.

All inventory items are automatically marked. If you want to mark other things, for example the exploding barrels, or evil eyes for playing Sigil, or if another mod with chests or crates or merchants or other things you want to mark, just put a comma separated list of items in the language files like so:
AddLootMarkerTo="ExplosiveBarrel,EvilEye";
EDIT: removed in favor of LOOTMARK lump
This list is case sensitive, not because of my code but because the dynamic array find() function seems to be case sensitive. So if your items aren't being marked, be sure that the case matches how the item is coded.

Download it here and check map MARKTEST to see how things are marked.

UPDATE 2022/07/15
For the modders and power users: a new lump called LOOTMARK contains a list of rules to tell which items get automatically marked or not. Details in this post.
Because of this the AddLootMarkerTo and DontAddLootMarkerTo in the LANGUAGE lump are no longer processed. All rules should be placed in the LOOTMARK lump.
For the casual users: Added ability to manually mark or unmark items from the map. Hold the mark key (default M) and put the cursor on the item you want marked or removed. Details in this post
Last edited by Sir Robin on Sun Jul 17, 2022 6:09 pm, edited 3 times in total.
User avatar
Abba Zabba
Posts: 2152
Joined: Mon Sep 05, 2011 8:50 pm
Location: a place lol!

Re: Loot Markers

Post by Abba Zabba »

This was something I always wanted in Doom, since the simple 0-9 markers are so simple and limited, in that you can't individually toggle number markers on or off with a matching numerical keybind. Thanks for this!
User avatar
TheRatCircus
Posts: 14
Joined: Mon Aug 02, 2021 1:58 am
Graphics Processor: nVidia with Vulkan support

Re: Loot Markers

Post by TheRatCircus »

I admit, this is one of those things I didn't know I needed until I got to try it. Cheers.

I have to ask, though; what I'd like to be able to do is have my own mod provide a list of classes that any user will get drawn on their map if they load both this mod and my mod. Something like a LOOTMARK lump that I can just put class names into.

I have code lying around that does something similar already, if it would be useful.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

Abba Zabba wrote:This was something I always wanted in Doom, since the simple 0-9 markers are so simple and limited, in that you can't individually toggle number markers on or off with a matching numerical keybind. Thanks for this!
Lots of times when I finish a level, I want to run back through and top-off my health, armor, ammo, etc., but can't always remember where I "left" everything. So I'll do an IDDTx2 with actors set to draw sprites, but that's a cheat because it will show me stuff I haven't officially found yet. So I wanted a non-cheat version of that and so I wrote this. Glad you like it.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

TheRatCircus wrote:I have to ask, though; what I'd like to be able to do is have my own mod provide a list of classes that any user will get drawn on their map if they load both this mod and my mod. Something like a LOOTMARK lump that I can just put class names into.
You can already do that. Just put a line like this in the LANGUAGE lump:
AddLootMarkerTo="ExplosiveBarrel,EvilEye";
In that list you can put classes, tags, or inheritance classes. So if you put "actor" in there it would show everything.

You can see that in the file I linked, there is a map called MARKTEST. Load that up, look at the objects on the conveyer belt. See there is an explosive barrel and an evil eye but they don't show up on the map. Now open the LANGUAGE lump and uncomment the line and run the map again. You'll see the barrel and eye on the map now.
User avatar
TheRatCircus
Posts: 14
Joined: Mon Aug 02, 2021 1:58 am
Graphics Processor: nVidia with Vulkan support

Re: Loot Markers

Post by TheRatCircus »

But I can only replace that string, right? I would have to put in those two classes in addition to anything I wanted to add, and then if another mod got loaded later in the file order that also replaced it, any changes I make would be overriden.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

TheRatCircus wrote:But I can only replace that string, right? I would have to put in those two classes in addition to anything I wanted to add, and then if another mod got loaded later in the file order that also replaced it, any changes I make would be overriden.
Ah, I see what you mean. I can't think of an easy way to accumulate a list instead of replace it. Even if it loaded the list from a special LOOTMARK lump, that could also be replaced by a later loading mod.
User avatar
TheRatCircus
Posts: 14
Joined: Mon Aug 02, 2021 1:58 am
Graphics Processor: nVidia with Vulkan support

Re: Loot Markers

Post by TheRatCircus »

It's simple enough to do. Here:

Code: Select all

private Array<class<Actor> > MarkerTargets;

override void OnRegister()
{
	Console.Printf("LootMarkers: Initializing...");

	int lump = -1, next = 0;

	do
	{
		lump = Wads.FindLump("LOOTMARK", next, Wads.GLOBALNAMESPACE);

		if (lump == -1)
			break;

		next = lump + 1;
		Console.Printf("Reading lump: %s", Wads.GetLumpFullName(lump));

		let content = Wads.ReadLump(lump);
		Array<string> lines;
		content.Split(lines, "\n", TOK_SKIPEMPTY);

		for (uint i = 0; i < lines.Size(); i++)
		{
			if (lines[i] ~== "" || lines[i].Left(2) ~== "//")
				continue;

			class<Actor> type = lines[i];

			if (type == null)
			{
				Console.Printf(
					"LootMarkers: Unknown actor type `%s` (line %d).",
					lines[i], i
				);
				continue;
			}

			Console.Printf("Adding type to mark as loot: %s", type.GetClassName());
			MarkerTargets.Push(type);
		}
	} while (true);
}
Console output is as follows:
Spoiler:
Where your files would look like this:

Code: Select all

ExplosiveBarrel
EvilEye

Code: Select all

DoomImp
Just take out the extra console logging and you're good to go. It even supports blank lines and single-line comments, though you could just as well take that out too.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

Awesome. I'll have a look. Meanwhile I've been working on an exclude list. I've got an idea for allowing each successive mod to add include and exclude rules to a list. I'll incorporate your successive lump reader into that and post it when I've got it working.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

TLDR: I made some changes hardly noticeable to the typical user but very convenient to modders

So I added an exclude list along side the include list. The way it worked is that first the actor is checked for the include list, and if found, is checked for the exclude list. This works on a basic level, but if for example one mod excludes a certain class, then a later mod creates a subclass and wants it included, it can't do that. So now instead of two lists there is a list of rules each rule is checked for each spawned thing. A later rule can override an earlier one, so a later loading mod can override an earlier one's rules.

Sound complicated? It's not. Start with inventory, I want to mark all inventory items. But I don't really like blur spheres, I don't want those marked. But there's this mod with a subclass of the blur sphere that I do like, and I want that one marked. My LOOTMARK lump could look like this:

Code: Select all

include=inventory
exclude=blursphere
include=blursphere2
Inventory is actually included by default, no need to include that in the file, I just did that for a demo.
Also, MapMarker is hard-coded as an exclude, and can never be included. That prevents markers from marking markers marking markers infinitely.

Here's the new code:
Spoiler:
Thanks to the example posted by TheRatCircus, all versions of LOOTMARK are loaded chronologically instead of just the latest one.
The language file part has been removed entirely, all rules are sourced in LOOTMARK lumps.

I'll update the first post when I've have more time to test this.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

I wrote a system for the user to choose items to mark on the map, pretty slick if I do say so myself. In testing it works in the stock iwads but breaks several mods - One I've noticed so far are High Noon Drifter, Action Doom, and Hocus Pocus. Not sure why but I'll look into it.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

New feature: User toggled marks

Post by Sir Robin »

New feature I'm working on: User-markable objects. Any pick-ups (inventory items) are already marked on the map by default, but what if the user wants some other item marked? For example some NPC to talk to?

Take for example a game like Strife. You find this NPC:

And he seems like h might be useful. You'd like to mark him on your map to remember where he is.

You press and hold the marker key (default M) and get the blue marker cursor:


You move your view so that the cursor is on the item you want to mark, and the blue cursor turns green and the item has a green box around it:


Now you let go of the marker key, and check your map. Sure enough, there he is:


But what if you decide he isn't really all that important and you don't want him on your map after all? No problem, hold the M key again, look at the item you want off the map, and the cursor will change to a red mark and the item will have a red frame around it:

Release the marker key and the marker is removed and he is no longer on your map.
Starman the Blaziken
Posts: 228
Joined: Thu Mar 07, 2019 9:40 pm
Graphics Processor: ATI/AMD (Modern GZDoom)
Location: United States, MI

Re: Loot Markers

Post by Starman the Blaziken »

Ooh cool feature, I would like to see that added.
User avatar
Sir Robin
Posts: 398
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Loot Markers

Post by Sir Robin »

I forgot to mention, the update is in the first post. There's a download link
Starman the Blaziken
Posts: 228
Joined: Thu Mar 07, 2019 9:40 pm
Graphics Processor: ATI/AMD (Modern GZDoom)
Location: United States, MI

Re: Loot Markers

Post by Starman the Blaziken »

Hmm... Not sure what you been doing with it since you made that version, because I downloaded it from the link, tried this in the latest GZDoom and it gives me this error trying to run this, even alone it gives me at least only these handful of errors:

MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 1: Class LootCursorInv has unknown base class MWR_Cursor3dInv
MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 84: Class MarkerCursor has unknown base class MWR_Cursor2d
MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 1: LootCursorInv: Non-actor classes may not have defaults
MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 8: Attempt to override non-existent virtual function DoWhileEnabled
MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 30: Attempt to override non-existent virtual function DoBeforeDisable
MWR_LootMarkers.pk3:zscript/lootcursor.zs, line 84: MarkerCursor: States can only be defined for actors.

Execution could not continue.

6 errors, 0 warnings while compiling MWR_LootMarkers.pk3:zscript.zs

Return to “Gameplay Mods”