Page 1 of 1

Huddraw Problem in MP

Posted: Sat Apr 08, 2006 4:35 pm
by ubereddie
Hey everyone, I've been coming to this site quite a bit in the past few months and I must say it's been super helpful. Anyways, I'm creating some single player maps involving some custom hud graphics in MOHAA:Spearhead. The maps I'm creating are designed to show off some 3rd person, platformer style gameplay, so I modded the mike_legs.st state file and changed sv_gravity to allow the player to jump higher. However, the player would get hurt everytime he lands, so after banging my head up against the wall trying to fix that, I just decided I would run the game in multiplayer (g_gametype 1) with the dmflags set to 8 so that the player wouldn't be hurt on landing. Luckily, it seems that most of my scripting geared for single-player works fine in a multiplayer environment, except for one nagging thing...

My custom hud graphics (which basically opens up a text box that is designed to look like black text on a scroll of parchment) work fine in sp, but when I run the map in mp, the first time through. the huddraw commands are not executing (it's not setting the position, font colors, etc..). I can get it to work in mp if I type in a "restart" command into the console, but I want it to work right the first time I load the map as it does in SP, without having to restart the map.

Here's the pertinent script excerpt.

main:

exec global/auto.scr
level waittill prespawn

level.script = maps/test_amphitheatre.scr
setcvar "dmflags" "8"
setcvar "ui_compass" "0"
setcvar "cg_3rd_person" "1"


// LEVEL INIT THREADS

level waittill spawn

waitthread hud_init

end

hud_init:
huddraw_virtualsize 199 1
huddraw_align 199 left center
huddraw_rect 199 80 160 480 120
huddraw_color 199 1.0 1.0 1.0
huddraw_shader 199 "textures/parchment"
huddraw_alpha 199 0.0

huddraw_virtualsize 200 1
huddraw_align 200 left center
huddraw_font 200 "handle-16"
huddraw_rect 200 100 110 0 0
huddraw_color 200 0.0 0.0 0.0
huddraw_alpha 200 0.0
end

and here's the threads that are run when the player enters and leaves a trigger that displays the hud elements

hud_fade_in:
for (local.i = 0; local.i <= 1; local.i += .1)
{
huddraw_alpha 199 local.i
huddraw_alpha 200 local.i
waitframe
}
end

hud_fade_out:
for (local.i = 1; local.i >= 0; local.i -= .1)
{
huddraw_alpha 199 local.i
huddraw_alpha 200 local.i
waitframe
}
huddraw_string 200 ""
end

I've been poring through the forums for similar topics and it seems like huddraw commands just "work" in mp just fine....Can anyone shed some light on this? Thanks so much in advance!

precache

Posted: Sat Apr 08, 2006 7:04 pm
by tltrude
With it working on restart, I'd say it is a problem with when the new images are loaded. Have you tried moving the waitthread to prespawn? Maybe you need to put a "wait 1" line above the waitthread or in the thread itself.

Do you have a precache script to load stuff before the game starts? If not you need to add the standard precache script line.

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr


I don't think that Auto script is needed for multiplayer, but I could be wrong.

Posted: Sun Apr 09, 2006 9:04 am
by Ric-hard
Hi, u need to update your hud_init-thread when a new player joins, the easy way is to loop it every 10th second or so.

/Richard

Posted: Sun Apr 09, 2006 5:28 pm
by ubereddie
Thanks, just putting a wait 1 in the first line of the hud_init script did the trick - who would've thought? Thanx so much, you guys rock.

Posted: Mon Apr 10, 2006 6:01 pm
by LeBabouin
And your setcvar "cg_3rd_person" "1" , does it work ?

Posted: Mon Apr 10, 2006 8:31 pm
by Green Beret
Good question, Cause i thought 3rd person didnt work with 1.11?

Posted: Mon Apr 10, 2006 8:57 pm
by Rookie One.pl
So you were wrong because it does.

Posted: Wed Apr 12, 2006 8:52 pm
by LeBabouin
setcvar "cg_3rd_person" "1" doesn't do anything on me, in BT. grrr