Project Zomboid

Project Zomboid

109 ratings
Trait Tag Framework
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
142.491 KB
9 Jun, 2023 @ 8:16pm
22 Jan @ 4:30pm
6 Change Notes ( view )

Subscribe to download
Trait Tag Framework

Description
A Project Zomboid framework for adding user-defined strings correlating to player traits. Trait tags are stored in a table accessed by a module and has built-in functions.

A message from the creator
Do you really use this mod, or even better want to build off of it? Please consider donating to me[ko-fi.com] so I can pay my bills. I'm recently unemployed and every little bit helps!

How to Use:
Declare the module before it's needed (typically at the beginning of the file) with
local TTF = require("TraitTagFramework");
Depending on your use case, you'll want to add your tags before the player is created. To do this, make a function that gets added to the OnGameBoot event with
Events.OnGameBoot.Add([your function here])
If you're creating new traits, feel free to mingle your trait and tag declarations together, like so:
local AT_Carpenter = TraitFactory.addTrait("AT_Carpenter", getText("UI_trait_AT_Carpenter"), 2, getText("UI_trait_AT_Carpenter_desc"), false); AT_Carpenter:addXPBoost(Perks.Woodwork, 1) TTF.Add("AT_Carpenter", "Anthro,HabitatBuilder");

Available Functions
  • ToString()
    Returns the entirety of the table and tags in a string.
  • TagTableToString(string traitName)
    Returns the tags associated with a trait as a string
  • Add(string traitName, string tags)
    Add(s) tag(s) to the TraitTags module.
    Note: For tags, use alphanumeric symbols only, and separate each tag with a comma.
  • Remove(string traitName)
    Removes a trait and all of its tags from the TraitTags module.
  • RemoveTag(string traitName, string tag)
    Removes the specified tag from the specified trait in the TraitTags module.
  • GetTable()
    Returns the entirety of the TraitTags table as a table.
  • GetTagTable(string traitName)
    Returns the table of tags associated with a trait as a table.
  • GetTagStatistics()
    Returns a string containing each tag used, and how many times they're used.
    Note: I find this helpful for balancing purposes.
  • GetPlayerTraitTags(Player player)
    Returns a string containing each tag a player has.
  • GetPlayerTagStatistics(Player player)
    Returns a string containing each tag and the amount(count) of each the player has. This list in the string is ordered by count.
    String format: "[tag]: [count]; [tag]: [count];..."
  • PlayerHasTag(Player player, string targetTag)
    Returns a boolean, which is true if the player has the targetTag.
  • PlayerTagCountLargerThan(Player player, string subjectTag, string comparatorTag)
    Returns a boolean, which is true only if the subjectTag's count is larger than the comparatorTag's count.
    Note: This will also return false if one of the tags cannot be found (with a console print warning of a nil if debug mode is on).
  • GetAllTraitsWithTag(string subjectTag)
    Returns a collection of Traits that have the subject tag.

All Vanilla Traits put in .Add
Here's a list of all vanilla traits with an example name for your Trait Tags module. This will work in whatever function you add it, just add your own tags and run. (current as of build 41):
TTF.add("Axeman", "");
TTF.add("Handy", "");
TTF.add("SpeedDemon", "");
TTF.add("SundayDriver", "");
TTF.add("Brave", "");
TTF.add("Cowardly", "");
TTF.add("Clumsy", "");
TTF.add("Graceful", "");
TTF.add("ShortSighted", "");
TTF.add("HardOfHearing", "");
TTF.add("Deaf", "");
TTF.add("KeenHearing", "");
TTF.add("EagleEyed", "");
TTF.add("HeartyAppitite", "");
TTF.add("LightEater", "");
TTF.add("ThickSkinned", "");
TTF.add("Unfit", "");
TTF.add("Out of Shape", "");
TTF.add("Fit", "");
TTF.add("Athletic", "");
TTF.add("Nutritionist", "");
TTF.add("Nutritionist2", "");
TTF.add("Emaciated", "");
TTF.add("Very Underweight", "");
TTF.add("Underweight", "");
TTF.add("Overweight", "");
TTF.add("Obese", "");
TTF.add("Strong", "");
TTF.add("Stout", "");
TTF.add("Weak", "");
TTF.add("Feeble", "");
TTF.add("Resilient", "");
TTF.add("ProneToIllness", "");
TTF.add("Agoraphobic", "");
TTF.add("Claustophobic", "");
TTF.add("Lucky", "");
TTF.add("Unlucky", "");
TTF.add("Marksman", "");
TTF.add("NightOwl", "");
TTF.add("Outdoorsman", "");
TTF.add("FastHealer", "");
TTF.add("FastLearner", "");
TTF.add("FastReader", "");
TTF.add("AdrenalineJunkie", "");
TTF.add("Inconspicuous", "");
TTF.add("NeedsLessSleep", "");
TTF.add("NightVision", "");
TTF.add("Organized", "");
TTF.add("LowThirst", "");
TTF.add("Burglar", "");
TTF.add("FirstAid", "");
TTF.add("Fishing", "");
TTF.add("Gardener", "");
TTF.add("Jogger", "");
TTF.add("SlowHealer", "");
TTF.add("SlowLearner", "");
TTF.add("SlowReader", "");
TTF.add("NeedsMoreSleep", "");
TTF.add("Conspicuous", "");
TTF.add("Disorganized", "");
TTF.add("HighThirst", "");
TTF.add("Illiterate", "");
TTF.add("Insomniac", "");
TTF.add("Pacifist", "");
TTF.add("Thinskinned", "");
TTF.add("Smoker", "");
TTF.add("Tailor", "");
TTF.add("Dextrous", "");
TTF.add("AllThumbs", "");
TTF.add("Desensitized", "");
TTF.add("WeakStomach", "");
TTF.add("IronGut", "");
TTF.add("Hemophobic", "");
TTF.add("Asthmatic", "");
TTF.add("Cook", "");
TTF.add("Cook2", "");
TTF.add("Herbalist", "");
TTF.add("Brawler", "");
TTF.add("Formerscout", "");
TTF.add("BaseballPlayer", "");
TTF.add("Hiker", "");
TTF.add("Hunter", "");
TTF.add("Gymnast", "");
TTF.add("Mechanics", "");
TTF.add("Mechanics2", "");




A message from the creator
Do you really enjoy this mod--or even better--want to build on it? Please consider donating to me[ko-fi.com]! I'm in definite financial need, so every little bit helps! Thank you.

Special Thanks
to the Project Zomboid discord modding community for their tireless answering of my questions.
Particular thanks to Albion, who has a seemingly encyclopedic knowledge of PZ properties, functions, and modding. You helped a lot :)

Originally posted by Badonn:
Please don't copy this mod and upload it as your own! Please also ask if you can use this in a mod pack. If you would like to translate the mod, send me a message or leave a comment and I'll work with you to add it in! This mod is under the MIT License.

Workshop ID: 2987177652
Mod ID: TraitTagFramework
19 Comments
Badonn  [author] 1 Feb @ 8:08pm 
@Mitchel Vories AnthroTraits uses this mod
irrelevantredundancy 1 Feb @ 1:31pm 
what mods use this? It got enabled on my mod list. I want to disable it but I'm not sure if it's still
being used.
Reggin Kcalb 21 Jan @ 5:16pm 
update borked this
Ovelton 10 Jan @ 4:23am 
@badonn ah ok good to know you realy do think of everything
Badonn  [author] 2 Jan @ 9:03pm 
@Ovelton so other modders can use it!
Ovelton 15 Dec, 2024 @ 4:32am 
why is this sepret to the main mod?
Beef_taco54434 13 Jun, 2024 @ 6:29pm 
You should add a trait called. Thick furred which give a warmth bonus and better scratch protection
G00SE_ 13 Apr, 2024 @ 2:59pm 
update: I found a way to do it, it was stupidly easy, thanks anyway!
Badonn  [author] 13 Apr, 2024 @ 2:41pm 
@G00SE_ you’re correct, this mod has no functionality to remove traits from the CC menu, only label them.
G00SE_ 9 Apr, 2024 @ 9:56pm 
if it is how to do it?