Meteor 2 Scripting Functions
Radio
void sendRadioMessage(int senderObjectID, int targetObjectID, string message, float chatterDuration=-1, float delaySeconds=0)
Send a radio transmission from the specified unit.

Example
// example using predefined string
sendRadioMessage(PLAYER_OBJECT, -1, radioTextFirstContact);

// example using custom string
sendRadioMessage(PLAYER_OBJECT, -1, "Aloha");

Comments
senderObjectID must be a valid unit and the sender must have a radio (or be player in a vehicle with a radio).
targetObjectID is not required and can be -1.
message can be any text or a predefined string (see list below).
chatterDuration is optional and defaults to -1 (use default).
delaySeconds is optional and delay sending the transmission. If not specified delaySeconds defaults to 0 (send now).

Vehicles can transmit further than infantry (map radio range * 2).
Sending too many transmission can cause an enemy airstrike on the sender's position.
Use the Radio power-up/item or setUnitHasRadio(PLAYER_OBJECT, true); script command to give the player a radio for the duration of the level.

Predefined strings (some affect how transmissions are replied to, most do not):
radioTextRequestSitrep
radioTextReplySitrep
radioTextRequestAssist
radioTextFirstContact
radioTextCallingNearBases
radioAnnounceContact
radioTextYes
radioTextNo
radioTextSayAgain
radioTextRequestPingComms
radioTextRequestSupplyDrop
radioTextTransmitterAutomatedBroadcast
radioTextRequestEvac
radioTextMaydayGoingDown
radioTextSuppliesDropped
radioTextSupplyPlaneCalloutSmoke
radioTextSupplyPlaneDropInbound

void getUnitHasRadio(bool hasRadio)
Determine if the specified unit has a radio.

Example
bool playerHasRadio = getUnitHasRadio(PLAYER_OBJECT);
print("playerHasRadio = " + playerHasRadio);

See also
setUnitHasRadio getUnitRadioRange

void setUnitHasRadio(bool hasRadio)
Give or take a radio from the specified unit.

Example
// give player radio
setUnitHasRadio(PLAYER_OBJECT, true);
print("playerHasRadio = " + getUnitHasRadio(PLAYER_OBJECT));

Comments
Server only.
Works for any unit or player.

See also
getUnitHasRadio getUnitRadioRange

float getUnitRadioRange()
Get the current radio range on the specified unit in metres.

Example
// print player radio range
print("Player radio range = " + getUnitRadioRange(PLAYER_OBJECT));

Comments
Returns 0 if the unit does not have a radio.

See also
getUnitHasRadio setUnitHasRadio

float getRadioRange()
Get the current radio range in metres.

Example
// print current mission radio range
print("Radio range = " + getRadioRange());

See also
setRadioRange

void setRadioRange(float rangeMetres)
Set the current radio range in metres.

Example
// change current mission radio range to 600 metres
setRadioRange(600);
print("Radio range = " + getRadioRange());

// change current mission radio range to 5000 pixels
setRadioRange(5000 / PIXELS_PER_METRE);
print("Radio range = " + getRadioRange());

Comments
Server only.
Radio range is set per map and resets the map is changed. Increase for larger maps.
Infantry units can transmit for this range, vehicles can transmit at twice this range.

See also
getRadioRange

float getSkipRadioRange()
Get the miniumum distance in metres that nearby units use the radio.

Example
// print current mission skip radio range
print("Skip radio range is " + getSkipRadioRange());

See also
getSkipRadioRange

void setSkipRadioRange(float skipRangeMetres)
Set the miniumum distance in metres that nearby units use the radio.

Example
// change current mission radio range to 50 metres
setSkipRadioRange(50);
print("Skip radio range changed to " + getSkipRadioRange());

Comments
Server only.
Units closer than this distance will not radio the player directly. Instead a message appears on screen as if they are speaking.

See also
getSkipRadioRange

bool getRadioAirstrikesEnabled()
Determine if radio random enemy airstrikes are enabled.

Example
print(getRadioAirstrikesEnabled());

See also
setRadioAirstrikesEnabled

void setRadioAirstrikesEnabled(bool enable)
Enable or disable random enemy airstrikes if the radio is used too much during the daytime.

Example
// disable radio airstrikes
if(isServer())
{
    setRadioAirstrikesEnabled(false);
}

Comments
Server only.
Radio airstrikes are enabled by default.

See also
getRadioAirstrikesEnabled


Index

Generated on the 24 June 2024 at 06:55:37 (UK Time)