Description[edit | edit source]

Google Apps Script is a scripting language based on JavaScript that lets you manipulate Habitica and other G Suite products like Calendar, Docs, Sheets, Slides, and Forms. There's nothing to install — you use the code editor right in your browser, and your scripts run on Google's servers. All scripts can be scheduled to give a level of autonomy.

Usage[edit | edit source]

In order to use this feature, you need to have a Gmail account. It is recommended that you keep all scripts private, because you need to embed your Habitica User ID and API Token in the script.

Other than the Auto Cron script, no other scripts will cause you to cron. For example, if you cast a party buff after your Custom Day Start, you will still have to either run the Auto Cron or use Habitica website/apps to cron.

When scheduling the scripts, do not schedule them to run more than hourly. Be nice to Habitica servers! When setting up a script for the first time, it may be best to run the script manually by choosing Run => Run function => [Script to be scheduled] to check that it runs without errors before scheduling it.

Manually-Driven Scripts[edit | edit source]

Bulk Attack Quest Boss[edit | edit source]

by cTheDragons

This script is great for Warriors and Mages that will allow you to bulk attack the quest boss.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor
    • Replace the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
    • Change the ntimes to how many times you wish to use a skill each run. Currently set to 8.
    • Change the skillId to skill you wish to cast based what is describe in the comments in options. Below it currently set to Burst of Flames with skillId = "fireball"
    • Change the targetId to match one of your tasks. To find the task id:
      • Open Data Display Tool
      • Go to section for Task Overview.
      • Search for the task name you wish to target (if you are unsure which is best, check under Skills and Buffs for a recommendation based on the skill you are using).
      • Click toggle developer data to show the task id (it is a long string of numbers and letters like 6eb598a1-886a-4be6-a6c5-9e9fdc8f5b44 as per example below).
 function bulkAttackBoss() {
 
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
   var ntimes = 8
   var skillId = "fireball"
   var targetId = "6eb598a1-886a-4be6-a6c5-9e9fdc8f5b44"   
   
   /*
   Below is a list  of options of the party buff skills. Replace the value in skillId above for the skill you desire. Ensure you copy the quotes.
   See http://habitica.fandom.com/wiki/Skills for more information on skills.
   Options for skills:
     Warrior Brutal Smash: "smash" 
     Mage Burst of Flames: "fireball"
   */
   var url = "https://habitica.com/api/v3/user/class/cast/" + skillId + "?targetId=" + targetId 
   var sleepTime = 30000
   
   //set paramaters
   var paramsTemplate = {
     "method" : "post",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken
     }
   }
   var params = paramsTemplate;
 
   for (var i = 0; i < ntimes; i++) { 
     UrlFetchApp.fetch(url, params)
     Utilities.sleep(sleepTime);// pause in the loop for 30000 milliseconds (30 seconds); this is to avoid the servers being overloaded
   }
 }
  • Save the script
  • From the menu choose Run => Run function => bulkAttackBoss.

Bulk Buy Enchanted Armorie[edit | edit source]

by cTheDragons

This script will allow you to bulk buy from the armorie and allow you to view the results in the logs.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor
    • Replace the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
    • Change the ntimes to how many times you wish to buy from the armorie each run. Currently set to 5.
 function bulkBuyArmorie() {
 
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
   var ntimes = 5
 
   var url = "https://habitica.com/api/v3/user/buy-armoire" 
   var sleepTime = 30000
   var response
   
   //set paramaters
   var paramsTemplate = {
     "method" : "post",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken
     }
   }
   var params = paramsTemplate;
 
   for (var i = 0; i < ntimes; i++) { 
     response = UrlFetchApp.fetch(url, params)
     var result = JSON.parse(response);
     Logger.log(result.message)
     if (result.data.armoire.type == 'food') {
       Logger.log("You gained " + result.data.armoire.dropText + ".")
     } else {
       Logger.log("You gained " + result.data.armoire.value + " " + result.data.armoire.type + ".")    
     }
     Utilities.sleep(sleepTime);// pause in the loop for 30000 milliseconds (30 seconds); this is to avoid the servers being overloaded
   }
 }
  • Save the script.
  • From the menu, choose Run => Run function => bulkBuyArmorie.
  • From the menu, choose View => Logs to view what you received.

Time-Driven Scripts[edit | edit source]

Auto Cron[edit | edit source]

by cTheDragons

Run after your Custom Day Start, this script will cron you automatically. Please note, using this method will not allow you to use the Record Yesterday's Activities. Any dailies not ticked off at the time of cronning will be marked as missed.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
 function scheduleCron() {
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
 
   paramsTemplate = {
     "method" : "post",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken
     }
   }
   
   var params = paramsTemplate;
   UrlFetchApp.fetch("https://habitica.com/api/v3/cron", params)
 }
  • Under Edit, select Current project's triggers. Then add a trigger that runs scheduleCron Time-driven on a Day timer with the parameter of the same hour starting with your Custom Day Start. For example if your Custom Day Start is midnight set your trigger to Midnight to 1am.
  • Save and you're done!

If you have cron before the script has run, the script will not do anything. You can use this feature as a catch all in case you miss your regular time. For example if your Custom Day Start is set to midnight, you can set this script to run at 3am to 4am. This will allow you cron manually between midnight and 3am, and thus use the Record Yesterday's Activities feature if you have a late night. Otherwise this script will cron you automatically between 3am and 4am so your party quest damage occurs before you wake up.

Auto Accept Quests[edit | edit source]

by cTheDragons

(Note: An upgraded version of this script with an easy step by step setup guide with pictures can be found on this link)

Run hourly, this script will join a quest automatically if the invite is available in your party.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
 function scheduleJoinQuest() {
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
 
   var paramsTemplate = {
     "method" : "get",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken    
     }
   }  
   var response = UrlFetchApp.fetch("https://habitica.com/api/v3/groups/party", paramsTemplate);
   var party = JSON.parse(response);
 
   if ((party.data.quest.key != undefined) && (party.data.quest.active != true) && (party.data.quest.members[habId] == undefined)){
   paramsTemplate = {
       "method" : "post",
       "headers" : {
         "x-api-user" : habId, 
         "x-api-key" : habToken       
       }     
     }
     var params = paramsTemplate;
  
     UrlFetchApp.fetch("https://habitica.com/api/v3/groups/party/quests/accept", params)
   }
 }

OR more clear code below:

const scheduleJoinQuest = () => {
  const habId = '#HabiticaUserID#';
  const habToken = '#HabiticaAPIToken#';
  const partyAPI = 'https://habitica.com/api/v3/groups/party';
  const headers = {
    'x-api-user': habId,
    'x-api-key': habToken,
  };
  const response = UrlFetchApp.fetch(
    partyAPI,
    {
      method: 'get',
      headers
    }
  );
  const { data: { quest } } = JSON.parse(response);

  if (quest.key && !quest.active && !quest.members[habId]) {
    UrlFetchApp.fetch(
      `${partyAPI}/quests/accept`,
      {
        method: 'post',
        headers
      }
    );
  }
}
  • Under Edit, select Current project's triggers. Then add a trigger that runs scheduleJoinQuest Time-driven on a Hour timer with the parameter of Every hour.
  • Save and you're done!

Auto Force-Start Quests[edit | edit source]

by justuskraft

This script force-starts a pending quest after 1 to 2 hours. It is best used in combination with the auto accept quest script. That way everyone who wants to participate in the quest can do so by enabling auto accept quest, and if some people don't want to take part the quest owner doesn't have to start the quest manually after said time.

  • To enable the script you need to be the quest owner or the party leader.
  • If you are the party leader you can force-start any quest.

Installation:

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
function forceStartQuest() {   
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
   var scriptProperties = PropertiesService.getScriptProperties();
   var paramsTemplate = {
       "method": "get",
       "headers": {
           "x-api-user": habId,
           "x-api-key": habToken
       }
   }
   var response = UrlFetchApp.fetch("https://habitica.com/api/v3/groups/party", paramsTemplate);
   var party = JSON.parse(response);
   if (scriptProperties.getProperty('PENDING_QUEST') == 'true') {
       scriptProperties.setProperty('PENDING_QUEST', 'false');
       paramsTemplate = {
           "method": "post",
           "headers": {
               "x-api-user": habId,
               "x-api-key": habToken
           }
       }
       var params = paramsTemplate;
       UrlFetchApp.fetch("https://habitica.com/api/v3/groups/party/quests/force-start", params);
   } else if ((party.data.quest.key != undefined) && (party.data.quest.active != true)) {
       scriptProperties.setProperty('PENDING_QUEST', 'true');
   } else {
       scriptProperties.setProperty('PENDING_QUEST', 'false');
   }
}
  • Under Edit, select Current project's triggers. Then add a trigger that runs forceStartQuest Time-driven on a Hour timer with the parameter of Every hour.
  • Save and you're done!

Auto Cast Party Buff Skills[edit | edit source]

by cTheDragons

Run at specific times, this script will buff your party n number of times with your desired party buff. This script is deliberately designed not to check if you have enough mana first so it will error if it does not meet the buffing criteria.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor
    • Replace the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
    • Change the ntimes to the number of buffs you wish to do each run. Currently set to 3.
    • Change the skillId to skill you wish to cast based what is describe in the comments in options. Below it currently set to Earthquake with skillId = "earth"
 function schedulePartyBuff() {
 
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
   var ntimes = 3
   var skillId = "earth"
   /*
   Below is a list  of options of the party buff skills. Replace the value in skillId above for the skill you desire. Ensure you copy the quotes.
   See http://habitica.fandom.com/wiki/Skills for more information on skills.
   Options for skills:
     Warrior Valorous Presence (STR): "valorousPresence" 
     Warrior Intimidating Gaze (CON): "intimidate" 
     Rogue Tools of Trade (PER): "toolsOfTrade"
     Healer Protective Aura (CON): "protectAura"
     Healer Blessing (HP): "healAll"
     Mage Ethereal Surge (mana): "mpheal"
     Mage EarthQuake (INT): "earth"
   */
   var url = "https://habitica.com/api/v3/user/class/cast/" + skillId 
   var sleepTime = 30000
   
   //set paramaters
   var paramsTemplate = {
     "method" : "post",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken
     }
   }
   var params = paramsTemplate;
   
   for (var i = 0; i < ntimes; i++) { 
     UrlFetchApp.fetch(url, params)
     Utilities.sleep(sleepTime);// pause in the loop for 30000 milliseconds (30 seconds); this is to avoid the servers being overloaded
   }
 }
  • Under Edit, select Current project's triggers. Then add a trigger that runs schedulePartyBuff Time-driven on a Day Timer with the parameter of which time is best.
  • Click notifications, change the second parameter from daily to immediate (this will alert you if you failed to cast the number of party buffs).
  • Save and you're done!

If you wish this to run immediately instead of waiting on a trigger, from the edit window of the project, menu choose Run => Run function => schedulePartyBuff.


Auto Schedule To-Do's with Google Calendar[edit | edit source]

by Snickersnacker

The script will create specific to-dos in your calendar on a specified date. Effectively giving a to-do a "start date".

  • Create a new calendar in your personal Google Calendar name HabiticaReminders.
  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
 function scheduleToDos() {
   var habId = "#HabiticaUserID#";
   var habToken = "#HabiticaAPIToken#";
 
   var now = new Date();
   var events = CalendarApp.getCalendarsByName("HabiticaReminders")[0].getEventsForDay(now);
 
   var paramsTemplate = {
     "method" : "post",
     "headers" : {
       "x-api-user" : habId, 
       "x-api-key" : habToken
     }
   }
 
   for (i = 0; i < events.length; i++) {
     var params = paramsTemplate;
     params["payload"] = {
       "text" : events[i].getTitle(), 
       "type" : "todo",
       "priority" : "1.5"
     }
 
     UrlFetchApp.fetch("https://habitica.com/api/v3/tasks/user", params)
   } 
 }
  • Under Edit, select Current project's triggers. Then add a trigger that runs scheduleToDos Time-driven on a Day timer. Suggested time is after your cron, early in the morning like 3-4am.
  • Save and you're done!

At the daily time, the script will harvest all the events in a Google Calendar called HabiticaReminders scheduled for that day. It will then add them to Habitica as medium priority to-do's. To schedule a future task, simply select the correct day in Google Calendar and add an event with the to-do text as a title. Make sure you add it to HabiticaReminders and not your default calendar. Suggestion is to hide the calendar the rest of the time, so it doesn't clutter the calendar interface.

Auto Bulk Remove Habitica Emails[edit | edit source]

by cTheDragons

The script will remove all emails from your Gmail box from x days that are from Habitca (default below is 14). For this to work, ensure the gmail account you are running the script from is the email linked to your Habitica Account.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor
    • Adjust daysAgo on how many days you wish to keep in your Inbox for.
    • Adjust onlyInbox, if you want to search all your email (archive too) for Habitica based emails.
    • Remove any items in removeSubject Array that you do not wish to archive.
 function removeHabiticaMessages() {
   var daysAgo = 14
   var onlyInbox = true
   var removeSubject = ['You Received a Private Message!', 'Your Quest Has Started!', 'Help % battle the', 'Help % Complete the','You Won a Challenge on Habitica!', 'has gifted you some gems!', 'Fight Monsters (and Bad Habits)!', 'Removed from Party', 'Wants You to Join a Guild!', 'Removed from Guild']
   // This is the items in list - Received a PM, Quest Start, Request to Fight a Boss Quest, Request to Complete Collection Quest, Won a Challenge, Received Gems, Invited to Party, Remove From Party,  Invited to Guild, Remove From Guild
  
   var now = new Date();
   var removalDate_Raw = new Date(now.getTime()-daysAgo*(24*3600*1000))
   var removalDate = Utilities.formatDate(removalDate_Raw, 'GMT', 'yyyy/MM/dd') 
 
   for (var i = 0; i < removeSubject.length; i++) {
     var criteria = 'subject:' + removeSubject[i] + ' from:messengers@habitica.com before:' + removalDate;
     if (onlyInbox) criteria += ' in:Inbox'
     var conversations = GmailApp.search(criteria);
   
     for (var idx = 0; idx < conversations.length; idx = idx + 1) {    
       var thread = conversations[idx];
       thread.moveToTrash()
     }
   }
 }
  • Under Edit, select Current project's triggers. Then add a trigger that runs removeHabiticaMessages Time-driven on a Day timer. Suggested time is after your cron, early in the morning like 3-4am.
  • Save and you're done!

At the daily time, the script will review all your emails, and remove them as specified from Habitica.

Auto Change Pet and Mount Randomly[edit | edit source]

by Ieahleen

This script will change your pet and mount randomly - the chance is equal for all your pets and mounts so it can happen that instead of changing to a new pet/mount it will select the one currently equipped and so unequip it. You just need to set your own User ID and API Token in the first in place of `#HabiticaUserID#` and `#HabiticaAPIToken#`, and then set the trigger with the interval you prefer. (I set it to daily change, during the night, so the morning gives me a new surprise). If you want to change only the pet or only the mount, remove the four lines below the "randomly change the pet/mount" you are not interested to.

  • Go to script.google.com. If this is your first script, this will automatically create a new Google script for you and open an editor for it. Otherwise, edit an existing project by clicking the pencil icon next to it, or create another.
  • Paste the code snippet below into the editor, replacing the spaces marked #HabiticaUserID# and #HabiticaAPIToken# with Habitica User ID and API Token (leave the quotes). These can be found under the API tab in your Habitica settings.
 function randomlyChangePetAndMount() {
   var habId = "#HabiticaUserID#";  // add here your User ID
   var habToken = "#HabiticaAPIToken#";  // add here your API Token
   var paramsTemplate = {
     "headers": {
       "x-api-user": habId,
       "x-api-key": habToken
     }
   }
   /* get the pets and mounts owned */
   paramsTemplate.method = "get";
   var response = UrlFetchApp.fetch("https://habitica.com/api/v3/user" + "?userFields=" + "items", paramsTemplate)
   var parsed = JSON.parse(response);
   var items = parsed.data.items;
   /* randomly change the mount */
   var mounts = Object.keys(items.mounts).filter(m => items.mounts[m]);
   var randomMount = mounts[Math.floor(Math.random() * mounts.length)];
   paramsTemplate.method = "post";
   UrlFetchApp.fetch("https://habitica.com/api/v3/user/equip/mount/" + randomMount, paramsTemplate)
   /* randomly change the pet */
   var pets = Object.keys(items.pets).filter(p => items.pets[p]);
   var randomPet = pets[Math.floor(Math.random() * pets.length)];
   paramsTemplate.method = "post";
   UrlFetchApp.fetch("https://habitica.com/api/v3/user/equip/pet/" + randomPet, paramsTemplate)
 }
  • If you are interested only to the change of the pet remove the four lines below "randomly change the mount", if you are interested only to the change of the mount remove the four lines below "randomly change the pet.
  • Now add a trigger. Under Edit, select Current project's triggers. Then add a trigger that make the script run on your preferred schedule.

Streamlined Event-Driven Scripts[edit | edit source]

Streamlined scripts allow the user to set up event-driven scripts with fewer number of steps and without going back and forth between different tools.

Change Costume, Background, Pet, and Mount[edit | edit source]

by @EugeneG

Features

  • Creates buttons on the user’s Rewards column to save (remember) the current appearance
    • Includes costume, background, pet and mount
  • Creates buttons to load (wear) a remembered appearance
    • Up to five by default. The user can manually add Rewards buttons for more.
  • Notifies the user via private message when an appearance has been saved or completely loaded
    • Notifications can be disabled
  • Rate limit checking (sends "retry after X seconds" message)

First-Time Setup Instructions

Code

Optional Customizations

  • ENABLE_NOTIFICATION can be set to 0 to disable notifications

Usage Tips

Known Issues

Update Instructions

  • If you already had an earlier version of the script set up previously and want to update to a newer version, simply do Part 2. Update External Script
  • No need to do Part 1 and Part 3
  • Note that on the first time you load a costume after updating, it might take a bit longer than usual to take effect (around 15 seconds). On the second time and onwards this delay will no longer be present.

Credits and Acknowledgments

Faster Auto Accept Quests and Auto Notify on Quest End[edit | edit source]

by @EugeneG

Features

  • Auto accepts quest invites within a few seconds of receiving the quest
  • Notifies via private message when a quest has just finished (to have priority in setting up the next quest)
  • Either of the features above can be disabled
  • Rate limit checking (auto-retries after delay)
  • Auto creation of hourly trigger for auto accepting quests as backup on the rare times Habitica's webhook fails to trigger the script

First-Time Setup Instructions

Code

Optional Customizations

  • ENABLE_AUTO_ACCEPT_QUESTS can be set to 0 to disable auto accepting quests
  • ENABLE_QUEST_COMPLETED_NOTIFICATION can be set to 0 to disable auto notify on quest end

Update Instructions

Credits and Acknowledgments

  • @steelblade for initial webhook tips and debugging help

Warrior Subclasses[edit | edit source]

by @EugeneG

Features

  • Gives Warriors who have reached level 60 the option to choose one of these four subclasses:
    1. Berserker “The one who rushes into the battle, regardless of the dangers ahead.”
      Pay 5-10 Health* to gain up to 20 Mana.
    2. Defender “The valiant protector of righteousness.”
      Use the Defender's versions of Valorous Presence or Intimidating Gaze for 50% chance to triple-cast the skill (2nd & 3rd free). Maximum of 8 times per day.
    3. Gladiator “Are you not entertained?!”
      Pay 5-10 Health* to gain up to 100 Gold.
    4. Blademaster “The expert, training night and day to gain new techniques.”
      Pay 5-10 Health* for a chance to instantly level up (% = 480/level. i.e. 8% at level 60).
      * Cost goes down to 5 Health at 250 CON (equipment and buffs included). Maximum of 50 Health used per day.
  • Rate limit checking (sends "retry after X seconds" message)

First-Time Setup Instructions

Code

Optional Customizations

  • NOTIFICATION_CHANCE can be changed to adjust the chance of notifications (max 0.25)

Update Instructions

Credits and Acknowledgments

Warrior, Mage, Healer, Rogue Subclasses[edit | edit source]

by @EugeneG

[Ongoing development. Expected to be completed around Thanksgiving. (Apologies for the extended delays, work has been intense recently but we'll get the whole week off for Thanksgiving so I'll be sure to get this done then :D)]

Experience Potion and Mana Potion[edit | edit source]

by @mike_antonacci

Summary Health potions are already built into Habitica. What about Experience and Mana Potions? Sure, you could use Fix Character Values to mimic the effect of these potions, but it's easier to use this script below to add either of them (or both) to your Custom Rewards.

When you click each custom reward, it will grant you either +150 XP in the case of the Experience Potion or +30 MP in the case of the Mana Potion, though you may have to sync Habitica before the results appear.

Experience Potion details


As you gulp down this golden liquid, you feel a rush of insight. Your recent experiences seem so clear and obvious now, and you're that much closer to your next level.

Experience Potions are a Reward that cost 25 gold. An experience potion will instantly give you 150 experience points (XP) upon purchase (though you may have to sync Habitica before the XP appears).

These potions unlock at level 21, trying to use them before that level will refund your gold and give you an error message (as a private message). You are limited in the number you can buy per day and cannot gain more than 1/3 of the XP needed to get to the next level to ensure you can't gain too much XP just from these potions. The table below shows how many Experience Potions you can buy each day at a given level.

Max XP Potions you can buy per day 1 2 3 4 5 6 7 +
Levels 21-38 39-52 53-63 64-73 74-83 84-91 92-99 And so on

Trying to buy more potions than these limits will refund your gold and give you an error message (as a private message).

Mana Potion details


You feel a surge of energy as you swallow this sapphire liquid. Your Mana is restored and you can use your class skills sooner.

Mana Potions are a Reward that cost 25 gold. A mana potion will instantly give you 30 mana points (MP) upon purchase (though you may have to sync Habitica before the MP appears). If you are close to your maximum Mana, the potion will fill you to the maximum but not beyond it and send you a private message letting you know. If you are already at the maximum, the potion will have no effect to your MP, instead refunding your gold and sending you a message.

These unlock at level 11 because Mana unlocks at that level, trying to use them before that level will refund your gold and give you an error message (as a private message). You are limited to purchasing four per day. Trying to buy more than four will also refund your gold and give you an error message.

First-Time Setup Instructions

Code

Required Customizations Which of these custom potions do you want to create? You can create one or both.

  • CREATE_EXPERIENCE_POTION will create the Experience Potion custom reward if the value is set to 1 (which is the default). If you don't want the Experience Potion, change the value to a 0.
  • CREATE_MANA_POTION will create the Mana Potion custom reward if the value is set to 1 (which is the default). If you don't want the Mana Potion, change the value to a 0.

Optional Customizations

  • NOTIFICATIONS_ON can be changed to a 0 so you don't get any private message notifications; if you keep it as a 1, you'll get all the usual messages (examples include if you're already at max Mana or exceeded the limit for daily potion usage)

Update Instructions

Credits and Acknowledgments

Anti-Potions[edit | edit source]

by @mike_antonacci

Summary Gain gold at the expense of HP, XP, or MP! Useful for players who wish to gain more gold or they wish to make Habitica more challenging by having less HP, leveling up slower (less XP), or can use skills less often (less MP).

Gamified understanding of it: a crowd of onlookers is willing to pay you 25 GP to drink a foul concoction and somewhat weaken you. Will you choose the orange-brown Draining Potion and lose 30 MP? The teal Fatiguing Potion and lose 15 HP? Or the indigo Stupefying Potion and lose 150 XP?

Draining potion cropped transparent.png

Draining Potions are a Reward that give you 25 gold at the cost of 30 MP upon purchase (though you may have to sync Habitica before the gold appears). You can only use this potion 4 times per day. They unlock at level 11, trying to use them before this results in an error message as a private message.

Fatiguing potion cropped transparent.png

Fatiguing Potions are a Reward that give you 25 gold at the cost of 15 HP upon purchase (though you may have to sync Habitica before the gold appears). You can only use this potion 4 times per day.

Stupefying potion cropped transparent.png

Stupefying Potions are a Reward that give you 25 gold at the cost of 150 XP upon purchase (though you may have to sync Habitica before the gold appears). You can only use this potion 4 times per day. They unlock at level 16, trying to use them before this results in an error message as a private message.

First-Time Setup Instructions

Code

Required Customizations Which anti-potions do you want to create? You can create all three or pick which 1 or 2 you want.

  • CREATE_DRAINING_POTION will create the Draining Potion custom reward (anti-MP) if the value is set to 1 (which is the default). If you don't want the Draining Potion, change the value to a 0.
  • CREATE_FATIGUING_POTION will create the Fatiguing Potion custom reward (anti-HP) if the value is set to 1 (which is the default). If you don't want the Fatiguing Potion, change the value to a 0.
  • CREATE_STUPEFYING_POTION will create the Stupefying Potion custom reward (anti-XP) if the value is set to 1 (which is the default). If you don't want the Stupefying Potion, change the value to a 0.

Optional Customizations

  • NOTIFICATIONS_ON can be changed to a 0 so you don't get any private message notifications; if you keep it as a 1, you'll get all the usual messages (examples include if you're already at max Mana or exceeded the limit for daily potion usage)

Update Instructions

Credits and Acknowledgments

Swap HP or XP for MP[edit | edit source]

by @mike_antonacci

Summary As detailed in this wiki page on custom rules for Habitica, a player who finds that they need more motivation to avoid bad Habits might want to swap Health for Mana; having less Health could motivate them more to avoid bad Habits, and additional Mana allows them to use skills more. Similarly, a player could find it motivating to delay leveling up by losing experience in order to heal themselves, especially if using skills more (with more mana) is a greater motivator to a player than leveling up.

This script creates custom Reward buttons that create these custom skills, and you can create one or both.

  • Swap Health for Mana allows you to pay 5 HP to gain 10 MP, up to a maximum of 12 times per day. This skill unlocks at level 11, when players unlock Mana.
  • Swap Experience for Mana allows you to pay 50 XP to gain 10 MP, up to a maximum XP spent of 1/3 of what's needed to level up. This skill unlocks at level 11, when players unlock Mana.

First-Time Setup Instructions

Code

Optional Customizations

  • NOTIFICATIONS_ON can be changed to a 0 so you don't get any private message notifications; if you keep it as a 1, you'll get all the usual messages (examples include if you're already at max Mana or exceeded the limit for daily usage)

Update Instructions

Credits and Acknowledgments

Low Constitution Mode[edit | edit source]

by @mike_antonacci

Summary As detailed in these wiki pages on adjusting difficulty and on self-imposed challenges, a player who finds that they need more motivation to avoid bad Habits or complete their Dailies on a given day might use this custom script to set their Constitution to 1, thus taking more damage when they press the - button on their bad Habits or fail to complete their Dailies.

The script creates a button that, when clicked, activates Low Constitution Mode, setting CON to 1 via a negative buff (meaning that the anti-buff wears off at Cron the next morning). In case that mode proves to be too hard a challenge that day, pressing the button again deactivates Low Constitution Mode. Players could use that mode regularly if doing so would be a good motivation, or could use it only occasionally on days where certain completion of tasks is especially critical.

First-Time Setup Instructions

Code

Optional Customizations

  • NOTIFICATIONS_ON can be changed to a 1 if you want a private message notification every time you enter or exit the Low Constitution Mode. If you leave it as a 0, you won't get such notifications.

Update Instructions

Credits and Acknowledgments

  • @EugeneG for confirming that buffs can be edited by scripts
  • The Guilds Hard Mode and Habitica Plus for various self-imposed challenges and ways to customize the game

Traditional Event-Driven Scripts[edit | edit source]

Sample traditional scripts can be found here.

Troubleshooting[edit | edit source]

If you have any questions or concerns regarding unexpected behavior encountered while setting up or using scripts, please go to the scripts troubleshooting page.

Community content is available under CC-BY-SA unless otherwise noted.