Hud element active score

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Hud element active score

Post by tltrude »

I'm working on a map that has an active scoreboard on the screen. But, it is constantly blinking, and there is a localization error for every blink--see code below. I noticed in the global message.scr that it uses "hud elements" to print hint messages in the center of the screen--I'm using it to display a 30 second warning. So my question is, how can I use hud elements to display an active scoreboard?

Code: Select all

announce_points:

	while ( 1)
	{
		locprint level.subtitleX level.subtitleY ("Countdown: " + (level.counter) + " seconds" + "\n" + "Missile health: " + (level.misslehealth) + " percent" )
		wait .9
	}

end
Screen location is:

level.subtitleX = 89
level.subtitleY = 50
Tom Trude,

Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

in the medic hunt after m5l1 (i think) it uses hudprint to have the ready set go on the screen, if that's what you want and the rest of it's alright (level.counter and level.missilehealth) use...

while (1)
{
waitthread announce_points ("Countdown: " + (level.counter) + " seconds" + "\n" + "Missile health: " + (level.misslehealth) + " percent" ) 1 0 0
}

announce_points:
hudprint local.nstring local.nr local.ng local.nb:
println local.nstring

level.hudprint = local

local.distance = local.nstring.size / -2
huddraw_rect 187 (local.distance * 10) 200 0 0
huddraw_color 187 local.r local.g local.b
huddraw_font 187 "facfont-20"
huddraw_string 187 local.nstring
huddraw_align 187 center top
huddraw_alpha 187 1

wait .5 //refresh time

/* while (local.fade > 0)
{
local.fade = local.fade - 0.02
huddraw_alpha 187 local.fade
wait 0.02
}
*/
end

you can have it so it's fading if you wanted to but the refresh time should be larger (that bit i've commented out though) and you need to change the orange line to this
local.fade = 1
huddraw_alpha 187 local.fade

:D
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

cool

Post by tltrude »

Yeah, that works great--the blinking is gone! Thanks nuggets!

I had to position it in the lower left (left bottom). But, I don't know if it will be in the same place for all screen resoultions. Anyone know how to set this?

huddraw_virtualsize( Integer index, Integer virtual )
Sets if the huddraw element should use virutal screen resolution for positioning and size.


Would it be, "huddraw_virtualsize 187 1"?

Code: Select all

//---------------------------------------------->
//   active scoreboard
//---------------------------------------------->

print_points:

	while (1) 
	{ 
	waitthread announce_points ("Countdown: " + (level.counter) + " seconds" + "\n" + "Missile health: " + (level.misslehealth) + " percent" ) 1 0 0 
	}
 	waitframe
end

announce_points:

	local.r = 1
	local.g = 1
	local.b = 1 
 
	hudprint local.nstring local.nr local.ng local.nb: 
	println local.nstring 

	level.hudprint = local 

	huddraw_rect 187 140 -84 50 50 
	huddraw_color 187 local.r local.g local.b 
	huddraw_font 187 "facfont-20" 
	huddraw_string 187 local.nstring 
	huddraw_align 187 left bottom 
	huddraw_alpha 187 1 

	wait .5 //refresh time 

end
Setting huddraw_rect was hard, it kept vanishing below the screen. But, it is right above the FPS meter now. The localization errors are still there, but can't have everything you wish for, I guess.
Tom Trude,

Image
Post Reply