UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

How do you get text to appear on screen when player walks over a trigger?

broken avatar :(
Created 10 years ago
by dextro62
0 Members and 1 Guest are viewing this topic.
1,944 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 5 September 2014
Last active: 9 years ago
Posts
58
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
dextro62's Groups
dextro62's Contact & Social Links
Hey, as the subject says i'd like to get some text to appear on the screen when a player walks over a specific part of the map. I'd like the text to stay there for a couple seconds and I'd like for this to only happen once. If anyone could help with this that would be great.
I'm pretty new at mapping/scripting so any answers will probably have to be dumbed down abit.
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
Place the trigger_multiple in Radiant.
Then for the script, in yourmapname.gsc, after maps\_zombiemode::main(); thread a function:
Code Snippet
Plaintext
thread name_of_your_function();
Create the function at the end of the file. There are two ways, one easy and one "harder" but more customizable.
Code Snippet
Plaintext
// easy
name_of_your_function()
{
    trig = getEnt( "YOUR_TRIGGER_TARGETNAME", "targetname" );
    trig waittill( "trigger" );
    iprintlnbold( "YOUR MESSAGE" );
}

// harder
name_of_your_function()
{
    trig = getEnt( "YOUR_TRIGGER_TARGETNAME", "targetname" );
    trig waittill( "trigger" );
    thread print_message( "YOUR MESSAGE", 2 ); // replace 2 with the time
}

print_message( text, time )
{
    // change the position, the color, or whatever you want to change here
    hud = create_simple_hud();
    hud.alignX = "center";
    hud.alignY = "middle";
    hud.horzAlign = "center";
    hud.vertAlign = "middle";
    hud.y = -70;
    hud.fontscale = 1.5;
    hud.alpha = 1;
    hud.color = ( 1, 1, 1 );
    hud setText( text );
    wait time;
    hud destroy_hud();
}
Haven't tested so there could be some syntax errors, but it should work. Should have probably check if the one who triggers the trigger is player or things like that, but with this it should be ok.
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 5 September 2014
Last active: 9 years ago
Posts
58
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
dextro62's Groups
dextro62's Contact & Social Links
Thanks. I'll try it out.

 
Loading ...