Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Thistleknot's Scripts  (Read 2748 times)

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Thistleknot's Scripts
« on: August 05, 2013, 12:25:35 am »

Figure'd I'd start a thread for the lua scripting I have up my sleeve.

Script #1 is a WIP, but I call it...

boost_dwarf.lua (you'll have to rename it)

Description:

This script modestly improves a unit's attributes, run it 3-4 times, and you'll see a big jump.  I thought of the idea after using VJek's armoks_blessing and playing MWMod and dreading an embark with raptors (although embarking with boars or whatev's helps), and didn't like the defacto 2600 (doesn't respect any of the raw values!) thought it was a bit overpowering.  The idea for me was to run this on my embark dwarf's, or heck, run it on every migrant wave (although, to do that, I'd have to modify the script some more, but my old version (does not have checks for if current value is above max embarkable...) allows you to do it on just the selected dwarf).

Thanks goes out to Warmist, Q, KurikAmudnil, and a few other's (sorry if I forgot) on the dfhack IRC channel, as well as VJek for his original script.

What it currently does:
  • If a unit is above max embark possible, it won't touch the unit.
  • Read each active unit's caste attribute ranges (yes, works with mods!)
  • Calculate the % that unit is within embark range, use that as a determination if it's going to increase or not, higher % = less chance of improvement
  • Roll a new proportional value (using the frequency bins as found in memory, i.e physical_attribute_ranges), also takes into consideration a unit's current position within a bin, and maps this to a reduced chance to land in that bin
  • Adjust attribute.max_value correctly as well
  • Checks if on embark screen.
  • Options so player can specify if he wants to do just a unit at the cursor, or all units
ToDo
    • Implement trait improvements... Almost Done
    • Implement skill improvements
    • Implement an option to apply to specific migrant waves
    • Implement an option to improve just certain elements, either Attributes, Traits, or Skills
    • Implement an option to loop a # of times

    Be forewarned, there is a lot of text output to the console, I was using the console as my debugger ;)
« Last Edit: August 17, 2013, 07:19:40 pm by thistleknot »
Logged