Many stations have a place for the player to acquire missions. For example, when the player visits the Main Hall on a Commonwealth station, they sometimes get a mission. If a mission is not available, then the player might get a rumor instead: text or dialog about a related subject.
This article describes how to create rumors in extensions.
Core Concepts
A rumor is a piece of text or dialog with an attribute, a priority, and an optional action.
At various places in the game, such as when the player sits at a bar, we search for an appropriate rumor. The search is based on attribute criteria. For example, the pub at a Commonwealth metropolis looks for rumors with the commonwealthPub attribute.
Any number of rumors may have the same attribute. We pick a random rumor out of all the rumors that match our criteria. Rumors with a higher priority have a higher chance of appearing.
After a rumor is displayed to the user, we can execute an optional action, expressed as a TLisp lambda function.
Defining a Rumor
To search for an appropriate rumor, we do the following:
- Call all types at
<GetGlobalRumors>. - Call all active stations in the system at
<GetRumors>. - Call all existing missions at
<GetRumors>.
In all cases we expect the events to return a list of rumor structs. A rumor struct has the following fields:
{
attributes: 'commonwealthPub
priority: 10
textID: 'rumor.lurkingFear
data: { nameOfHorror: "Cthulhu" }
onExitRumor: (lambda (theRumor) ...)
}
attributes: This is a string containing one or more attributes separated by commas.textID: This is the language ID for the rumor text. It must be defined either by the type or the object that returned the rumor.data: Thedatafield is used for translating the text. You may include any required replaceable parameters here.onExitRumor: This is an optional lambda function to evaluate after the rumor is given.
rpgRumorAdd
rpgRumorAdd is a helper function to help you generate the correct rumor struct:
(rpgRumorAdd attrib suffix priority special data)
attrib: The attribute for the rumor, e.g.,commonwealthPub.suffix: An optional suffix for thetextID. The may be a list, to create multiple rumors.priority: The priority for the rumors (defaults to 10).special: An optional lambda function. Or the identifier'scanto reveal the rumor source to the player.data: Data use for translating.
The textID for each rumor is composed from attrib and suffix. For example:
(rpgRumorAdd 'commonwealthPub) ->
textID: 'rumor.commonwealthPub
(rpgRumorAdd 'commonwealthPub 'lurkingFear) ->
textID: 'rumor.commonwealthPub.lurkingFear
(rpgRumorAdd 'commonwealthPub '(lostShip badComms evilTinkers)) ->
textID: 'rumor.commonwealthPub.lostShip
textID: 'rumor.commonwealthPub.badComms
textID: 'rumor.commonwealthPub.evilTinkers