StatsThroughSkills II

Sure, here you go: https://bitbucket.org/jrtomsic/cataclysm-dda/downloads/StatsThroughSkillsIII.zip

Much appreciated!

This stopped working for what ever reason, I can’t seem to figure why. Tried modifying the original one and this one to no avail, no errors, just won’t work…

It stopped working because there was a change to how add_effects was called. I’m working on a rewrite of STS that hopefully should be ready sometime this weekend.

I’m not certain if this is the right place to put it, but I have a suggestion – a bit of a tweak I make to the mod whenever I update is to move archery from perception skills into strength skills. Pulling back a bowstring is hard and bound to raise the archer’s strength after enough practice, and leveling up marksmanship already raises perception. This’ll make it so low strength archers can practice with a self bow until they’re strong enough to use a short bow, eventually long bow, etc.

My experience with the 3/6/9 suggests the skills were pretty evenly spread between all four attributes. That said, perception rapidly becomes useless to increase unless we consider something ridiculously op, such as Niten Ichi Ryu damage bonus.

That said, I like the uncapped idea here, though square root is rather harsh.

But I want my character to become superhumanly, if not outright supernaturally strong. My views on end game balance are biased.

Does anyone know what have changed exactly ?

So me and my friend MichaelMalus, with a bit of help from DanmakuDan, managed to tinker with this and get it working. Since macrosblackd hasn’t gotten back with an update, I thought I’d post it here so you guys have it.

It’s on Dropbox, largely 'cause it’s the only reliable webspace I have access to - if anyone has better suggestions, let me know or rehost it.

Edit - uploaded a version without my debug messages, should be less spammy now.

good stuff. Will have to try out the new and improved stats through skills when this character dies I think.

[quote=“TaiGambol, post:28, topic:10627”]So me and my friend MichaelMalus, with a bit of help from DanmakuDan, managed to tinker with this and get it working. Since macrosblackd hasn’t gotten back with an update, I thought I’d post it here so you guys have it.

It’s on Dropbox, largely 'cause it’s the only reliable webspace I have access to - if anyone has better suggestions, let me know or rehost it.

Hey, I’m sorry if I’m just being dumb, but I’ve tried all four versions of this and haven’t been able to get one to work. I even tried installing one through CDDA Launcher. Am I supposed to do something other than just extract them to the mods folder like I usually do? I can’t even get them to appear in the list of mods to load.

You shouldn’t have to - make sure you’re doing ‘Extract here’ rather than ‘Extract to StatsThroughSkillsIV’ or the like though, the archive structure’s set up so it’ll already make the relevant folder.

If they won’t even show up when installed through the launcher, though, that’s kind of odd - can you give screenshots of your mods folder and the StatsThroughSkills folder, maybe?

I haven’t fiddled with this in a couple months, but glancing at the lua for the most recent version available here shows it’s still using the on_day_passed lua callback. I’m not sure if that callback has been deprecated from the code (don’t see why it should have been, i think it’s still used in one of the example mods). The real problem is probably the method used to change your stats, I’m pretty sure that’s been changed, but I don’t have any specifics on hand right now.
The is, the version available with the experimentals uses a new lua callback and updates your stats every time you level up a skill, which I think is far superior. And the calc_bonus formula is pretty easy to modify to get any amount of bonus you want, which I also feel is superior. Sometime I’ll get a free day and I’ll spend it updating my mods and confirming my modified version of this mod still works, I’ll release it here if it is.

The stat change method was changed, yes, but the latest version’s been altered to match the new effect call function.

I’ve been unaware of any other version of this besides the original and the two others posted in this thread - if there’s one updated for the current experimentals that uses better code then I’d certainly be interested in it.

Fear not, my hypothesis was correct: I am indeed dumb.

For the benefit of those who’ll come after you who might have similar problems, what was the issue in the end? :stuck_out_tongue:

There IS in fact one which works with the latest experimentals; it is one of the mods available with the latest experimental, straight out of the box. It uses a different lua callback to trigger on skill gains instead of time of day. The default formula was rather limited, maxes out at 6 bonus points at ridiculous skill levels. But it’s simple enough to alter.

Can you tell me the differences between the three different mods? I just want to try an figure out which one I want to use

Sorry for Necroing, I’d like to know too.

I guess no one knows the answer to this? I know that I’m necroing an old post but I was hoping someone could answer this

Idk what the actual version this is but I know that the lua file of the one I am using is this.

[spoiler=Lua file]–Increasing stats by skill
local MOD = {}

local version = 2

local str_skills = { “carpentry”, “mechanics”, “swimming”, “bashing”, “cutting”, “melee”, “throw” }
local dex_skills = { “driving”, “survival”, “tailor”, “traps”, “dodge”, “stabbing”, “unarmed” }
local int_skills = { “barter”, “computer”, “cooking”, “electronics”, “fabrication”, “firstaid”, “speech” }
local per_skills = { “archery”, “gun”, “launcher”, “pistol”, “rifle”, “shotgun”, “smg” }

mods[“StatsThroughSkills”] = MOD

function MOD.on_new_player_created()
game.add_msg(“New player starting with StatsThroughSkills”)
player:set_value(“StatsThroughSkills”, tostring(version))
calculate_bonuses()
end

function MOD.on_skill_increased()
calculate_bonuses()
end

function calculate_bonuses()
game.add_msg(“Calculating new stats based off skills”)

handle_previous_version()

local prev_str = player.str_max
local prev_dex = player.dex_max
local prev_int = player.int_max
local prev_per = player.per_max

remove_existing_bonuses()

local str_bonus = calc_bonus(str_skills)
local dex_bonus = calc_bonus(dex_skills)
local int_bonus = calc_bonus(int_skills)
local per_bonus = calc_bonus(per_skills)

player:set_value("str_bonus", tostring(str_bonus))
player:set_value("dex_bonus", tostring(dex_bonus))
player:set_value("int_bonus", tostring(int_bonus))
player:set_value("per_bonus", tostring(per_bonus))

player.str_max = player.str_max + str_bonus
player.dex_max = player.dex_max + dex_bonus
player.int_max = player.int_max + int_bonus
player.per_max = player.per_max + per_bonus

print_results(player.str_max,"Str",prev_str)
print_results(player.dex_max,"Dex",prev_dex)
print_results(player.int_max,"Int",prev_int)
print_results(player.per_max,"Per",prev_per)

player:recalc_hp()

end

function remove_existing_bonuses()
local str_bonus = tonumber(player:get_value(“str_bonus”))
local dex_bonus = tonumber(player:get_value(“dex_bonus”))
local int_bonus = tonumber(player:get_value(“int_bonus”))
local per_bonus = tonumber(player:get_value(“per_bonus”))

if(str_bonus) then player.str_max = player.str_max - str_bonus end
if(dex_bonus) then player.dex_max = player.dex_max - dex_bonus end
if(int_bonus) then player.int_max = player.int_max - int_bonus end
if(per_bonus) then player.per_max = player.per_max - per_bonus end

end

function calc_bonus(skills_set)
local skill_total = 0
for _,s in ipairs(skills_set) do
skill_total = skill_total + player:get_skill_level(skill_id(s))
end

return (skill_total > 3 and math.floor(math.pow((skill_total - 3), (1 / 2.46))) or 0)

end

function print_results(cur_stat,stat,prev_stat)
if (prev_stat < cur_stat) then
game.add_msg("Raising “…stat…” to "…tostring(cur_stat))
elseif (prev_stat > cur_stat) then
game.add_msg("Lowering “…stat…” to "…tostring(cur_stat))
end
end

function handle_previous_version()
local loaded_version = tonumber(player:get_value(“StatsThroughSkills”))
local is_older_than_day = game.get_calendar_turn():days() >= 1
if( (not loaded_version or loaded_version < 2) and is_older_than_day) then --handle upgrading from original StatsThroughSkills to version 2
game.add_msg(“Migrating from version 1”)

    local str_bonus = get_stat_bonus_for_skills_version_1(str_skills)
    local dex_bonus = get_stat_bonus_for_skills_version_1(dex_skills)
    local int_bonus = get_stat_bonus_for_skills_version_1(int_skills)
    local per_bonus = get_stat_bonus_for_skills_version_1(per_skills)

    player.str_max = player.str_max - str_bonus
    player.dex_max = player.dex_max - dex_bonus
    player.int_max = player.int_max - int_bonus
    player.per_max = player.per_max - per_bonus

    player:set_value("StatsThroughSkills", tostring(2))
end

end

function get_stat_bonus_for_skills_version_1(skill_set)
local total_bonus = 0
for _,v in ipairs(skill_set) do
local skill_level = player:get_skill_level(skill_id(v))
local stat_bonus = 0
if (skill_level / 3 < 3) then
stat_bonus = stat_bonus + skill_level / 3
else
stat_bonus = stat_bonus + 3
end
total_bonus = total_bonus + math.floor(stat_bonus)
end
return total_bonus
end
[/spoiler]