Jump to content

[GUIDE] Modding Loading Tips


Klei_Marcus
 Share

Recommended Posts

  • Developer

Hello!

With the release of Quality of Life updates for Don't Starve, one of the things we've added is loading tips that appear during loading screens. With that in mind, we've added support for allowing you to modify loading tips - you can create mods that add your own loading tips!

Please note that this is preliminary; more support features may be added in the future if needed.

As an example, I've added an example mod that shows how this can be done. Simply add the contents in the zip file to the 'mods' folder and enable it in-game to take a look.

Here's a basic rundown of the functions available for you to use (copied from the beta patch notes:)

  • AddLoadingTip(<string_table>, <tip_id>, <tip_string>, <controltipdata>) to add a loading tip to the <string_table>

    • <string_table> can be one of the following:

      • LOADING_SCREEN_SURVIVAL_TIPS

      • LOADING_SCREEN_LORE_TIPS

      • LOADING_SCREEN_CONTROL_TIPS

      • LOADING_SCREEN_CONTROL_TIPS_CONSOLE

      • LOADING_SCREEN_CONTROL_TIPS_NOT_CONSOLE

      • STRINGS.UI.LOADING_SCREEN_OTHER_TIPS (It is recommended to use this table as it is reserved for custom loading tips.)

    • <tip_id> must be a unique ID name.

    • <tip_string> is the actual tip string to be displayed.

    • <controltipdata> is a table containing input control bindings to be used in the tip string. Refer to LOADING_SCREEN_CONTROL_TIP_KEYS in constants.lua and LOADING_SCREEN_CONTROL_TIPS in strings.lua for an example usage.

  • RemoveLoadingTip(<string_table>, <tip_id>) to remove a loading tip from <string_table>.

    • See above for <string_table> and <tip_id> usage.

  • SetLoadingTipCategoryWeights(<weight_table>, <weight_data>) to set the weighting used to determine what loading tip category gets chosen.

    • <weight_table> can either be LOADING_SCREEN_TIP_CATEGORY_WEIGHTS_START and LOADING_SCREEN_TIP_CATEGORY_WEIGHTS_END.

    • <weight_data> is a table containing weight values defined in the two tables listed above. Refer to the above table in constants.lua for possible values.

    • Refer to SetLoadingTipCategoryWeights in modutil.lua for more information regarding start and end weights for determining loading tip categories.

  • SetLoadingTipCategoryIcon(<tip_category>, <atlas>, <icon>) changes the icon displayed beside the loading tip text.

    • <tip_category> is a string name representing the tip category of the icon to replace. Refer to LOADING_SCREEN_TIP_CATEGORIES in constants.lua for a list of tip categories.

    • <atlas>, <icon> are strings representing the image from a .tex file to use as the tip icon.

- Note that icon assets must be pre-loaded. To do so, create an asset table in modmain.lua the same way you normally would, but call the table PreloadAssets instead of  Assets then call ReloadPreloadAssets()

- Please note that because the above function calls must be made outside of AddGamePostInit() since they need to modify data before the loading screen appears.

 

loading_tips.zip

  • Like 4
  • Thanks 3
  • Big Ups 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...