Huddraw Problem in MP

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
ubereddie
Private
Posts: 2
Joined: Sat Apr 08, 2006 4:02 pm

Huddraw Problem in MP

Post 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!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

precache

Post 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.
Tom Trude,

Image
Ric-hard
Sergeant Major
Posts: 102
Joined: Sun Feb 29, 2004 6:44 am
Location: sweden
Contact:

Post 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
ubereddie
Private
Posts: 2
Joined: Sat Apr 08, 2006 4:02 pm

Post 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.
LeBabouin
Lance Corporal
Posts: 22
Joined: Tue Jun 21, 2005 11:10 pm

Post by LeBabouin »

And your setcvar "cg_3rd_person" "1" , does it work ?
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

Good question, Cause i thought 3rd person didnt work with 1.11?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

So you were wrong because it does.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
LeBabouin
Lance Corporal
Posts: 22
Joined: Tue Jun 21, 2005 11:10 pm

Post by LeBabouin »

setcvar "cg_3rd_person" "1" doesn't do anything on me, in BT. grrr
Post Reply