Timberborn

Timberborn

43 ratings
Bobingabout Script Pack
   
Award
Favorite
Favorited
Unfavorite
Mod
File Size
Posted
Updated
40.368 MB
Jan 29 @ 4:47am
May 13 @ 7:50am
32 Change Notes ( view )

Subscribe to download
Bobingabout Script Pack

Description
If you're a player, You only need this mod if another mod tells you that it is required.

If you're a content creator, You may want to use the Character Customizer's Custom Beaver By Name function, Details will be below.

WARNING: Any files you edit or add to this mod will be deleted when it is updated by steam, so if you use the custom beavers functions, you should put those files in a custom mod in your Documents/Timberborn/Mods folder. You can download a template mod from mod.io here: https://mod.io/g/timberborn/m/bobingabout-custom-beavers

The main interest for this mod should be other Modders, wanting to use the tools in this mod in their own mods.


The description is too long to fit here on Steam. For information of more features, See Readme file.


Feature Description:

Character Customizer:
The character customizer consists of 6 parts, including 4 that are controlled by new Specification files.
A Character is an entity definition applied to both Beavers and Bots. In the following description, if I use the word Beaver it means Beaver only, if I use the word Bot it means Bot only and if I use the word Character it means both Beavers and Bots.

Character Texture Setter:
The first and key part of the Character Customizer is the Character Texture Setter.
The primary function is to write the current texture of a Character to the save file, and apply the same texture back to the beaver when you load the game again later. It is also the controller that does all the work relating to Character Textures in the following functions.

Character Avatar Setter:
The second part of the Character Customizer is the Character Avatar Setter. First question you probably have is, what is an Avatar? Well, the that's the name of the folder the files are in, and how they're referenced by the FactionSpecification file. They're basically the icons used on the GUI to represent a specific character.
By default, the game will just use the 5 defined in the FactionSpecification file for the current faction. These are the icons for Adult Beaver, Child Beaver, Bot, Contaminated Adult Beaver and Contaminated Child Beaver. The "Avatar" line that specifies Adult Beaver is also used for the Faction Unlock icon in the Wellbeing menu.

Emberpelts has 2 different coloured beavers, and Mixed Beavers includes textures for multiple factions, so using only 1 icon to represent a character (though the beaver icon changes depending on state) isn't always enough.
So I made this script to change icon based on a Character's Texture, see how to control that below.

Bot Textures:
The FactionSpecification file holds an array to allow you to have more than 1 texture for a Beaver. When a Beaver is created, a texture is chosen at random. Bots just use whatever texture is on the Bot material for their entity.
It turns out that the Texture changing mechanic is done on a Character level, so there's no reason why it can't be used on a bot too.

A BotTexturesSpecification will be read on game load, and the Character Texture Setter will apply them on Bot creation. These files include a Faction filter so they only apply to a specific faction, but they include a list of textures like the Beaver Textures in FactionSpecification, but they apply to Bots. This allows you to include multiple Bot textures chosen at random in the same way Beaver textures are.

To create one yourself, Simply create a JSON file named BotTexturesSpecification.Unique where Unique is a unique identifier for your file (EG: BotTexturesSpecification.Emberpelts), which includes these 2 entries. FactionID of type String to assign a faction, and BotTextures of type String Array to list the textures that should be used. See Readme file for an example.

Beaver Grow Up Texture Map:
Default behaviour of the game is that when a Beaver Child grows into a Beaver Adult, the Adult will be assigned a new random texture from the Textures list on FactionSpecification for the current Faction. However, like in the case of Emberpelts where there's two different coloured beavers, this could break immersion when your Charcoal fur coloured Beaver Child grows up to have Red fur, and vica verca. The same applies when using the Mixed Beavers mod and suddenly your Iron Teeth Beaver Child grows into a Folktails Beaver Adult.

When a Child Beaver grows up the Character Texture Setter will check the Beaver Grow Up Texture Map dictionary to see if the Child texture is listed, and if so pick only a texture listed to apply to the Adult Beaver.

The Beaver Grow Up Texture Map will read any BeaverGrowUpTextureMapSpecification file to build a Library. This is not keyed to a faction, as Beaver Texture files usually include the name of the faction, which allows it to work with mods such as Mixed Beavers. The BeaverGrowUpTextureMapSpecification.Unique (Again, Unique should be a unique identifier for your file, EG: BeaverGrowUpTextureMapSpecification.Emberpelts) file includes only 1 entry, TextureMaps which is an Object Array. Each TextureMaps Object has 2 variables. ChildTextureName of type String sets the name of the Child Texture and AdultTextureNames of type String Array, which sets a list of Textures to use for the Adult Beaver.
All entries on ChildTextureName must exist on the FactionSpecification ChildTextures list, and all entries on the AdultTextureNames list must exist on the FactionSpecification Textures list to function correctly. They also need to only contain the Filename of the texture, not the whole path. See Readme file for an example.

Character Avatar Map:
So, the Character Avatar Setter will set an appropriate icon for the Character's Texture... but how does it know what to use?

The Character Avatar Map script will read CharacterAvatarMapSpecification files on load. Again, you need to use CharacterAvatarMapSpecification.Unique where Unique is unique for your file.
A CharacterAvatarMapSpecification file has a single entry, AvatarMaps, which is an Object Array. Each object has 3 entries, TextureName, AvatarPath and ContaminatedAvatarPath, all of type String.
TextureName holds the name of a Texture to be used on a Character, Filename only, not the whole Path, while TextureName and ContaminatedAvatarPath list an Icon's Path, the full file path within the mod, not just the filename. Since Bots, Beaver Child and Beaver Adult all use a different name, it wasn't necessary to filter how the icons are applied. ContaminatedAvatarPath is optional and will be ignored if specified on a Bot. See Readme file for an example.

Custom Beaver By Name:
This is the part that content creators might also be interested in.

This script will read CustomBeaverByNameSpecification JSON files. The file format should be CustomBeaverByNameSpecification.Unique, where Unique is the Beaver's name. The file holds 6 entries: Name, Texture, Avatar, ChildAvatar, ContaminatedAvatar and ContaminatedChildAvatar, all of type String.
Name is the name of the Beaver. If any beaver in the game has this name, then Character Texture Setter and Character Avatar Setter will alter the beaver accordingly. The name will be added to the Name's list to be random used during gameplay.
Texture should contain the full Path for a texture to use for this beaver. It will be applied to both Child and Adult beavers. Currently there is no Entry to have a unique texture for the Child. If no Texture is specified, then one will be chosen at random from the list on FactionSpecification.
Avatar, ChildAvatar, ContaminatedAvatar and ContaminatedChildAvatar each list the full path for an icon to use in each of the 4 beaver states. If no Child icon is listed, the Adult version will be used. If no Contaminated icon is listed, then the Normal version will be used. If no icons are listed at all, then the script will default to previous behaviour and try to use an appropriate icon, or faction default.
9 Comments
Bobingabout  [author] May 17 @ 10:04am 
@Med3 it shouldn't, it's up to date and works fine for me.

I have noticed a very low chance of the game crashing, mentioning a null reference exception on a nav corner when loading maps from previous versions of the game, but I don't know if that is even related to this mod.

If you're certain this mod is the issue, send me a log file on Discord, you can find me in the official timberborn discord group.
Med3 May 17 @ 7:04am 
as of update 7 (official ver) this mod crushes the game when i try to lode into any map...
Bobingabout  [author] May 7 @ 9:18am 
@flumeister would it be possible to send a crash log?
flumeister May 7 @ 7:01am 
This morning's update causes a crash on the experimental branch
Bobingabout  [author] Apr 11 @ 11:06am 
@kathysgeek When the log was posted... yeah, it was broken, I was at work.
It should have been fixed a couple hours after that. Make sure you have at least version 0.7.3.0 of script pack, that one should work.
kathysgeek Apr 10 @ 4:18pm 
This worked great on the experimental branch until the 4/10 update.
I see the same crash log as in the previous message.
Disabling the script pack allows it to run but I miss those huge storage mods.
鸡【蛋柿】子 Apr 10 @ 7:39am 
v0.7.3.1-20877bb-xsw
MissingMethodException: Method not found: bool Timberborn.WorldPersistence.ISingletonLoader.HasSingleton(Timberborn.WorldPersistence.SingletonKey)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Timberborn.SingletonSystem.SingletonLifecycleService.LoadSingletons_Patch2(Timberborn.SingletonSystem.SingletonLifecycleService)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Timberborn.SingletonSystem.SingletonLifecycleService.LoadAll_Patch1(Timberborn.SingletonSystem.SingletonLifecycleService)
Timberborn.SingletonSystem.SingletonLifecycleUnityAdapter.Start () (at <a00d649e079a4a109c9d6aef3597daa8>:0)
Xnenai Xyinaa Mar 17 @ 8:09pm 
I'm a simple man, I see Bob's mods on any game,I install. God help me if I see Angel's for Timberborn too, I will never see the sun.
CowabungaDude85 Feb 5 @ 9:26am 
All my current mods are broken due to the new update.