So, I have modified the code so that whenever I hit levels 3, 6, and 9 of a skill, it will raise an appropriate stat (I like raising skills to mean something). I’ve got this to work, but I had to modify the src files in order to do so. I was wondering if anyone knew how to modify the src files with a mod. If not, is there a way to grab the current skill level using json?
As an example, here is a snippet of code that I added to characters.cpp.
int barter_skill = get_skill_level("barter");
if (barter_skill >= 3) {
mod_int_bonus(1);
if (barter_skill >= 6) {
mod_int_bonus(1);
if (barter_skill >= 9) {
mod_int_bonus(1);
}
}
}
Hmm, I’m not seeing any lua function that would get the current skill level. If this exists, can someone point me at it? Also, are there any good mods that use lua scripts that I can use for reference? The only ones that come stick are just a few lines of code to make single changes to zombies.
Once this lands you should be able to use get_skill_level(“melee”) to get the skill level. You could e.g. use set_str_bonus to modify the strength stat.
Awesome, that will allow me to get the main body of the work done. Though do you know how lua’s get called? When I put the code into the src files, I just stuck it into the reset_stats() function. The examples make it look like they are just making a static change on startup.
Yea, I’ve been looking into this more, and it really seems like the mods just get loaded in once you start. Does somebody know of a way around this? Where I can make my code be called based on a condition?
I’m no programmer [size=7pt]so pardon me for cluttering the thread[/size] but if that’s truly the case i could see how sleeping or resting would call upon this function without much intrusion.
I’m actually quite interested in this mechanic, however i’d like to inquire a little about progression
[spoiler]
a quote from a discussion for example, link provided
Wouldn’t the ability to increase stats underline countermeasures described in that thread?
[quote=“joxer, post:9, topic:9773”]I’m no programmer [size=7pt]so pardon me for cluttering the thread[/size] but if that’s truly the case i could see how sleeping or resting would call upon this function without much intrusion.
I’m actually quite interested in this mechanic, however i’d like to inquire a little about progression
[spoiler]
a quote from a discussion for example, link provided
Wouldn’t the ability to increase stats underline countermeasures described in that thread?[/quote]
For your first part, the problem isn’t trying to find a good condition that can call on this, the problem is how to get the lua code to be called when performing that condition. (I’ve done this already when modifying the source code, just trying to get it to work with the mod format)
For the second part, it would actually work quite well. As you use guns more, you perception increases, allowing you to use less accurate guns while still increasing your skill. As opposed to never being able to use less accurate guns to raise skill, if you didn’t get your per really high to start.
Once this lands you should be able to use get_skill_level(“melee”) to get the skill level. You could e.g. use set_str_bonus to modify the strength stat.[/quote]
Hmm, do you know if it is possible to create a variable with LUA that will last between reloads? Because setting a bonus is only temporary, and since the callback function only occurs once a day (at midnight), instead of on every turn, the bonus would just go away the very next turn. This can be fixed by setting the max value instead, but I would want a way to store what the user’s original starting stats were.
Once this lands you should be able to use get_skill_level(“melee”) to get the skill level. You could e.g. use set_str_bonus to modify the strength stat.[/quote]
Hmm, do you know if it is possible to create a variable with LUA that will last between reloads? Because setting a bonus is only temporary, and since the callback function only occurs once a day (at midnight), instead of on every turn, the bonus would just go away the very next turn. This can be fixed by setting the max value instead, but I would want a way to store what the user’s original starting stats were.[/quote]
Yes, you can use player.set_var(“varname”, value). It would probably be pretty easy to add a per-turn callback, too, if you need that.
Once this lands you should be able to use get_skill_level(“melee”) to get the skill level. You could e.g. use set_str_bonus to modify the strength stat.[/quote]
Hmm, do you know if it is possible to create a variable with LUA that will last between reloads? Because setting a bonus is only temporary, and since the callback function only occurs once a day (at midnight), instead of on every turn, the bonus would just go away the very next turn. This can be fixed by setting the max value instead, but I would want a way to store what the user’s original starting stats were.[/quote]
Yes, you can use player.set_var(“varname”, value). It would probably be pretty easy to add a per-turn callback, too, if you need that.[/quote]
player.set_var doesn’t appear to be an actual function. There’s an item.set_var…
Eh, the idea of having your stats grow at the start of the next day works for me. Also, it avoids the issue where bonuses to str aren’t working properly, since I’d be changing the base value. For now I just have my mod marked to not change the starting stats. Honestly, if I knew how, I would just lock the starting stats during character creation, as the mod isn’t really intended for people to raise their starting stats manually. I figured if I couldn’t do that though, I’d at least make it recognize the stats.
Not sure if this is intentional so I’m reporting it as a bug.
The code, as is, resets all stats to baseline (8) if relevant skills are not at sufficient levels to provide a bonus. Mutations that provide a stat bonus (like Perceptive, Dextrous, etc.) aren’t affected(IE: the stat bonus from the mutation is not removed), but any points you put into stats during character creation are wasted.
If this is intentional I’d suggest that you write a notice about it in the mod-description.
I haven’t figured out why yet, but this mod doesn’t seem to do anything when I compile on my Linux machine. I don’t get the daily message about stat increases, and my stats never improve. There aren’t any warning appearing during make either. Has anyone else tried compiling this on Linux?
EVEN, if this mod has its quirks, it still makes for far more progressive gameplay than without.
Which is nice.
Yeah, one can spend spring only reading and getting high stats (mostly int), but the bad thing is that the zeds evolve and doing something else gets way harder without better gear, that you could have your time looting/crafting.