Dialogue
In Staxel, there are two files which are used to specify all villager dialogue in game. These files are the *.dialogue files which point to an associated .json file that was created using Yarn.
Contents
- 1 *.dialogue File
- 2 The Yarn *.json file
- 3 Additional Dialogue Functions
- 3.1 Branching Functions
- 3.1.1 branchAchievementNotCompleted
- 3.1.2 branchAndLoadMissingCriticalTotem
- 3.1.3 branchBuildingHasExisted
- 3.1.4 branchCurrentSeasonIs
- 3.1.5 branchMissingTotem
- 3.1.6 branchNotServerOwner
- 3.1.7 branchPlayerCantAffordItem
- 3.1.8 branchPlayerDoesntHaveItemOfCategory
- 3.1.9 branchPlayerDoesntHaveEnoughOfItem
- 3.1.10 branchPlayerDoesntHavePlayerItem
- 3.1.11 branchPlayerHasItem
- 3.1.12 branchNoVillagerWithPersonality
- 3.1.13 branchNoVillagerWithName
- 3.1.14 branchValidStructureExists
- 3.1.15 BranchValidStructureExistsWithTier
- 3.2 Dialogue Control Functions
- 3.3 Useful Functions
- 3.3.1 adjustReputation
- 3.3.2 emote
- 3.3.3 giveItemToPlayer
- 3.3.4 giveItemToPlayerIfDoesntHave
- 3.3.5 giveItemToPlayerIfCantAfford
- 3.3.6 givePlayerPetals
- 3.3.7 givePlayerPetalsIfInsufficient
- 3.3.8 giveUnlockedAchievementRewards
- 3.3.9 loadItemBuyPrice
- 3.3.10 loadRandomNumber
- 3.3.11 loadTotemExistence
- 3.3.12 loadVillagerName
- 3.3.13 loadVillagerNameForPersonality
- 3.3.14 playExpression
- 3.3.15 playerPurchaseItem
- 3.3.16 moveTo
- 3.3.17 leadTo
- 3.3.18 removePlayerItem
- 3.3.19 removeAllOfPlayerItem
- 3.4 Quest Functions
- 3.5 Villager Arrival Functions
- 3.1 Branching Functions
*.dialogue File
Creating a *.dialogue File
Creating this file is very simple with only two properties. The full file looks like;
{ "code" : "mods.modname.village.character.dialogue.CecileFond", "dialogue" : "staxel/village/character/dialogue/CecileFond.json" }
Both properties are self-explanatory. Make sure the dialogue property points to a file that is created by Yarn otherwise some issues can arise.
Config Options
"code"
Valid options (String): A unique string which dialogue what this object is.
Default Value: No default value is specified. Always need to provide your own.
A string containing the unique identifier of this dialogue. This is commonly only used in Dialogue Pools.
"dialogue"
Valid options (String): A string which contains the path to a Yarn .json file.
Default Value: Null or nothing specified.
A string containing the path of the item the blob will be referring to.
The Yarn *.json file
Yarn is the program which creates the dialogue files for Staxel. It utilises it's own scripting language which can make choices and also use conditional statements in order to provide the right dialogue. They also include an editor which helps visualise these files.
Look at the documentation around Yarn, particularly sections such as this. Do not Yarn is changing frequently and documentation might not line up with the implementation used in Staxel.
Additional Dialogue Functions
These are additional functions that Staxel offers to integrate the dialogue into the game. They range from functions that do decision making to functions which give and take items and money from the player.
Branching Functions
These functions cause the game to go to a different dialogue when a certain condition is met.
branchAchievementNotCompleted
Usage: <<branchAchievementNotCompleted staxel.achievement.PlantCrop PlantingWait>>
Parameter 1: Code of the Achievement you want to check. (e.g. staxel.achievement.PlantCrop)
Parameter 2: Title of the Node to move to.
When this function is hit, it will check if the selected Achievement has been completed. If it has been completed it will continue on normally. If it has not been completed, then it will move to the specified node.
Useful for checking for completed actions, such as checking if the player has placed a Pet House.
branchAndLoadMissingCriticalTotem
Usage: <<branchAndLoadMissingCriticalTotem $ttm $price 1.50 TotemMissing>>
Parameter 1: The name of the variable you want to use to store the totem name. Should start with $.
Parameter 2: The name of the variable you want to use to store the price of the item. Should start with $.
Parameter 3: The premium multiplier. (The price will end up being, the cost of the totem * premium).
Parameter 4: Title of the Node to move to.
When this function is hit, check to see if a critical totem is missing. If so, then load said Totem's name to Parameter 1 and the price (multiplied by Parameter 3) to Parameter 2, then go to the node. If no critical totem is missing, then continue on normally without loading to variables.
branchBuildingHasExisted
Usage: <<branchBuildingHasExisted staxel.totem.workplace.Patisserie Existed>>
Parameter 1: Code of the Totem you want to check. (e.g. staxel.totem.workplace.Patisserie)
Parameter 2: Title of the Node to move to.
When this function is hit, it will check if the specified Totem has been completed at some point (i.e Has been built). If it hasn't then continue on normally. If it has been completed, then move to the specified node.
This is useful for making sure you only talk about buildings that exist or have existed. (Note: Building does need to have been built before. Just placing totem doesn't count.)
If you require that it does exist then check #branchValidStructureExists.
branchCurrentSeasonIs
Usage: <<branchCurrentSeasonIs Summer SummerNode>>
Parameter 1: Summer, Winter, Spring, Autumn
Parameter 2: Title of the Node to move to.
When this function is hit, check to see if the Season matches parameter 1. If so branch, otherwise continue normally.
branchMissingTotem
Usage: <<branchMissingTotem staxel.totem.AirshipLanding HouseMissing false>>
Parameter 1: Code of the Totem you want to check. (e.g. staxel.totem.AirshipLanding)
Parameter 2: Title of the Node to move to.
Parameter 3: Whether or not this totem should have been built to it's lowest tier.
When this function is hit, it will check to see if the totem is missing. If parameter 3 is true, then it will check if the villager has a built totem of this type. If it does continue and if not branch. If parameter 3 is false, then it will check if the totem has either been place or exists in the players inventory. If either of those are true, continue normally and branch if not.
useful for when you want to check if a totem has been lost before giving another totem.
Mainly used by Farm Fan to give the player rewards. Not too useful for other players.=== BranchValidStructureExistsWithTier ===
Usage: <<BranchValidStructureExistsWithTier staxel.totem.AirshipLanding 1 AirshipAvailable>>
Parameter 1: Code of the Totem you want to check. (e.g. staxel.totem.AirshipLanding)
Parameter 1: The lowest Tier of the existing building you want.
Parameter 3: Title of the Node to move to.
When this function is hit, it will search to see if a valid totem of the type specified exists. If it does, check if it has a tier at or higher than specified. If it succeeds, then it will head to the specified node. Otherwise if it does not exist or it's not a high enough tier then continue on normally.
Useful for checking that a building actually exists, and is at a certain tier, before going to it/ talking about it. (e.g. Making a villager complain that a building is not max tier.)
If you want to know that the building existed at some point then head to #branchBuildingHasExisted. Or if you just want it to exist, head to #branchValidStructureExists
branchNotServerOwner
Usage: <<branchNotServerOwner NotOwner>>
Parameter 1: Title of the Node to move to.
When this function is hit, it will check if the player is the server owner. If they are, then it will head to the specified node, otherwise continues on normally.
Mainly used by Farm Fan to make sure that only the server owner gets the tutorial.
branchPlayerCantAffordItem
Usage: <<branchPlayerCantAffordItem item staxel.item.crafting.MugOSap 1 CantAfford>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to buy. (e.g. staxel.item.crafting.MugOSap)
Parameter 3: Number of the item you want the player to buy.
Parameter 4: Title of the Node to move to.
Parameter 5: (Optional) The multiplier to the price. (i.e. 2.00 to make it 2 times as expensive. 0.5 to make it half as expensive.)
When this function is hit, it will check if the player can afford the item. If they can then continue on normally. If they can't then move onto the specified node.
This is useful for checking if the player can actually afford the item.
branchPlayerDoesntHaveItemOfCategory
Usage: <<branchPlayerDoesntHaveItemOfCategory seed PlantingGive>>
Parameter 1: Category to look for for any item in the player's inventory.
Parameter 2: Title of the Node to move to.
When this function is hit, it will check if the player has an item with the specific category. If they do, continue on normally and if they don't, move to the specified node.
This is useful for checking if the player has an item that the NPC wants. (For example, check for seeds so that the tutorial can teach the player how to place them.)
branchPlayerDoesntHaveEnoughOfItem
Usage: <<BranchPlayerDoesntHaveEnoughOfItemstaxel.item.FarmRegistrationLetter 2 GoodBye>>
Parameter 1: Code of the Item you want to check. (e.g. staxel.crop.tomato)
Parameter 2: The minimum number of the item you want.
Parameter 3: Title of the Node to move to.
When this function is hit, it will check if the player has an item of a specific code. If they do check if it meets the minimum requirement, if so continue on normally and if not, move to the specified node.
This is useful for checking if the player has an enough of an item that the NPC wants. (For example, check for seeds so that the tutorial can teach the player how to place them.)
branchPlayerDoesntHavePlayerItem
Usage: <<branchPlayerDoesntHavePlayerItem staxel.item.FarmRegistrationLetter GoodBye>>
Parameter 1: Code of the Item you want to check. (e.g. staxel.crop.tomato)
Parameter 2: Title of the Node to move to.
When this function is hit, it will check if the player has an item of a specific code. If they do, continue on normally and if they don't, move to the specified node.
This is useful for checking if the player has an item that the NPC wants. (For example, check for seeds so that the tutorial can teach the player how to place them.)
branchPlayerHasItem
Usage: <<branchPlayerCantAffordItem item staxel.item.crafting.MugOSap 1 CantAfford>>
Parameter 1: Code of the Item you want to search for. (e.g. staxel.item.crafting.MugOSap)
Parameter 4: Title of the Node to move to.
When this function is hit, it will check if the player has the item. If they do then branch, otherwise continue on normally.
branchNoVillagerWithPersonality
Usage: <<branchNoVillagerWithPersonality staxel.village.personality.Tomboy NoTomboy>>
Parameter 1: Code of the Villager Personality to search for. (e.g staxel.village.personality.Tomboy)
Parameter 2: Title of the Node to move to.
When this function is hit, it will search to see if a villager with the specified personality exists in the world. If they do, continue on normally and if they don't, move to the specified node.
This is useful for when you want to talk about another type of villager that may or may not be in the village.
branchNoVillagerWithName
Usage: <<branchNoVillagerWithName Leif TellRumour>>
Parameter 1: Name of villager to look for.
Parameter 2: Title of the Node to move to.
When this function is hit, it will search to see if a villager with the specified name exists in the world. If they do, continue on normally and if they don't, then move to the specified node.
This is useful for when you want to talk about another specific villager that may or may not be in the village. It is probably better to use #branchNoVillagerWithPersonality as it is more specific.
branchValidStructureExists
Usage: <<branchValidStructureExists staxel.totem.AirshipLanding AirshipAvailable>>
Parameter 1: Code of the Totem you want to check. (e.g. staxel.totem.AirshipLanding)
Parameter 2: Title of the Node to move to.
When this function is hit, it will search to see if a valid totem of the type specified exists. If it does, then head to the specified node otherwise it continues on normally.
Useful for checking that a building actually exists, and is still existing, before going to it/ talking about it.
If you want to know that the building existed at some point then head to #branchBuildingHasExisted.
BranchValidStructureExistsWithTier
Usage: <<BranchValidStructureExistsWithTier staxel.totem.AirshipLanding 1 AirshipAvailable>>
Parameter 1: Code of the Totem you want to check. (e.g. staxel.totem.AirshipLanding)
Parameter 1: The lowest Tier of the existing building you want.
Parameter 3: Title of the Node to move to.
When this function is hit, it will search to see if a valid totem of the type specified exists. If it does, check if it has a tier at or higher than specified. If it succeeds, then it will head to the specified node. Otherwise if it does not exist or it's not a high enough tier then continue on normally.
Useful for checking that a building actually exists, and is at a certain tier, before going to it/ talking about it. (e.g. Making a villager complain that a building is not max tier.)
If you want to know that the building existed at some point then head to #branchBuildingHasExisted. Or if you just want it to exist, head to #branchValidStructureExists
Dialogue Control Functions
These functions determine how the dialogue looks and feels to the player.
lockPlayerInConversation / releasePlayerFromConversation
Usage: <<lockPlayerInConversation>>
or <<releasePlayerFromConversation>>
LockPlayerInConversation forces the player to enter into conversation mode. Conversation mode does several things;
- Stop the player from moving.
- Brings in the black bars
- Focuses player focus onto the NPC
ReleasePlayerFromConversation removes conversation mode from the player. Allowing them to move off and end the conversation. A <<typewriterMode off true true>>
should be placed with this command if <<typewritermode on>>
was present.
This is used for all dialogue that is personal to the player. (i.e. Not merchant chatter.)
moveToNext
Usage: <<moveToNext>>
Proceed to the next Dialogue immediately after displaying. This is mainly used in order to complete conversations properly and not wait for an input. This is because if the dialogue goes to an empty line, it will do a couple things, such as adjust the NPC's reputation.
Not needed if using #typewriterMode as the same thing is done in <<typewriterMode off true true>>.
pickRandomFromDialoguePools
Usage: <<pickRandomFromDialoguePools>>
Make the villager go to a new random Dialogue. This chooses from a number of different dialogues and can be quite complicated to follow. Here are the steps it takes;
- Add any dialogues overrides provided by Festivals to the list of options first.
- If Villager Personalities#"suppressGeneralDialogue" is false and, if overriden by a festival, Festivals#"suppressPersonality" is false then proceed to sub steps.
- If the villager is preparing to leave town and their home is still gone or broken, then immediately return a Random Dialogue that is in a Dialogue Pool with the Dialogue_Pools#"type" leaving.
- If not preparing to leave, check if villager has doesn't have a quest.
- Check to see if Player has finished their Farm License. If not add that to the list of options.
- Add in a Random Dialogue that is in a Dialogue Pool with the Dialogue_Pools#"type" general.
- If the weather has dialogue pools, and it isn't night time. Then add one of those in as well.
- If the player has theft recently, then add in a Random Dialogue that is in a Dialogue Pool with the Dialogue_Pools#"type" theft.
- If the villager is not overriden or if overriden by a festival, Festivals#.22suppressPersonality.22 is false then proceed to sub steps.
- Add in a random Base Unique Dialogue Pool.
- Add in a random Liked Unique Dialogue Pool if high enough reputation.
- Add in a random Fond Unique Dialogue Pool if high enough reputation.
- Add in a random Best Friend Unique Dialogue Pool if high enough reputation.
- Add in a random Villager Personalities#"dialoguePools".
- If season has Dialogue associated with it, add in a random season dialogue.
- If Villager has a Job, is not overriden or if overriden by a festival, Festivals#.22suppressPersonality.22 is false then proceed to sub steps.
- If They are working. That is the time is between their work time. Then continue to sub steps.
- If Workplace is missing then add in a Random Dialogue that is in Villager Jobs#"workPlaceMissingPools" with the Dialogue_Pools#"type" WorkPlaceMissing.
- If it exists, then add in a Random Dialogue that is in Villager Jobs#"dialoguePools" with the Dialogue_Pools#"type" Job.
- If They are working. That is the time is between their work time. Then continue to sub steps.
- If the villager does not have a job, is not overriden or if overriden by a festival, Festivals#.22suppressPersonality.22 is false then add in a Random Dialogue that is in a Dialogue Pool with the Dialogue_Pools#"type" Unemployed.
- With that, choose a random dialogue out of all of the dialogues added.
TLDR: Choose a random dialogue based on a lot of circumstances, with special attention being paid to Festivals overriding dialogue.
This is most often used by Workers, as they have their working dialogue prioritised. This allows them to still use their personality even while working. (For examples look at Mayor Dialogue and Mechanic Dialogue.)
pickRandomLine
Usage:
<<pickRandomLine>> This is line 1. This is line 2. <<flushRandomLine>>
Choose a single line, from a number of text only lines, randomly up either up to the end of the node or up to the command <<flushRandomLine>>. Used to select either a random section of text so that it doesn't repeat the same text too often.
pickRandomPath
Usage:
<<pickRandomPath>> <<NodeName1>> <<NodeName2>> <<flushRandomPath>>
Choose a single line, from a number of node names, randomly up either up to the end of the node or up to the command <<flushRandomPath>>. Used to select a random node to go to so the same section of text isn't repeated often. Less clutter, in the one node, than #pickRandomPath when dealing with larger conversations.
resumeProgress
Usage: <<resumeProgress>>>>
Resume the last node that was saved for the current player. If there is no saved value or if saved value is the "Start" node then continue on the current node.
saveProgress
Usage: <<saveProgress>> or <<saveProgress NodeA>>
Parameter 1: The title of the node to save. (Skipping means the last node is saved.)
This saves the current node to a variable which is then stored. Useful for when a conversation needs to be completed. (e.g. It is used in the tutorial to save the last location Farm Fan was in.)
shuffleNextOptions
Usage: <<shuffleNextOptions>>
Make the next set of options be in a random order when shown to the player.
transitionToNew
Usage: <<transitionToNew>>
Restart the dialogue after finishing.
typewriterMode
Usage: <<typewriterMode on>> or <<typewriterMode off true true>>
Parameter 1: Turn on or off typewriter mode.
Parameter 2: (If Parameter 1 is off) Clear the message so it doesn't stay around. (Set to False to keep messages after this value)
Paremeter 3: (If Parameter 1 is off and Parameter 2 is True) Setting to True lets the current node immediately end without the need to click. (e.g Ending conversation immediately.)
Setting the typewriter to on makes it so text is filtered out a single character at a time instead of the entire message appearing at once. Should be turned off at the end of a conversation (i.e. <<typewriterMode off true true>>) before releasing from conversation.
Useful Functions
These are a collection of functions that will provide useful game benefits. This includes giving items, money and other functions.
adjustReputation
Usage: <<adjustReputation 20>>
Parameter 1: Amount to adjust by.
Adjust the player's reputation with this villager by the amount specified.
emote
Usage: <<emote staxel.emote.ScratchHead>>
Parameter 1: Code of the Emote you want to play. (e.g. staxel.emote.ScratchHead)
Play a specified emote and wait until it is finished.
giveItemToPlayer
Usage: <<giveItemToPlayer item staxel.item.tool.Hoe>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to check and give. (e.g. staxel.item.tool.Hoe)
Parameter 3: (Optional) Number of the item you want to give the player.
Give an item to the player with no checks.
giveItemToPlayerIfDoesntHave
Usage: <<giveItemToPlayerIfDoesntHave item staxel.item.tool.Hoe>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to check and give. (e.g. staxel.item.tool.Hoe)
Parameter 3: (Optional) Number of the item you want to give the player.
Give an item to the player if they do not have the item already.
giveItemToPlayerIfCantAfford
Usage: <<giveItemToPlayerIfCantAfford plant staxel.crop.Tomato>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to check and give. (e.g. staxel.item.tool.Hoe)
Parameter 3: (Optional) Number of the item you want to give the player.
Give an item to the player if they can't afford to buy that item.
givePlayerPetals
Usage: <<givePlayerPetals 42>>
Parameter 1: Amount of Petals to give.
Give the amount of petals specified to the player.
givePlayerPetalsIfInsufficient
Usage: <<givePlayerPetalsIfInsufficient 42>>
Parameter 1: Amount of Petals to check for. Amount of Petals to give.
Give the amount of petals specified to the player if the player does not have the amount or more. (If player has less than 1000 petals, give 1000 petals)
giveUnlockedAchievementRewards
Usage: <<giveUnlockedAchievementRewards>>
Give all the unclaimed items from achievements to the player.
loadItemBuyPrice
Usage: <<loadItemBuyPrice item staxel.item.crafting.MugOSap 1 $sap>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to check and give. (e.g. staxel.item.tool.Hoe)
Parameter 3: Number of the item you want to give the player.
Parameter 4: The name of the variable you want to use. Should start with $.
Calculates the cost of the specified item and places the value into the variable specified.
loadRandomNumber
Usage: <<loadVillagerName 5 $rnd>>
Parameter 1: The maximum random number.
Parameter 2: The name of the variable you want to use. Should start with $.
Chooses a random number between 0-max and saves it to the variable.
Useful for doing random checks in Dialogue. (i.e. <<if $rnd > 2>>
)
loadTotemExistence
Usage: <<loadVillagerName staxel.totem.MechanicHome $rnd>>
Parameter 1: Code of the Totem to search for. (e.g staxel.totem.MechanicHome)
Parameter 2: The name of the variable you want to use. Should start with $.
Searches for a totem with the specified name. If that totem does exist in the village, then sets the variable to 1, else sets to 0.
Useful for doing random checks in Dialogue. (i.e. <<if $rnd > 2>>
)
loadVillagerName
Usage: <<loadVillagerName Cecile $c_name>>
Parameter 1: Name of villager to search for.
Parameter 2: The name of the variable you want to use. Should start with $.
Searches for a villager with the specified name. If that villager does exist, then it places their code name into the target variable.
This is used specifically for loading the right translation for the villager's name. It is probably better to use #loadVillagerNameForPersonality as it is more specific.
loadVillagerNameForPersonality
Usage: <<loadVillagerNameForPersonality staxel.village.personality.Mayor $mayor_name>>
Parameter 1: Code of the Villager Personality to search for. (e.g staxel.village.personality.Mayor)
Parameter 2: The name of the variable you want to use. Should start with $.
Searches for a villager with the specified personality. If that villager does exist, then it places their name into the target variable.
This is used specifically for loading the right translation for the villager's name.
playExpression
Usage: <<emote staxel.expression.Happy>>
Parameter 1: Code of the Expression you want to play. (e.g. staxel.emote.ScratchHead)
Play the specified expression.
playerPurchaseItem
Usage: <<playerPurchaseItem item staxel.item.crafting.MugOSap>>
Parameter 1: Can be item, tilePlacer, plant, recipe or clothing
. Use item for Items. Use tilePlacer for Tiles. Use plant for [[Plants|seeds. Use recipe for Recipes and use clothing for Accessories.
Parameter 2: Code of the thing you want to check and give. (e.g. staxel.item.tool.Hoe)
Parameter 3: Number of the item you want to give the player.
Purchases the item if the player can afford the item.
moveTo
Usage: <<moveTo TavernEntrance>>
Parameter 1: Waypoint Kind to find. Can be one of: Any, ChillSpot, Tutorial Spawn, NearShippingDock, NearCatalogue, Fields, Totem, Pathing, MayorsOffice, Shop, TavernEntrance, BarArea, TownSquare, ShopEntrance
Move the NPC to the nearest node of the kind specified. You cannot specify any particular node, just the closest.
leadTo
Usage: <<leadTo TavernEntrance>>
Parameter 1: Waypoint Kind to find. Can be one of: Any, ChillSpot, Tutorial Spawn, NearShippingDock, NearCatalogue, Fields, Totem, Pathing, MayorsOffice, Shop, TavernEntrance, BarArea, TownSquare, ShopEntrance
Move the NPC to the nearest node of the kind specified. Stops to wave at player if they are too far away.
removePlayerItem
Usage: <<removePlayerItem staxel.item.FarmRegistrationLetter>>
Parameter 1: Code of the Item you want to remove. (e.g. staxel.crop.tomato)
Remove the item specified if the player has it. Do nothing if there is no item.
Use this in combination with #branchPlayerDoesntHavePlayerItem to enforce that an item is needed.
removeAllOfPlayerItem
Usage: <<removePlayerItem staxel.item.FarmRegistrationLetter>>
Parameter 1: Code of the Item you want to remove. (e.g. staxel.crop.tomato)
Removes all items of the specified code if the player has it. Do nothing if there is no item.
Use this in combination with #branchPlayerDoesntHavePlayerItem to enforce that an item is needed.
Quest Functions
These functions are useful for organising quests. You will generally not have to deal with these functions unless you want to make new quests.
acceptQuest
Usage: <<acceptQuest>>
If the speaker has a quest, then activate the quest for the player. Gives the start item (i.e. Delivery Item), if needed, to the player.
branchQuestActive
Usage: <<branchQuestActive CheckCompletion>>
Parameter 1: Title of the Node to move to.
When this function is hit, it will check if the player has this person's specific quest. If the speaker has no quest or the player doesn't have the quest or the player does have the quest but it's for the wrong day, continue on normally. Otherwise go to the node.
branchQuestCompletable
Usage: <<branchQuestCompletable CompleteQuest>>
Parameter 1: Title of the Node to move to.
When this function is hit, it will check if the player has completed this person's specific quest. If the speaker has no quest or the player does have the quest but it's for the wrong day or if the quest is not complete-able then continue on normally. Otherwise go to the node.
branchQuestTarget
Usage: <<branchQuestTarget TargetDialogue>>
Parameter 1: Title of the Node to move to.
This is specifically for delivery type quests. When this function is hit, it will check if the player has a quest for the villager and if so, check to see if the the villager is the target of the quest. If the speaker has no quest for the villager or the villager is not the target then continue on normally. Otherwise go to the node.
cancelQuest
Usage: <<cancelQuest>>
If the player has a quest for the current speaker, then cancel that quest. Otherwise do nothing.
completeQuest
Usage: <<completeQuest>>
If the speaker has a quest, and it is completable then set the quest complete. Also give the quest reward.
loadVillageActiveQuestsInfo
Usage: <<loadVillageActiveQuestsInfo>>
Loads all the current quest givers. Each consecutive quest giver is stored in the variable "$quest_giver_i" where i is the number of the quest giver starting at 0. Also stores the number of quests in the variable "$quest_count".
For how to use these variables, look at the barkeep's dialogue.
requestGoToQuestIfAvailable
Usage: <<requestGoToQuestIfAvailable >>
If the villager has a quest, then go immediately to that quest.
This is used to signal to the game that it is ok to go to the quest. Most villagers should have this somewhere in their dialogue.
Villager Arrival Functions
These functions main use are to allow the player to get more villagers into the game. These are mainly intended to be only used by Mayor Maximillian.
branchAndLoadMissingArrivalQuestTotem
Usage: <<branchAndLoadMissingArrivalQuestTotem $ttm TotemMissing>>
Parameter 1: The name of the variable you want to use. Should start with $.
Parameter 2: Title of the Node to move to.
When this function is hit, check to see if a villager quest is active. If not continue normally. If a quest is active, check to see if the player has the totem. If they don't branch, otherwise continue.
branchNewVillagerArrivalQuestAvailable
Usage: <<branchQuestActive CheckCompletion>>
Parameter 1: Title of the Node to move to.
When this function is hit, check to see if an existing villager arrival quest is already ongoing. If it does exist continue on normally. If it doesn't exist, then check if a new villager arrival can be gotten. Go to the node if a quest is available, otherwise continue normally.
setAndGiveActiveVillagerArrivalQuestTotem
Usage: <<SetAndGiveActiveVillagerArrivalQuestTotem>>
Get the new villager arrival quest, and save it. (Thus giving you the quest.) Then give the totem to the player.
giveActiveVillagerArrivalQuestTotem
Usage: <<giveActiveVillagerArrivalQuestTotem>>
If a quest is ongoing, then give the player the totem associated with the quest.