Entity/SetupPhonemeMappings

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Func |Name=SetupPhonemeMappings |Parent=Entity |Description= |Realm=Client |IsClass=Yes }}")
 
(Documented with example.)
Line 2: Line 2:
 
|Name=SetupPhonemeMappings
 
|Name=SetupPhonemeMappings
 
|Parent=Entity
 
|Parent=Entity
|Description=
+
|Description=Initializes the class names of an entity's phoneme mappings (mouth movement data). This is called by default with argument "phonemes" when a flex-based entity (such as an {{Type|NPC}}) is created.
 
|Realm=Client
 
|Realm=Client
 
|IsClass=Yes
 
|IsClass=Yes
 +
}}
 +
{{Arg
 +
|type=string
 +
|name=fileRoot
 +
|desc=The file prefix of the phoneme mappings (relative to "garrysmod/expressions/").
 +
}}
 +
{{Example
 +
|Description=Defines a function that can enable or disable phoneme mappings on an entity.
 +
|Code=-- Turn phoneme mappings on or off
 +
function EnablePhonemes(ent, on)
 +
 +
if(!IsValid(ent)) then return end
 +
 +
if(!on) then
 +
-- Disable mouth movement
 +
ent:SetupPhonemeMappings("")
 +
else
 +
-- Enable mouth movement
 +
ent:SetupPhonemeMappings("phonemes")
 +
end
 +
 +
end
 
}}
 
}}

Revision as of 20:56, 28 September 2014

 Entity:SetupPhonemeMappings( )

Contents

Description

Initializes the class names of an entity's phoneme mappings (mouth movement data). This is called by default with argument "phonemes" when a flex-based entity (such as an NPC) is created.

Arguments

string fileRoot

The file prefix of the phoneme mappings (relative to "garrysmod/expressions/").

Examples

Example

Defines a function that can enable or disable phoneme mappings on an entity.

-- Turn phoneme mappings on or off
function EnablePhonemes(ent, on)

	if(!IsValid(ent)) then return end
	
	if(!on) then
		-- Disable mouth movement
		ent:SetupPhonemeMappings("")
	else
		-- Enable mouth movement
		ent:SetupPhonemeMappings("phonemes")
	end

end


Personal tools
Navigation