Meteor 2 Scripting Functions
Speech
void sayText(int sourceObjectID, string text, string overrideSoundName, bool allowConcurrent)
Display a text message as if the object is speaking and optionally play speaking sound effect.

Example
// example using predefined string and automatic sound name
sayText(1, sayTextContact, "", false);

// example using custom string (no sound)
sendRadioMessage(1, "Aloha", "", true);

// example using custom string and custom sound
sendRadioMessage(1, "Baaaah", "objects\\sheep", true);

Comments
Players cannot speak (this function has no effect on players).
This function can be called from server or client and it automatically replicated.
text paremeter can be any text or a predefined string (see list below).
overrideSoundName can be left blank to display text only or automatically pick a sound when using a predefined string in the text parameter.
set allowConcurrent to false to skip saying the text if someone else nearby is speaking (nearby is less than getSkipRadioRange() in metres).
As only players can see/hear messages, this function automatically aborts if no players are nearby to reduce network packets.

Predefined say strings:
sayTextReady
sayTextHoldingPosition
sayTextMoving
sayTextFollowing
sayTextCannotMove
sayTextAttacking
sayTextContact
sayTextClear
sayTextEnemyKilled
sayTextHealthLow
sayTextReloading
sayTextManDown
sayTextMoveIt

Predefined strings can be customised for mods in game.ini

int getVoiceNumber(int gameObjectID)
Get an object's voice number.

Example
// print voice number for object ID 10
print(getVoiceNumber(10));

See also
setVoiceNumber

void setVoiceNumber(int gameObjectID, int voiceNumber)
Set an object's voice number (server only).

Example
// set voice number for object ID 10 to 1
setVoiceNumber(10, 1);

Comments
Voice numbers are randomised when objects are created, use this function to set a specific voice for an object.
See sub-folders in base\sound\Voices\ for a list of voice numbers.

See also
getVoiceNumber

bool getAnnouncementsEnabled()
Determine if annoucements are enabled for the current mission.

Example
print(getAnnouncementsEnabled());

See also
setAnnouncementsEnabled

void setAnnouncementsEnabled(bool enable)
Enable or disable annoucements (server only).

Example
// enable announcements
setAnnouncementsEnabled(true);

Comments
Announcements are when friendly units announce contacts etc by speaking.
Announcements are enabled by default.
Resets to default on the next mission.
If the "Characters announce contacts" user option is disabled no announcements will be played at all.

To disable announcements for a specific character set the "m2_can_announce" variable to false.
e.g. setVar(objectID, "m2_can_announce", false, true);

See also
getAnnouncementsEnabled setVar


Index