Page 1 of 3
In Game Hud Popup?
Posted: Fri Apr 16, 2004 3:43 am
by Cobra {sfx}
Would it be possible to script so when a player touches my gravity trigger, he gets another hud on screen like the health meter but for the JetPack (low gravity the trigger gives him), and it goes away upon him getting killed?
It doesnt have to do anything, just so he has a visual on screen
Cobra
Posted: Fri Apr 16, 2004 3:47 am
by lizardkid
try making something like a bomb bitmap or whatever and support it and use it like you'd support a bomb icon in the game.
Posted: Fri Apr 16, 2004 4:05 am
by Cobra {sfx}
Err ok, all new to me, is there some tutorial for that? ive found some other peeps have made but dont want to use them incase i go over something else on screen, which most ive found seem to do - replace them.
and...
how through scripting would i go about adding them to the trigger?
ps this is going serverside so would it have to be a hud from the mohaa original folder? or will they see anything i add to the pk3.
i tried adding loading screen and small pic when u press tab by tutorial - work fine on my network but serverside they dont show - is there something different about using stock maps with my pics instead of them?
Ta for the help
Cobra
Gotterdammerung
Posted: Fri Apr 16, 2004 5:15 am
by tltrude
The map Gotterdammerung uses an on-screen scroreboard to keep track of the health of a trigger and display a countdown timer. It is not graphic, as you want, but at least it is on the screen.
Code: Select all
//------------------------------------------------->
// active scoreboard
//------------------------------------------------->
print_points:
while (1)
{
waitthread hudprint ("Countdown: " + (level.counter) + " seconds" + "\n" + "Missile health: " + (level.misslehealth) + " percent" ) .75 .65 .1 // three numbers are for color (gold)
}
waitframe
end
hudprint local.nstring local.r local.g local.b:
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
In this case, the two most important variables are "level.counter" and "level.misslehealth". Their starting values need to be set before the thread is called, and then changed by another thread or read from a changing entity value in the game.
You can download the map by clicking on my sig logo below.

Posted: Fri Apr 16, 2004 11:09 am
by Cobra {sfx}
Ah thanks Tom, ill give that a shot.
That Also gives me some idea for positioning etc too
Cobra
roundstart
Posted: Fri Apr 16, 2004 3:09 pm
by tltrude
If you comment out
//level waitill roundstart
in the script, you can test the objectives alone. But, you'll have to switch teams to see everything.
Posted: Fri Apr 16, 2004 7:45 pm
by Cobra {sfx}
Nice one Tom

Posted: Sat Apr 17, 2004 2:43 am
by nuggets
how about using the stopwatch for the jetpack
parm.other stopwatch 20
Posted: Sat Apr 17, 2004 4:07 am
by Cobra {sfx}
No good that nuggets - its on an objective map so timer will be in use sooner or later.
I got Toms way to print NIL on screen, gettin somewhere

but it stayed with em next round b4 they got the "jetpack".
Is there a way i can use my own loading screens for a stock map?
be nice to have some info there as the ingame small screen dont hold much.
I followed a few tutorials, which worked fine on my network but didnt show serverside - different commands needed?
Ill check the single player game see if any hud things in there worth lookin at for a "visual" display.
Cobra
ps if ya want The Hunt-Rocketeers gives a shout ill post - some fun on hunt for a change

Posted: Sat Apr 17, 2004 9:48 am
by bdbodger
I think it is possible to popup a menu that has a health bar linked to a cvar I mean I have been makeing a menu for another thing and I have seen in the SDK commands for that sort of thing but not sure how to do it .
Posted: Sat Apr 17, 2004 8:41 pm
by Cobra {sfx}
Cool, keep us informed Bodger, be nice to add that way.
question:
i wanna run a server thats tdm and include hunt/v2/bridge, but have them as tdm, ive noticed in the scripts the roundbased options etc, would map load even tho its an obj map into tdm setting or would i have to disable the bombs?
CObra
Posted: Sat Apr 17, 2004 11:00 pm
by bdbodger
well I worked out at test health meter useing the shaders from the game .
first the urc file copy this into an urc file and put it into the ui directory
testbar.urc
Code: Select all
menu "mystatbar" 128 136 NONE 0
bgcolor 0 0 0 0
align bottom centery
resource
Label
{
name "Default"
rect 16 24 32 96
rect 16 56 16 64
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
shader textures/hud/healthback
}
resource
Label
{
name "test bar"
rect 16 56 16 64
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
linkcvar "testbar"
statbar vertical 0 100 //statbar horizontal 0 100
statbar_shader textures/hud/healthmeter
statbar_shader_flash textures/hud/healthmeterflash
initdata 100
}
end
resource
Label
{
name "test number"
title "test"
//rect 56 82 64 16
rect 40 82 64 16
fgcolor 0.70 0.60 0.05 1.00
bgcolor 0.00 0.00 0.00 0.00
borderstyle "NONE"
textalign left
font facfont-20
}
resource
Label
{
name "healthnumber"
//rect 56 104 64 16
rect 40 104 64 16
fgcolor 0.70 0.60 0.05 1.00
bgcolor 0.00 0.00 0.00 0.00
borderstyle "NONE"
linkcvar "testbar"
textalign left
font facfont-20
}
then put this in your level.script
Code: Select all
main:
showmenu mystatbar
level.testbar = 100
thread hudtest
end
hudtest:
while(level.testbar > 0)
{
setcvar testbar level.testbar
wait .25
level.testbar--
}
hidemenu mystatbar
end
Posted: Sat Apr 17, 2004 11:53 pm
by Cobra {sfx}
Wow thanks for that Bodger, ill test in morning lol up for work in 4 hrs, ill post in morning again
Cobra
Lo Bodger, sorry m8 i must be doin summat wrong, ive tried a few combinations.
Its like this at the mo...
main:
setcvar "g_obj_alliedtext1" "- Locate Scientist,"
setcvar "g_obj_alliedtext2" "Capture A JetPack,"
setcvar "g_obj_alliedtext3" "Destroy Flak88."
setcvar "g_obj_axistext1" "-Locate Scientist For"
setcvar "g_obj_axistext2" "JetPack,Defend Flak88"
setcvar "g_obj_axistext3" "."
setcvar "g_obj_axistext3" " A Cobra {sfx} Mod"
setcvar "g_scoreboardpic" "objdm1"
showmenu mystatbar
level.testbar = 100
thread hudtest
//////////////////////////
level waittill prespawn
//////////////////////////
//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/obj/obj_team1.scr
exec global/ambient.scr obj_team1
thread Cobratext
thread jetpack1
thread jetpack2
thread rocketeers
//////////////////////////
level waittill spawn
//////////////////////////
end
//and this further down
hudtest:
while(level.testbar > 0)
{
setcvar testbar level.testbar
wait .25
level.testbar--
}
hidemenu mystatbar
end
Cobra
ps in the urc file i changed this
menu "mystatbar" 128 136 NONE 0
bgcolor 0 0 0 0
align bottom centery
to this just in case
menu "mystatbar" 128 136 NONE 0
bgcolor 0 0 0 0
align bottom centre
no show on screen still tho
Posted: Sun Apr 18, 2004 8:22 am
by bdbodger
Did you make the urc file and put it in the main/ui directory ? I took the example of the hud_health.urc and changed align left bottom to align bottom centery and changed the cvar it used . also you may have to use $player[?] showmenu mystatbar or a thread with a trigger like
$mytrigger setthread threadname
threadnamed:
local.player = parm.other
local.player showmenu mystatbar
....
....
....
end
as long as the menu exists it should show unless you have a sytax error in it maybe or maybe move the starting of the thread to after level waittill spawn
testhud
Posted: Sun Apr 18, 2004 10:42 am
by tltrude
I couldn't get it to work either, so I changed it to the right center of the screen and took the premature "end" out of the urc text. Works now.
Code: Select all
menu "mystatbar" 128 136 NONE 0
bgcolor 0 0 0 0
fgcolor 1 1 1 1
align right center
//==============================
// Backdrop
resource
Label
{
name "Default"
rect 16 56 16 64
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
shader textures/hud/healthback
}
//==============================
// Meter
resource
Label
{
name "test bar"
rect 16 56 16 64
fgcolor 1.00 1.00 1.00 1.00
bgcolor 0.50 0.50 0.50 0.00
borderstyle "NONE"
linkcvar "testbar"
statbar vertical 0 20 //statbar horizontal 0 100
statbar_shader textures/hud/healthmeter
statbar_shader_flash textures/hud/healthmeterflash
initdata 20
}
//==============================
// Name
resource
Label
{
name "test number"
title "Fuel"
rect 40 82 64 16
fgcolor 0.70 0.60 0.05 1.00
bgcolor 0.00 0.00 0.00 0.00
borderstyle "NONE"
textalign left
font facfont-20
}
//==============================
// Number
resource
Label
{
name "testnumber"
rect 40 104 64 16
fgcolor 0.70 0.60 0.05 1.00
bgcolor 0.00 0.00 0.00 0.00
borderstyle "NONE"
linkcvar "testbar"
textalign left
font facfont-20
}
end.
I moved the info from prespawn into the thread.
Code: Select all
hudtest:
level.testbar = 20
wait 4
showmenu mystatbar
while(level.testbar > 0)
{
setcvar testbar level.testbar
wait 1
level.testbar--
}
hidemenu mystatbar
end