OnEntitySoundEnd
A sound of PlayEntitySound or PlaySoundAt is over.
reason says why: "finished" (it played to its end), "stopped" (StopSound, StopEntitySounds) or
"removed" (its actor or entity was destroyed). A loop ends only when it is stopped. Chain a conversation of your own
recordings here.
Syntax
Section titled “Syntax”function OnEntitySoundEnd(id, sound, file, reason) -- ...end| Parameter | Type | |
|---|---|---|
id |
number | the actor or entity it played at; 0 for a sound at a place |
sound |
number | the sound’s id, as PlayEntitySound returned it |
file |
string | the file’s path in the sounds folder |
reason |
string | "finished", "stopped" or "removed" |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”-- a herald's lines one after anotherlocal lines, next = {"herald_01.ogg", "herald_02.ogg", "herald_03.ogg"}, 1function OnEntitySoundEnd(id, sound, file, reason) if id == herald and reason == "finished" and next <= #lines then PlayEntitySound(herald, lines[next], {range = 40}) next = next + 1 endendSee also
Section titled “See also”PlayEntitySound · PlaySoundAt · StopSound · the Sound files group of the index
