Move GUI in front of text

Started by Peegee, Yesterday at 19:04:44

Previous topic - Next topic

Peegee

Hello, I would like to attenuate a text, I thought to put a GUI representing a halo, which would be displayed over the text. But even by changing the Z, the halo remains behind. I also tried to use another font but I can not do it, how to change the font that uses a character? All the information I found did not work.

Rik_Vargard

I might be wrong but couldn't you use an object image instead and change the Baseline?

Crimson Wizard

Quote from: Peegee on Yesterday at 19:04:44Hello, I would like to attenuate a text, I thought to put a GUI representing a halo, which would be displayed over the text. But even by changing the Z, the halo remains behind. I also tried to use another font but I can not do it, how to change the font that uses a character? All the information I found did not work.

I will assume that by "text" you mean character speech.

Please clarify what kind of "halo" effect do you have in mind, can you post an example that presents your idea? That might let us to suggest better solution.

In regards to the questions.
By default the speech text is drawn on a overlay that has the maximal possible ZOrder, you cannot set anything above it. So either:
1. Reduce this overlay's z-order to a lower value instead. You can get speech overlay using Speech.TextOverlay, but you have to do so in (late_)repeatedly_execute_always, because that's the only two functions that run during blocking speech.
2. Write a custom speech function that displays character speech on a GUI label. Then you can add any more additional effects as you like.

Character speech font is changed using Game.SpeechFont property.

Quote from: Rik_Vargard on Yesterday at 19:07:41I might be wrong but couldn't you use an object image instead and change the Baseline?

Room objects are within the room and not sorted with speech overlays.

Peegee

(For Adventure Game Studio 3.6.0)

It is a simple text, cCharacter.Say ("Hello");
I'm trying to display a sprite (png), small semi-transparent gradient to soften the text. (In response to Rick, the text is always displayed above)
That's why I made a GUI, but it does not want to get on top and in addition, when I position the GUI, the text moves.

Thank you for your answers.
1: What code exactly do I need to put in the repeatedly_execute_always?

2: I do not understand much, can be because I do not use CharacterSpeech?

Yesterday I did a lot of testing, the software didn't want to take Game.SpeechFont.
At worst, I would like to be able to manage my fonts and assign them to the characters.


Khris

#4
Using cCharacter.Say() means you are using character speech (as opposed to displaying text boxes for instance).

Please always post the exact code you tried to use.

This will definitely work:

Code: ags
  // in game_start
  Game.SpeechFont = eFontTheName;

Using a standard GUI to change the appearance of LucasArts style spoken text won't work because AGS moves the text away from any GUIs currently appearing on-screen.

Can you provide a quick illustration that demonstrates how you want this to appear in-game? It's most likely going to require a custom speech function, as in a function you write that is then called by AGS whenever your code uses .Say().
This function will use a graphical overlay or GUI(s) to display the custom speech you want.

Crimson Wizard

#5
@Peegee
Could you please post the screenshot of you current text and elaborate on which problem you are trying to solve, because there's a chance that your problem has an easier solution. Earlier you said that you want to "soften" the text. Could it be that what you need a is a font outline?

Quote from: Khris on Yesterday at 22:01:31Using a standard GUI to change the appearance of LucasArts style spoken text won't work because AGS moves the text away from any GUIs currently appearing on-screen.

I must clarify: AGS only moves speech down if GUI is vertically above the text. If GUI is right over the text, then the text will not be moved down.

Following example script under spoiler works for me in AGS 3.6.0:

Spoiler
Code: ags
function repeatedly_execute_always()
{
    // test if there's a blocking speech overlay on screen
    if (Speech.TextOverlay != null)
    {
        // if there is one, then set its z-order to 20, and halo gui z-order to 21, so above it
        // make halo gui visible, and align over the text
        Speech.TextOverlay.ZOrder = 20;
        gHalo.Visible = true;
        gHalo.ZOrder = 21;
        gHalo.X = Speech.TextOverlay.X - 10;
        gHalo.Y = Speech.TextOverlay.Y - 10;
    }
    else
    {
        gHalo.Visible = false;
    }
}

Note that you must set GUI Clickable = false and Visible = false in the editor.
[close]

I cannot predict if that will do what you want though.

Peegee

#6

KHRIS:
I don't want to change the font of the whole game, only for one character.

Crimson Wizard:
It does not take this code:

Code: ags

gGui4Halo102 = Speech.TextOverlay.X - 10;


It seems difficult to mix a GUI with a text... Just for one page.
Can we at least assign a specific font to a character?

Khris

You're trying to assign a number to a GUI.

You need to use
Code: ags
  gGui4Halo102.X = Speech.TextOverlay.X - 10;

As for using a different speech font for a character, the only way I know of is to change Game.SpeechFont before calling .Say() whenever that character speaks. This can also be solved best with a custom Say function.

Snarky

Quote from: Peegee on Today at 09:54:09Can we at least assign a specific font to a character?

I've linked to this post a number of times. It has a step-by-step explanation of how to write a custom function to set different fonts for different characters' speech: https://www.adventuregamestudio.co.uk/forums/index.php?msg=636510794

SMF spam blocked by CleanTalk