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!
Huddraw Problem in MP
Moderator: Moderators
precache
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.
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.
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:



