closable player messages / packing titles.txt not working?

LivingLinguini

L1: Registered
May 25, 2021
12
1
I have made a system to display a message with a background to select players that they can hide with reload. This uses an env_message that stores the messages in scripts/titles.txt. The messages fail to show when I pack the map, unless the user manual extracts the scripts/titles.txt file with gcfscape and places it in their /tf/scripts/titles.txt or /custom/<name>/scripts/titles.txt. A working example is on the center left of this image
 

Attachments

  • message.png
    message.png
    248.9 KB · Views: 42
Last edited:

LivingLinguini

L1: Registered
May 25, 2021
12
1
I haven't found a way to do this. I created a workaround instead.

BACKGROUND
I created overlay matererials that have a semitransparent boxes to roughly fit different size messages
I made use of vscript's SetScriptOverlayMaterial function to handle giving and removing the backgrounds

SHOWING TEXT
After some unreliable results in other attempts, I used this vscript function show a message to a given player
Code:
function ShowText(player, strText, flScanTime, flDuration, strColor, flX, flY, iChannel, flgs=1) {
    local hText = SpawnEntityFromTable("game_text", {
        message = strText,
        x = flX
        y = flY
        effect = flScanTime ? 2 : 0, 
        color = strColor,
        holdtime = flDuration,
        fadein = 0.5
        fadeout = 0.5
        channel = iChannel,
        spawnflags = flgs
    });

 
    EntFireByHandle(hText, "Display", "", 1.1, player, null);
}


//ex
ShowText(player, "hello world\n;D" 0, 30, "150 150 150",  0, -1, 3, 0)

HIDING TEXT
I have 2 game_text entities in the map I fire with DoEntFire. 1 for clearing messages for a given person and 1 for clearing messages for everyone. They use the same channel as the ShowText to remove it. They have different 'All Players' flag values.
 

Attachments

  • example_box.jpg
    example_box.jpg
    503.3 KB · Views: 36