How to make HudMessage scale the same way as Dialog?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
Post Reply
doomplayer
Posts: 8
Joined: Thu Oct 10, 2019 10:53 pm

How to make HudMessage scale the same way as Dialog?

Post by doomplayer »

I am trying to add little images next to dialog options:
Spoiler:
Here is the code:

Code: Select all

Script 102 (void)
	{
		
		int Width =  GetScreenWidth();
		int Height = GetScreenHeight();

		int HUDx1 = ( (Width * 407/1000 )) << 16;
		int HUDy1 = ( (Height * 685/1000)) << 16;
		int HUDx2 = ( (Width * 400/1000 )) << 16;
		int HUDy2 = ( (Height * 715/1000)) << 16;
		
		SetHUDSize(Width, Height, 1);
	
		SetFont("MEDI");
		HudMessage(s:"A"; HUDMSG_PLAIN, 3, 0, HUDx1, HUDy1, 0);

		SetFont("ARM1");
		HudMessage(s:"A"; HUDMSG_PLAIN, 4, 0, HUDx2, HUDy2, 0);
		
	}	
The problem is that for every other resolution the images and the dialog are not aligned correctly:
Spoiler:
So is there a way to make them scale and position the same way when resoultion changes?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49068
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make HudMessage scale the same way as Dialog?

Post by Graf Zahl »

Don't use ACS. If you want to align images with text printed through ZScript you have to do your mod as a ZScript extension to the conversation system. With ACS you'll never get it to work because you have no access to the calculations being done here to position the text.
Post Reply

Return to “Scripting”