Jump to content

How to give sectors/"rooms" names that can display somewhere? [GZDoom/UDMF]


SMG_Man

Recommended Posts

If any of you have played DOOM 3 before, you may have noticed that the game will usually tell you where you are in a level. For example:

image.png.3aa1da148ea30c8e36e7f18d8bb8157c.png

 

I think this feature is pretty cool, and would love to implement something like this in my own WAD(s); where either on the normal HUD or in the Automap specifically, the game will let the player know which "room" they're in on the map. With what I know about the GZDoom engine I think it should be possible, but I'm not experienced enough to build it from scratch without help. Would anyone be able to point me in the right direction or happen to know about similar features that other WADs may have?

Edited by SMG_Man

Share this post


Link to post

you can use a globalarray variable in your acslib and sbarinfo and set that to the room name when player crosses a linedef, depending on which side the line was triggered with lineside

 

or you can use a hudmsg_plain hudmessage to display it somewhere on player's screen when they cross a linedef

Share this post


Link to post
  • 1 month later...

(Apologies for getting back to you after so long)

 

On 10/2/2021 at 10:51 PM, sluggard said:

you can use a globalarray variable in your acslib and sbarinfo and set that to the room name when player crosses a linedef, depending on which side the line was triggered with lineside

 

I've got the status bar to display the message where I want it:

 

image.png.11b22a63741f633b1f7c4928754e9025.png

 

However, fiddling with arrays is not something I've ever done before. I understand how to format one, like for example

 

int e1m1array[4] = { "\cfHolding Room", "\cfLobby", "\cfWelcome Hall", "\cfExit" };

Making it into a global array accessible to SBARINFO though, I'm not sure of. Would I be able to define an array with the same name on a per-map basis, or would I have to make a large multi-dimensional array? Also, how would I manipulate the array value that SBARINFO gets using scripts?

Share this post


Link to post

You don't really need SBARINFO or to mess with status bars at all. You can just do an enter script to put the first room name up where you want it as well as define your room names array for that level. Then use ACS in-map on linedefs or with player enters sector things to do the exact same HudMessage but refer to your array positions.

 

That's how I'd do it. Easiest way I can think of without getting too fancy.

Share this post


Link to post

At your suggestion I looked into HUDMessage, and it seems to offer better control both in terms of effects and on a per-map basis. I've managed to get it working in a few scripts like this:

 

Spoiler

Script "location_init" OPEN
{
	HudMessage(s:e1m1locations[0]; HUDMSG_TYPEON | HUDMSG_NOTWITHFULLMAP, 1, CR_GOLD, 0.0, -0.93, 0.5, 0.03, 2.0);
	HudMessage(s:e1m1locations[0]; HUDMSG_PLAIN | HUDMSG_NOTWITH3DVIEW, 2, CR_GOLD, 0.0, -0.93, 0.0);
	Terminate;
}

Script "location_update" (int location_front, int location_back)
{
	if (LineSide() == SIDE_FRONT)
	{
	HudMessage(s:e1m1locations[location_front]; HUDMSG_TYPEON | HUDMSG_NOTWITHFULLMAP, 1, CR_GOLD, 0.0, -0.93, 0.5, 0.03, 2.0);
	HudMessage(s:e1m1locations[location_front]; HUDMSG_PLAIN | HUDMSG_NOTWITH3DVIEW, 2, CR_GOLD, 0.0, -0.93, 0.0);
	}
	else
	{
	HudMessage(s:e1m1locations[location_back]; HUDMSG_TYPEON | HUDMSG_NOTWITHFULLMAP, 1, CR_GOLD, 0.0, -0.93, 0.5, 0.03, 2.0);
	HudMessage(s:e1m1locations[location_back]; HUDMSG_PLAIN | HUDMSG_NOTWITH3DVIEW, 2, CR_GOLD, 0.0, -0.93, 0.0);
	}
}

Script "location_update_silent" (int location_front, int location_back)
{
	if (LineSide() == SIDE_FRONT)
	{
	HudMessage(s:e1m1locations[location_front]; HUDMSG_PLAIN | HUDMSG_NOTWITH3DVIEW, 2, CR_GOLD, 0.0, -0.93, 0.0);
	}
	else
	{
	HudMessage(s:e1m1locations[location_back]; HUDMSG_PLAIN | HUDMSG_NOTWITH3DVIEW, 2, CR_GOLD, 0.0, -0.93, 0.0);
	}
}

 

The first script shows the starting room's name and puts it on the automap as well as soon as the player starts the level. The second script will briefly flash the desired location on the screen when the player is moving from room to room and update the automap, while the third script will only update the automap (should be helpful for dealing with things like ledges, windows, and 3D floors).

 

So far it's working like a charm, so thanks for the advice o7

Edited by SMG_Man

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...