Project Zomboid

Project Zomboid

Albion's Literacy Mod - Learn to Read, Read Faster
tanuki 30 Nov, 2023 @ 6:15am
Support for custom professions and traits
hi,

this mod used to allow modders to implement professions and traits that were adding/removing reading skill points, however this is no longer (easily) allowed due to how the setInitialLiteracy function is currently implemented (file literacy.lua).

I took the freedom of rewriting it so that it will dynamically compute the target reading level that the player should reach by checking all the malus/bonus to the reading skill given by all the traits and by the profession itself.

local function targetReadingLevel(player) local profId = player:getDescriptor():getProfession() local prof = ProfessionFactory.getProfession(profId) local bonus = prof:getXPBoostMap():get(Perks.Reading) or 0 for i = 0, player:getTraits():size() -1 do local traitId = player:getTraits():get(i) local trait = TraitFactory.getTrait(traitId) local traitBonus = trait:getXPBoostMap():get(Perks.Reading) or 0 bonus = bonus + traitBonus end return 5 + bonus end local function setInitialLiteracy() local player = getPlayer() if player:getModData().LiteracySetUp == nil then player:level0(Perks.Reading) player:getXp():setPerkBoost(Perks.Reading, 0) local desiredLevel = targetReadingLevel(player) for i=1, desiredLevel do player:LevelPerk(Perks.Reading) end player:getXp():setXPToLevel(Perks.Reading, desiredLevel) player:getModData().LiteracySetUp = 1 end end

If you could integrate this change in your mod that would be really helpful.

Thanks
Last edited by tanuki; 30 Nov, 2023 @ 6:20am
< >
Showing 1-2 of 2 comments
albion  [developer] 12 Dec, 2023 @ 11:24pm 
hi there! sorry for a late response, it doesn't seem like it's possible to have steam notify me when new discussions are created

i'm thankful for your work but unfortunately it cannot be merged as the development version of the mod has seen a near complete rewrite - the current version is more mod-friendly already but i will make sure to make a similar adjustment, thanks for pointing this out
tanuki 14 Dec, 2023 @ 3:24am 
actually you can be notified about new discussions by clicking on the "Subscribe to Forum" button, but you have to do it for all your mods.
< >
Showing 1-2 of 2 comments
Per page: 1530 50