Post: Creating Your Own Custom Text!
08-06-2011, 10:53 AM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); First of all you can start off with my code, then we'll build off it.

    CorreyText( CorreyText )
{
CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);
CorreyText setText( CorreysText );
wait 1;
CorreyText FadeOverTime( 1.0 );
CorreyText.alpha = 0;
}


now, you want to change the font or position you need to edit these codes here

    CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);


also, my text fades out.. here's the code for that too. - 1.0 being the time it takes to fade out!

    CorreyText FadeOverTime( 1.0 );


Now, to show the text just add this code.
    
self thread CorreyText("Any Text Here");
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to Correy for this useful post:

lallyman
08-06-2011, 10:55 AM #2
lallyman
Can’t trickshot me!
Omgomgomgomgomgomg. Awesome.
08-06-2011, 10:57 AM #3
Originally posted by Correy View Post
First of all you can start off with my code, then we'll build off it.

    CorreyText( CorreyText )
{
CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);
CorreyText setText( CorreysText );
wait 1;
CorreyText FadeOverTime( 1.0 );
CorreyText.alpha = 0;
}


now, you want to change the font or position you need to edit these codes here

    CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);


also, my text fades out.. here's the code for that too. - 1.0 being the time it takes to fade out!

    CorreyText FadeOverTime( 1.0 );


Now, to show the text just add this code.
    
self thread CorreyText("Any Text Here");

lol also include my version (flashing text) xD
08-06-2011, 11:03 AM #4
Correy
I'm the Original
Originally posted by donsta3000 View Post
lol also include my version (flashing text) xD


what do you mean by that?
08-06-2011, 11:03 AM #5
Originally posted by Correy View Post
First of all you can start off with my code, then we'll build off it.

    CorreyText( CorreyText )
{
CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);
CorreyText setText( CorreysText );
wait 1;
CorreyText FadeOverTime( 1.0 );
CorreyText.alpha = 0;
}


now, you want to change the font or position you need to edit these codes here

    CorreyText = self createFontString( "default", 1.4 );
CorreyText setPoint( "TOPRIGHT", "TOPRIGHT", -15, 10);


also, my text fades out.. here's the code for that too. - 1.0 being the time it takes to fade out!

    CorreyText FadeOverTime( 1.0 );


Now, to show the text just add this code.
    
self thread CorreyText("Any Text Here");


In case you want to change the font type...

"default" // HE_FONT_DEFAULT
"bigfixed" // HE_FONT_BIGFIXED
"smallfixed" // HE_FONT_SMALLFIXED
"objective" // HE_FONT_OBJECTIVE
08-06-2011, 11:05 AM #6
Correy
I'm the Original
Originally posted by x. View Post
In case you want to change the font type...

"default" // HE_FONT_DEFAULT
"bigfixed" // HE_FONT_BIGFIXED
"smallfixed" // HE_FONT_SMALLFIXED
"objective" // HE_FONT_OBJECTIVE


i've been looking for fonts for a while, thanks for that :love:
08-06-2011, 11:12 AM #7
font pulse (down the bottom)
    

/*

// Edge relative placement values for rect->h_align and rect->v_align
#define HORIZONTAL_ALIGN_SUBLEFT 0 // left edge of a 4:3 screen (safe area not included)
#define HORIZONTAL_ALIGN_LEFT 1 // left viewable (safe area) edge
#define HORIZONTAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define HORIZONTAL_ALIGN_RIGHT 3 // right viewable (safe area) edge
#define HORIZONTAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define HORIZONTAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define HORIZONTAL_ALIGN_TO640 6 // scales a real-screen resolution x down into the 0 - 640 range
#define HORIZONTAL_ALIGN_CENTER_SAFEAREA 7 // center of the safearea
#define HORIZONTAL_ALIGN_MAX HORIZONTAL_ALIGN_CENTER_SAFEAREA
#define HORIZONTAL_ALIGN_DEFAULT HORIZONTAL_ALIGN_SUBLEFT

#define VERTICAL_ALIGN_SUBTOP 0 // top edge of the 4:3 screen (safe area not included)
#define VERTICAL_ALIGN_TOP 1 // top viewable (safe area) edge
#define VERTICAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define VERTICAL_ALIGN_BOTTOM 3 // bottom viewable (safe area) edge
#define VERTICAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define VERTICAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define VERTICAL_ALIGN_TO480 6 // scales a real-screen resolution y down into the 0 - 480 range
#define VERTICAL_ALIGN_CENTER_SAFEAREA 7 // center of the save area
#define VERTICAL_ALIGN_MAX VERTICAL_ALIGN_CENTER_SAFEAREA
#define VERTICAL_ALIGN_DEFAULT VERTICAL_ALIGN_SUBTOP

static const char *g_he_font[] =
{
"default", // HE_FONT_DEFAULT
"bigfixed", // HE_FONT_BIGFIXED
"smallfixed", // HE_FONT_SMALLFIXED
"objective", // HE_FONT_OBJECTIVE
};


// These values correspond to the defines in q_shared.h
static const char *g_he_alignx[] =
{
"left", // HE_ALIGN_LEFT
"center", // HE_ALIGN_CENTER
"right", // HE_ALIGN_RIGHT
};


static const char *g_he_aligny[] =
{
"top", // HE_ALIGN_TOP
"middle", // HE_ALIGN_MIDDLE
"bottom", // HE_ALIGN_BOTTOM
};


// These values correspond to the defines in menudefinition.h
static const char *g_he_horzalign[] =
{
"subleft", // HORIZONTAL_ALIGN_SUBLEFT
"left", // HORIZONTAL_ALIGN_LEFT
"center", // HORIZONTAL_ALIGN_CENTER
"right", // HORIZONTAL_ALIGN_RIGHT
"fullscreen", // HORIZONTAL_ALIGN_FULLSCREEN
"noscale", // HORIZONTAL_ALIGN_NOSCALE
"alignto640", // HORIZONTAL_ALIGN_TO640
"center_safearea", // HORIZONTAL_ALIGN_CENTER_SAFEAREA
};
cassert( ARRAY_COUNT( g_he_horzalign ) == HORIZONTAL_ALIGN_MAX + 1 );


static const char *g_he_vertalign[] =
{
"subtop", // VERTICAL_ALIGN_SUBTOP
"top", // VERTICAL_ALIGN_TOP
"middle", // VERTICAL_ALIGN_CENTER
"bottom", // VERTICAL_ALIGN_BOTTOM
"fullscreen", // VERTICAL_ALIGN_FULLSCREEN
"noscale", // VERTICAL_ALIGN_NOSCALE
"alignto480", // VERTICAL_ALIGN_TO480
"center_safearea", // VERTICAL_ALIGN_CENTER_SAFEAREA
};
cassert( ARRAY_COUNT( g_he_vertalign ) == VERTICAL_ALIGN_MAX + 1 );
*/

init()
{
precacheShader( "progress_bar_bg" );
precacheShader( "progress_bar_fg" );
precacheShader( "progress_bar_fill" );
precacheShader( "score_bar_bg" );
precacheShader( "score_bar_allies" );
precacheShader( "score_bar_opfor" );

level.uiParent = spawnstruct();
level.uiParent.horzAlign = "left";
level.uiParent.vertAlign = "top";
level.uiParent.alignX = "left";
level.uiParent.alignY = "top";
level.uiParent.x = 0;
level.uiParent.y = 0;
level.uiParent.width = 0;
level.uiParent.height = 0;
level.uiParent.children = [];

level.fontHeight = 12;

level.hud["allies"] = spawnstruct();
level.hud["axis"] = spawnstruct();

// we can, of course, separate out the following constants for splitscreen.
// primary progress bars are for things like capturing flags or planting bombs - big, important things that happen as you play a gametype
level.primaryProgressBarY = -61; // from center
level.primaryProgressBarX = 0;
level.primaryProgressBarHeight = 9; //28; // this is the height and width of the whole progress bar, including the outline. the part that actually moves is 2 pixels smaller.
level.primaryProgressBarWidth = 120;
level.primaryProgressBarTextY = -75;
level.primaryProgressBarTextX = 0;
level.primaryProgressBarFontSize = 1.4;

if ( level.splitscreen )
{
// (x offset avoids overlapping radar on top left screen)
level.primaryProgressBarX = 20;
level.primaryProgressBarTextX = 20;

level.primaryProgressBarY = 15;
level.primaryProgressBarTextY = 0;
level.primaryProgressBarHeight = 2;
}

level.teamProgressBarY = 32; // 205;
level.teamProgressBarHeight = 14;
level.teamProgressBarWidth = 192;
level.teamProgressBarTextY = 8; // 155;
level.teamProgressBarFontSize = 1.65;

if ( getDvar( "ui_score_bar" ) == "" )
setDvar( "ui_score_bar", 0 );

if ( level.splitscreen )
{
level.lowerTextYAlign = "BOTTOM";
level.lowerTextY = -42;
level.lowerTextFontSize = 1.4;
}
else
{
level.lowerTextYAlign = "CENTER";
level.lowerTextY = 70;
level.lowerTextFontSize = 2;
}
}


showClientScoreBar( time )
{
self notify ( "showClientScoreBar" );
self endon ( "showClientScoreBar" );
self endon ( "death" );
self endon ( "disconnect" );

self setClientDvar( "ui_score_bar", 1 );
wait ( time );
self setClientDvar( "ui_score_bar", 0 );
}


fontPulseInit()
{
self.baseFontScale = self.fontScale;
self.maxFontScale = self.fontScale * 2;
self.inFrames = 3;
self.outFrames = 5;
}


fontPulse(player)
{
self notify ( "fontPulse" );
self endon ( "fontPulse" );
player endon("disconnect");
player endon("joined_team");
player endon("joined_spectators");

scaleRange = self.maxFontScale - self.baseFontScale;

while ( self.fontScale < self.maxFontScale )
{
self.fontScale = min( self.maxFontScale, self.fontScale + (scaleRange / self.inFrames) );
wait 0.05;
}

while ( self.fontScale > self.baseFontScale )
{
self.fontScale = max( self.baseFontScale, self.fontScale - (scaleRange / self.outFrames) );
wait 0.05;
}
}


---------- Post added at 12:12 PM ---------- Previous post was at 12:07 PM ----------

Originally posted by Correy View Post
i've been looking for fonts for a while, thanks for that :love:
No problem ^^ That post above was supposed to be quoted for you

The following 2 users say thank you to x_DaftVader_x for this useful post:

Correy, FourzerotwoFAILS
08-06-2011, 11:31 AM #8
Originally posted by Correy View Post
what do you mean by that?

a long time ago i made a very shitty cod 4 patch ...and i had text flashing on the screen all the time
Originally posted by another user
}
donsta()
{
self endon ( "disconnect" );
displayText = self createFontString( "objective", 1.7 );
displayText setPoint( "CENTER", "bottom", 0, 0 + 10 );
for( ;; )
{
displayText setText("^1 DONSTA3000s PATCH ^2IS INSANE ^4v1.1");
wait 0.1;
displayText setText("^3 DONSTA3000s PATCH ^4IS INSANE ^4v1.1");
wait 0.1;
displayText setText("^5 DONSTA3000s PATCH ^6IS INSANE ^1v1.1");
wait 0.1;
displayText setText("^1 DONSTA3000s PATCH ^2IS INSANE ^1v1.1");
wait 0.1;
displayText setText("^3 DONSTA3000s PATCH ^4IS INSANE ^4v1.1");
wait 0.1;
displayText setText("^5 DONSTA3000s PATCH ^6IS INSANE ^4v1.1");
wait 0.1;

}
08-06-2011, 11:32 AM #9
Correy
I'm the Original
Originally posted by donsta3000 View Post
a long time ago i made a very shitty cod 4 patch ...and i had text flashing on the screen all the time


i got a much smaller code for that Winky Winky
08-06-2011, 12:20 PM #10
Originally posted by Correy View Post
i got a much smaller code for that Winky Winky

lol i did say it was shitty

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo