iprintln & setexpfog
Moderator: Core Staff
iprintln & setexpfog
i'm a former pawn coder and recently moved to cod, so here's my questions:
can iprintln's position be changed? i'm trying to create an advertisement that never fades away, is there any other method besides using an endless loop to fix this?
setexpfog doesn't seem to affect the skybox, am i able to change the skybox color or?
can iprintln's position be changed? i'm trying to create an advertisement that never fades away, is there any other method besides using an endless loop to fix this?
setexpfog doesn't seem to affect the skybox, am i able to change the skybox color or?
Re: iprintln & setexpfog
Use huds instead of iprintlnbolds
Re: iprintln & setexpfog
i've found some usefull shit..IzNoGoD wrote:Use huds instead of iprintlnbolds
Code: Select all
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()
{
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 = [];
if ( level.console )
level.fontHeight = 12;
else
level.fontHeight = 12;
}
Code: Select all
/*
=============
///ScriptDocBegin
"Name: createFontString( <font>, <fontScale> )"
"Summary: Creates a hud element for font purposes"
"Module: Hud"
"MandatoryArg: <font>: Apparently this is always set to default."
"MandatoryArg: <fontScale>: The scale you want."
"Example: level.hintElem = createFontString( "default", 2.0 );"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
createFontString( font, fontScale )
{
fontElem = newHudElem( self );
fontElem.elemType = "font";
fontElem.font = font;
fontElem.fontscale = fontScale;
fontElem.x = 0;
fontElem.y = 0;
fontElem.width = 0;
fontElem.height = int(level.fontHeight * fontScale);
fontElem.xOffset = 0;
fontElem.yOffset = 0;
fontElem.children = [];
fontElem setParent( level.uiParent );
return fontElem;
}
createServerFontString( font, fontScale )
{
fontElem = newHudElem( self );
fontElem.elemType = "font";
fontElem.font = font;
fontElem.fontscale = fontScale;
fontElem.x = 0;
fontElem.y = 0;
fontElem.width = 0;
fontElem.height = int(level.fontHeight * fontScale);
fontElem.xOffset = 0;
fontElem.yOffset = 0;
fontElem.children = [];
fontElem setParent( level.uiParent );
return fontElem;
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: iprintln & setexpfog
The skybox is formed with textures, not settings.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: iprintln & setexpfog
Code: Select all
hud_sponsor=newhudelem();
hud_sponsor.horzAlign = "left";
hud_sponsor.vertAlign = "top";
hud_sponsor.alignx = "left";
hud_sponsor.aligny = "top";
hud_sponsor.x = 8;
hud_sponsor.y = 170;
hud_sponsor settext("sponsored by IzNoGoD");
Re: iprintln & setexpfog
pretty much what i've done yesterday, just a note; you missed the fontscale and the font itself, it does not work without them (atleast from what i've tried). thank you once again.IzNoGoD wrote:Code: Select all
     hud_sponsor=newhudelem();     hud_sponsor.horzAlign = "left";     hud_sponsor.vertAlign = "top";     hud_sponsor.alignx = "left";     hud_sponsor.aligny = "top";     hud_sponsor.x = 8;     hud_sponsor.y = 170;     hud_sponsor settext("sponsored by IzNoGoD"); Â
Code: Select all
level.adv = NewHudElem();
level.adv.horzAlign = "center_safearea";
level.adv.vertAlign = "top";
level.adv.alignX = "center";
level.adv.alignY = "middle";
level.adv.x = 0;
level.adv.y = 70;
level.adv.font = "objective";
level.adv.fontscale = 2;
level.adv SetText("^1insert your advertisement text here..");
Re: iprintln & setexpfog
Look through some menudefs to find all the possible fonts.
Re: iprintln & setexpfog
Code: Select all
level.adv = newHudElem();
level.adv.horzAlign = "right";
level.adv.vertAlign = "top";
level.adv.alignX = "right";
level.adv.alignY = "top";
level.adv.x -= 6;
level.adv.y += 6;
// level.adv.font = "objective";
level.adv.fontscale = 2;
level.adv setText("...");
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: iprintln & setexpfog
For CoD4.
areas = TOP / TOP LEFT / TOP RIGHT / LEFT / CENTER / RIGHT / BOTTOM / BOTTOM LEFT / BOTTOM RIGHT
1.4 is the smallest font size
fonts = "default", "bigfixed", "smallfixed", "objective"
Code: Select all
level.myhud = createServerFontString( "default", 1.4 );
level.myhud setPoint( <screenarea>, <relativearea>, <xoffset>, <yoffset>);
level.myhud setText("...");
1.4 is the smallest font size
fonts = "default", "bigfixed", "smallfixed", "objective"
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: iprintln & setexpfog
thanks, now fontScale parametter works fine.Drofder2004 wrote:For CoD4.
areas = TOP / TOP LEFT / TOP RIGHT / LEFT / CENTER / RIGHT / BOTTOM / BOTTOM LEFT / BOTTOM RIGHTCode: Select all
level.myhud = createServerFontString( "default", 1.4 ); level.myhud setPoint( <screenarea>, <relativearea>, <xoffset>, <yoffset>); level.myhud setText("...");
1.4 is the smallest font size
fonts = "default", "bigfixed", "smallfixed", "objective"
is there a way to skip to the next line or there's a need to draw the 2nd line separately?
Code: Select all
hudPlayersCount()
{
level.adv = createFontString("default", 1.4);
level.adv.horzAlign = "left";
level.adv.vertAlign = "top";
level.adv.alignX = "left";
level.adv.alignY = "top";
level.adv.x += 112;
level.adv.y += 16;
level.adv setText("^2Humans Left: ^3" + getPlayersCount(0) + " ^2Zombies Left: ^3" + getPlayersCount(1)); // skip anything after getPlayersCount(0); to the next line and keep the parametters.
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: iprintln & setexpfog
"\n"
Word of note, the variables "getplayercount" will NOT update automatically, you will need to call the "setText" each time it updates.
Code: Select all
iprintln("Hello \nWorld!");
I have not tested this in a HUD however, unsure of its behaviour, but should be fine.Hello
World!
Code: Select all
level.adv = createServerFontString( "default", 1.4 );
level.adv setPoint( "TOP LEFT", "TOP LEFT", 112, 16);
level.adv setText("^2Humans Left: ^3" + getPlayersCount(0) + "\n^2Zombies Left: ^3" + getPlayersCount(1));
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: iprintln & setexpfog
don't worry, i'm aware. i've moved to cod but i've been dealing with valve games since ages. i'm doing the update on the following events: disconnect & join spectator & spawn (which is when the gvar zomb changes).Drofder2004 wrote:"\n"Code: Select all
iprintln("Hello \nWorld!");
I have not tested this in a HUD however, unsure of its behaviour, but should be fine.Hello
World!
Word of note, the variables "getplayercount" will NOT update automatically, you will need to call the "setText" each time it updates.Code: Select all
level.adv = createServerFontString( "default", 1.4 ); level.adv setPoint( "TOP LEFT", "TOP LEFT", 112, 16); level.adv setText("^2Humans Left: ^3" + getPlayersCount(0) + "\n^2Zombies Left: ^3" + getPlayersCount(1));
i'm basing it off on my first mod anyways from hl2dm..
http://youtu.be/9vXvTbklrpA?t=14s
Who is online
Users browsing this forum: No registered users and 31 guests