Adding Voice To Scratch SDK

From Valve Developer Community
Jump to: navigation, search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Dead End - Icon.png
This article has no links to other VDC articles. Please help improve this article by adding links that are relevant to the context within the existing text.
January 2024


If you start a Scratch SDK Project you will notice voice chat does not work or the icon will not show on the HUD, to fix:

Steps

1. Add hud_voicestatus.cpp to the clientside project

2. Add this to scripts/HudLayout.res in your steam directory

	HudVoiceSelfStatus
	{
		"fieldName" "HudVoiceSelfStatus"
		"visible" "1"
		"enabled" "1"
		"xpos" "r43"
		"ypos" "355"
		"wide" "24"
		"tall" "24"
	}

	HudVoiceStatus
	{
		"fieldName" "HudVoiceStatus"
		"visible" "1"
		"enabled" "1"
		"xpos" "r200"
		"ypos" "0"
		"wide" "100"
		"tall" "400"

		"item_tall"	"24"
		"item_wide"	"100"

		"item_spacing" "2"

		"icon_ypos"	"0"
		"icon_xpos"	"0"
		"icon_tall"	"24"
		"icon_wide"	"24"

		"text_xpos"	"26"
	}

3. Make a file scripts/modtextures.txt and put this inside it:

"sprites/640_hud"
{
	TextureData
	{
		"voice_player"
		{
				"file"		"voice/icntlk_sv"
				"x"		"0"
				"y"		"0"
				"width"		"32"
				"height"	"32"
		}
		"voice_self"
		{
				"file"		"voice/icntlk_local"
				"x"		"0"
				"y"		"0"
				"width"		"32"
				"height"	"32"
		}
			
	}	
}

Extra Notes

If voice transmission to other players isn't working you need to make sure that the GameRules class calls BaseClass::Think()

Thanks go to Rek55 and Tony Sergi.