BroadcastComms MFD
Contents
Overview
This OXP provides a means by which the player can communicate in a real way with other ships. That is, the types of communications the player transmits will have a bearing on the game in some way, depending on the transmission type
There are 9 types of transmissions:
- Requests for wormholes (broadcast ie. to all ships in range)
This transmission asks if anyone is going to your hyperspace destination. The message is only available if a destination has been set and the players status is not "red".
Ships can respond in three ways: (a) Not at all. (b) By telling the player they are headed somewhere else, or (c) by telling the player they are heading to the players destination.
This message can be sent repeatedly. - Send distress message (broadcast ie. to all ships in range)
This transmission requests immediate assistance against attackers. NPC ships may or may not choose to help.
Only available when the player ship is under attack.
This message can be sent repeatedly. - Send greeting to target
This transmission sends a basic "Hello" message to the ship the player is targeting. The other ship may choose to respond or not. Once a response has been received from the other ship, no further greetings can be sent to that ship. - Send taunt to target
This transmission sends a taunt to the other ship, and the other ship may or may not respond. But regardless of a verbal response, the other ship may do one of the following:
(a) Nothing at all
(b) If they are currently attacking the player, they might get angry and their accuracy might decrease for a few seconds, or increase for a few seconds.
(c) If they are not targeting the player at the moment, they might choose to start targeting the player instead.
Multiple taunts can be sent to other ships. - Issue threat to target
This transmission issues a threat to the other ship. Depending on who that ship is targeting, the response may be different:
(a) If the other ship is targeting the player, there is a small chance they might choose to flee.
(b) If the other ship is not targeting the player, they will possibly choose to attack the player.
Only one threat can be issues to a ship. - Offer bribe to target/Offer bribe to nearest attacker
This transmission offers money to a ship that is attacking the player. That ship can respond in a two ways.
(a) They can reject the offer. The amount the player can offer will then increase by a factor of 2 or 2.5 and the player can then try the bribe again if they wish. If the amount of bribe increases beyond the players current credit balance, the offer to bribe will be removed.
(b) They can accept the bribe. In this case, the bribe amount is deducted from the player bank account, and the ship targeting the player will break off their attack. If they are part of a pirate band, the pirate who accepted the bribe will share the spoils and they will all break off their attack.
If the attacking ship is targeted by the player, they will see the next bribe amount in the message text when selecting the message. If the player doesn't have a target (for instance, they are fleeing from a group of ships), the bribe amount will only be displayed when the transmission takes place. This is because it is not known who is the closest attacking ship until the transmission occurs, and the bid amounts are stored for each pirate group or ship. If a ship from one pirate group moves closer than another pirate group, the amount of the bribe will be adjusted accordingly. - Demand cargo from target
This transmission sends a demand for cargo to the other ship. They can either accept or reject the demand. If they accept the demand, they will drop some cargo and flee. If this action is performed in sight of a police vessel or the main station, there is a chance the victim will report the crime and the player will receive an increase to their offender status. - Surrender to target/Surrender to nearest attacker
This transmission sends a surrender message another ship. There is a small chance the attackers might accept the surrender. In that case they will stop attacking the player and wait for the player to dump some cargo. If the player doesn't dump any cargo, the pirates will start attacking the player again. If the player decides to use the lull in hostilities to start attacking the ships the pirates will get really angry and get a temporary boost in their accuracy. - Offer to rescue escape pod (only if fuel scoop is fitted)
This sends a message to the targeted escape pod, asking the occupant if they would like to be scooped and returned to the main station. Commanders should check that they have available cargo space before scooping escape pods.
Usage
The BroadcastComms MFD is available for purchase for 200CR at all stations, regardless of techlevel.
After displaying the BroadcastComms MFD and priming it, press the "b" (Mode) key to select a message from the available options.
The selected message is marked with a ">" in the MFD.
You don't need the BroadcastComms MFD to be visible, though. There might be situations where it is not be visible, so changes to the selected message will also be displayed as a console message.
Once the desired message is selected, press the "n" (Activate) key to send the message.
External access
Provision has been made for other OXP's to access the comms features in this OXP. There are two methods that can be used:
var w = worldscripts.BroadcastCommsMFD; w.$createMessage(messageName : string, callbackFunction : Function, displayText : string, messageText: string, ship : Ship,
shipDisplayName : string, transmissionType : string, deleteOnTransmit : Boolean, delayCallback : integer);
Calling this function will add the message to the display that will be displayed when the conditions are met.
- messageName = The name of this message, internally used for identification purposes. Can be any text. It is recommended to prefix the message name with the name of your worldscript to prevent the possibility of duplicate message names.
- callbackFunction = the function to call when the player transmits the message.
- displayText = The message text to display
- messageText = The message text that will be transmitted, if different to the display text.
- ship = reference to a ship object for a ship-to-ship transmission. Player must target the ship for the message to become available.
Can be null, and if transmission type is "target" this will create a message that can be sent to any targeted ship.
Will be ignored if transmission type is "broadcast". - shipDisplayName = display name of a ship for a ship-to-ship transmission. Player must target the ship for the message to become available.
Alternate method of targeting a specific ship, if the ship object is not available.
Will be ignored if transmission type is "broadcast". - transmissionType = transmission type, either "broadcast" (ie. transmitted to all ships) or "target" (the ship targeted by the player)
Including a ship property necessitates a "target" value here. Specifying "broadcast" will over override ship reference.
If not set, will default to "broadcast". - deleteOnTransmit = Boolean value indicating that the message will be removed from the list as soon as the player transmits it. If not set will default to true.
- delayCallback = integer value indicating how long (in seconds) to take before calling the callback function. A value of 0 (zero) means immediately. If not set will default to 0.
Special case: If the displayText starts with any type of bracket (ie. "(", "{", "<" or "[") there will be no external transmission. That is, the callback function will be called, but there will be no comms messages sent to any ships. An external OXP can use this option to, for example, switch comms modes between a specialised set of comms messages, and the standard set.
var w = worldScripts.BroadcastCommsMFD; w.$updateMessage(messageName : string, displayText : string, messageText : string, callbackFunction : Function, deleteOnTransmit : boolean, delayCallback : integer);
This function will update the settings of a particular message.
- messageName = the name of the message that will be updated
- displayText = The new message text to be displayed, otherwise null if not being changed.
- messageText = The new message text that will be transmitted, otherwise null if not being changed.
- callbackFunction = The new function to call when the player transmits the message, otherwise null if not being changed.
- deleteOnTransmit = boolean value indicating that the message will be removed from the list as soon as the player transmits it. Null if not being changed.
- delayCallback = integer value indicating how long (in seconds) to take before calling the callback function. A value of 0 (zero) means immediately. Null if not being changed.
var w = worldScripts.BroadcastCommsMFD; w.$checkMessageExists(messageName : string);
This function returns true if messageName exists, otherwise false.
- messageName = the name of the message that will be searched for
var w = worldScripts.BroadcastCommsMFD; w.$removeMessage(messageName : string);
Calling this function will remove the message from the list. Only messages created via the "$createMessage" function can be removed.
- messageName = The name of the message that will be removed
var w = worldScripts.BroadcastCommsMFD; w.$disableMessage(msgid : int);
This function disables one or all of the internal messages, preventing it from being displayed
- msgid = The ID of the internal message that will be disabled, where
- 0 - all
- 1 - request for wormhole
- 2 - send distress message
- 3 - send greeting
- 4 - send taunt
- 5 - send threat
- 6 - offer bribe
- 7 - demand cargo
- 8 - surrender to target
- 9 - offer to rescue escape pod
var w = worldScripts.BroadcastCommsMFD; w.$enableMessage(msgid : int);
This function enables one of all of the internal messages (if they have been disabled by the $disableMessage function), allow it to be displayed
- msgid = The ID of the internal message that will be enabled, where
- 0 - all
- 1 - request for wormhole
- 2 - send distress message
- 3 - send greeting
- 4 - send taunt
- 5 - send threat
- 6 - offer bribe
- 7 - demand cargo
- 8 - surrender to target
- 9 - offer to rescue escape pod
var w = worldScripts.BroadcastCommsMFD; w.$isMessageEnabled(msgid : int);
This function is used to determine if an internal message is enabled or if it has been disabled.
Returns true if message is enabled, otherwise false.
Passing msgid value of 0 will check if all messages are enabled. Only returns true if all messages are enabled. Otherwise false.
- msgid = The ID of the internal message that will be evaluated.
Examples
var w = worldScripts.BroadcastCommsMFD; w.$createMessage(this.name + "myMessage1", this.$broadcastCallback.bind(this), "Evacuation message", "Attention all ships. Please evacuate the area and move to a safe distance.", null, "", "broadcast", true, 4);
This example adds a broadcast message to the display. It will be removed when transmitted, and it will take 4 seconds for the callback function "this.$broadcastCallback.bind(this)" to be executed.
var w = worldScripts.BroadcastCommsMFD; w.$createMessage(this.name + "myMessage2", this.$targetCallback.bind(this), "Ask native question", "Are you a native of these parts?", myShip, "", "target", false, 0);
This example adds a target-specific message to the display, to be shown when the ship object "myShip" is targeted by the player. It will be not removed when transmitted and the callback function this.$targetCallback.bind(this)" will be executed immediately
var w = worldScripts.BroadcastCommsMFD; w.$removeMessage(this.name + "myMessage2");
This example will remove the message "myMessage2" from the list of external messages.
var w = worldScripts.BroadcastCommsMFD; w.$disableMessage(0);
This example will disable all internal messages, leaving only the external messages to be displayed.
var w = worldScripts.BroadcastCommsMFD; w.$disableMessage(3);
This example will disable the "Send greeting to target" message.
var w = worldScripts.BroadcastCommsMFD; w.$enableMessage(0);
This example will enable all internal messages.
var w = worldScripts.BroadcastCommsMFD; w.$enableMessage(3);
This example will enable the "Send greeting to target" message.
External messages, and the status of internal messages, are cleared each time the player loads from a saved game. If a persistent message needs to be shown, or if the status of internal messages needs to be changed in an ongoing manner, ensure the changes are made after the player loads from a saved game.
Installation
Place the 'BroadcastCommsMFD.oxz' into your 'AddOns' folder and when you start the game, hold down 'Shift' until you see the spinning Cobra.
Alternatively, you can download the expansion using the expansion pack manager in the game itself.
Requirements
This expansion pack relies on having multi-function displays available in your HUD. You must at least be using Oolite version 1.79, and your HUD must have at least 1 MFD defined.
Download
Download v1.0.13 BroadcastCommsMFD.oxz (downloaded 6129 times).
Alternative download for the OXZ from box.com
To download this as a OXP inside a ZIP file, click [url=https://app.box.com/s/h3rxaf3oarvhodheupx9]here.[/url] You will need to extract the OXP folder to your AddOns folder to use this option.
Licence/Author
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
The expansion pack was developed by phkb and zireal.
With thanks to: cim, Norby, Wildeblood for their suggestions and fixes.
Version History
Version 1.0.13
- Bug fixes and code refactoring
- Removed the "Answer distress call" message, as it never gets triggered
- Added the "Offer to rescue escape pod" message
- Added facility where messages starting with a bracket (ie. "(", "{", "<" or "[") don't get a message transmitted, although the callback function will still be called. This allows the MFD to used like a menu system. For instance, an OXP could add an item called "(Switch to special comms mode)". When the player executes that option, the OXP could disable all the default messages, and display a new, custom list, with an extra item called "(Switch to normal comms mode)" which then renables all then standard comms messages.
- Changed the initial bribe amunt to 1 credit, based on the reasoning that 1 CR = 1/2 ton of food, therefore is a considerable amount
Also, this means there are more chances the pirates will accept a lower amount of bribe, thus making it more useful.
Version 1.0.12
- Added "Send bribe to closest target" and "Surrender to closest target" messages, for when the player doesn't have a target but is under attack.
Thanks for Norby for the suggestions. - Added the $disableMessage, $enableMessage, and $isMessageEnabled external functions, so that OXP developers can disable the standard internal messages, either individually or all of them.
Quick Facts
Version | Released | License | Features | Category | Author(s) | Feedback |
---|---|---|---|---|---|---|
1.0.13 | 2015-07-15 | CC BY-NC-SA 4.0 | Hud MFD | HUDs OXPs | phkb, zireal | Oolite BB |