Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: OrkischeHorde on Tue 14/11/2023 12:11:09

Title: [SOLVED] (character) Dialogue over a black screen
Post by: OrkischeHorde on Tue 14/11/2023 12:11:09
Either, the answer to my problem is really simple, or deceptively difficult but...

I want to fade a screen to black, and have some speech / dialogue showing over (above?) the black screen.

When I  use the FadeIn- or FadeOut-functions, the text doesn't show. I think it has to do something with the baselines of messages being lower than the fade.

Are there any workarounds / ways to implement this?
Title: Re: (character) Dialogue over a black screen
Post by: Matti on Tue 14/11/2023 12:27:35
You should be able to use a screen-sized black GUI and fade it in manually (by making it fully transparent, then decreasing the transparency).
Title: Re: (character) Dialogue over a black screen
Post by: heltenjon on Tue 14/11/2023 13:21:51
Or you could send the player to a room with an all-black background and display the speech on that. (Then send them back when you end the dialogue.) Could be useful if you need to do this at several places in your game and are not sure about how to turn Matti's solution into a function.
Title: Re: (character) Dialogue over a black screen
Post by: AndreasBlack on Tue 14/11/2023 14:34:56
I would say add two backgrounds in the room. One that is black and one that's normal.

in
function room_Load() add the main bakground, so the game doesn't flip between the bakgrounds like an animation!

SetBackgroundFrame(0); //Main BG
Then before the dialog starts go forexample in the function NPC_Character_AnyClick()             

SetBackgroundFrame(1);
player.Transparency=100;
oObject0.Transparency=100; //object 0 is just an example. Match with your objects..
Title: Re: (character) Dialogue over a black screen
Post by: Crimson Wizard on Tue 14/11/2023 15:21:49
Quote from: AndreasBlack on Tue 14/11/2023 14:34:56I would say add two backgrounds in the room. One that is black and one that's normal.

1. That won't hide any objects or characters in the room.
2. Adding this to any room where dialog may take place will unnecessarily increase the size of each room file. In case you need a room bg filled with color, it's more efficient to use DrawingSurface and color them by a script command.
Title: Re: (character) Dialogue over a black screen
Post by: AndreasBlack on Wed 15/11/2023 01:18:53
Quote from: Crimson Wizard on Tue 14/11/2023 15:21:49
Quote from: AndreasBlack on Tue 14/11/2023 14:34:56I would say add two backgrounds in the room. One that is black and one that's normal.

1. That won't hide any objects or characters in the room.
2. Adding this to any room where dialog may take place will unnecessarily increase the size of each room file. In case you need a room bg filled with color, it's more efficient to use DrawingSurface and color them by a script command.

Ahh! Alltho to my defense no objects or characters were mentioned in his post. It's unclear weither he should be able to still click or hover over characters/objects and see their names when it's dark with dialog???

Anyway player.Transparency=100; and oObject0.Transparency=100; should fix that. Then obviously flip back the BG and the object/objects once it's done if that's what he wants. I've edited. If you still don't like it. Show your code for the "proper solution" for us mere mortals  (laugh)

Edit: Sorry of-topic but...What do you mean a added background increases the room size, how much is that? Why have i never heard about this. Is it really a big deal? I have many rooms with 5 bakground images should i be worried?


Title: Re: (character) Dialogue over a black screen
Post by: Crimson Wizard on Wed 15/11/2023 07:06:43
Quote from: AndreasBlack on Wed 15/11/2023 01:18:53Edit: Sorry of-topic but...What do you mean a added background increases the room size, how much is that?

Every added thing increases the game's size. In case of room bg the numbers depend on resolution and compression factor. Room bgs are compressed with LZW, so they are not equal to a raw image pixels and it's difficult to calculate their sizes on disk. But you may take room file (roomN.crm), remember its size, add a background and see how size changes.
Whether it's a big deal or not is again a situational thing, but my point being that if it's just to fill room with color, then it's not economical to add bgs to each room for that.
Title: Re: (character) Dialogue over a black screen
Post by: OrkischeHorde on Thu 16/11/2023 10:41:35
Thanks for the helpful replies! I think I'll use the teleportation of players to a new room, as I'll have to tackle this problem (probably) multiple times, and only have to hide the player(s), not all objects etc.
Title: Re: [SOLVED] (character) Dialogue over a black screen
Post by: Cassiebsg on Thu 16/11/2023 17:06:11
I guess it depends on how you and the text and fade to work.
If you need/want the text to show during the fade, then you need to use Matti's solution. If you just want the text over the black screen, then a room will do just fine. :)