Problem with adding HUD for weapon count
by Logan Strunk · in Torque Game Engine · 03/25/2006 (11:45 am) · 3 replies
Me and some friends are creating a FPS game. I was tasked with all the scripting and C++ duties while they get off easy with the art, haha.
Anyways, I followed this guide: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1786
To get an ammo counter HUD up. I wanted to learn how it worked before I changed it around for myself.
I ran into one glitch and I can't seem to solve it. The HUD itself works beautifully, but for some reason, now when ever I run out of ammo (ammo counter reads nothing) the crossbow will still make explosion noises.
Its rather strange. Any ideas of what I could have messed up to make it do that?
Anyways, I followed this guide: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1786
To get an ammo counter HUD up. I wanted to learn how it worked before I changed it around for myself.
I ran into one glitch and I can't seem to solve it. The HUD itself works beautifully, but for some reason, now when ever I run out of ammo (ammo counter reads nothing) the crossbow will still make explosion noises.
Its rather strange. Any ideas of what I could have messed up to make it do that?
#2
I'm going to awnser my own post, because the solution came to me like 30 seconds after I posted. I'm sorry guys.
Anyways, all I did was comment out this line in the crossbow.cs:
datablock AudioProfile(CrossbowExplosionSound)
{
//filename = "~/data/sound/crossbow_explosion.ogg"; <- THAT LINE
description = AudioDefault3d;
preload = false;
};
and changed preload to false (no sense in taking up extra memory when its not being used)
That solved the problem. Most likely its getting called somewhere where it shouldn't be, but without the sound present, it made the problem go away. Most likely a bad hack, but it solved the problem.
C2, your right, it is wierd, that sometimes I change things not related at all to the sounds, but automagically they break, and when I change it back, they work again. Its usually been this explosion sound too. Is that just a problem with the sound engine? Or the fact that they are compressed as OggVorbis? I've not worked with .oggs very much, but I know they are more or less like .mp3, just without the licensing issues .mp3 has.
Whatever it is, its strange.
03/25/2006 (11:50 am)
Hmm, wow, I feel like an idiot.I'm going to awnser my own post, because the solution came to me like 30 seconds after I posted. I'm sorry guys.
Anyways, all I did was comment out this line in the crossbow.cs:
datablock AudioProfile(CrossbowExplosionSound)
{
//filename = "~/data/sound/crossbow_explosion.ogg"; <- THAT LINE
description = AudioDefault3d;
preload = false;
};
and changed preload to false (no sense in taking up extra memory when its not being used)
That solved the problem. Most likely its getting called somewhere where it shouldn't be, but without the sound present, it made the problem go away. Most likely a bad hack, but it solved the problem.
C2, your right, it is wierd, that sometimes I change things not related at all to the sounds, but automagically they break, and when I change it back, they work again. Its usually been this explosion sound too. Is that just a problem with the sound engine? Or the fact that they are compressed as OggVorbis? I've not worked with .oggs very much, but I know they are more or less like .mp3, just without the licensing issues .mp3 has.
Whatever it is, its strange.
#3
03/25/2006 (11:54 am)
Mp3s are unsupported in TGE, so they're not an option. There's been problems with some .ogg files hopping around different sound profiles; it's odd, but it is a bug.
Torque Owner Chris Byars
Ion Productions