Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Kurik Amudnil

Pages: [1]
1
Mod Releases / Minor mod: hire guard
« on: June 25, 2013, 03:43:58 pm »
I was asked if it would be possible to hire/bribe/convert caravan guards with a reaction and this is what I put together: DFFD Hire Guard.

Since units of a race other than the fort's race don't grab their own labors, I exclude guards of caravans from other races.

hack/scripts/hire-guard.lua
   *   Registers all reactions that begin with LUA_HOOK_HIRE_GUARD

hack/lua/fov.lua
   *   An include file for calculating a 2d circular shadow cast field of view around the unit performing the reaction.

hack/lua/makeown.lua
   *   An include porting a bit of tweak makeown and my fix for making those units (if they are of the same race) full fort members by creating a historical figure, a nemesis entry, and the associated events of migration as needed.

hack/raw/reaction_hire_guard.txt
   *   A sample reaction

hack/raw/building_hire_guard.txt
   *   A sample workshop to hold the reaction, nothing special

copy the reaction_hire_guard.txt and building_hire_guard.txt from hack/raw to raw/objects or create your own, then generate a new world.


Reaction Product field must exist, I suggest using quantity 0 because it doesn't need to actually produce anything. And won't produce any items if the script hooks the reaction properly.

Product dimension determines sight radius in a circle with shadow cast visibility (defaults to 10 if less than 1 or not present) .

product probability + effective skill level of the reaction skill determines chance to convert each valid in range target, limit 1. If the first found target fails, the second found target has the same chance etc. If all fail, reagents are consumed as normal (respects PRESERVE_REAGENTS if present).  Does not currently modify chance of success based on the other social skills

if no valid targets in range are found, forces PRESERVE_REAGENTS.

Announcements:

success: "{guard name} has joined our cause!" in bright green

no targets: "{Worker Name}, {Worker Profession} cancels {reaction name}: No visible targets in range." in yellow

failed: "{Reaction name} failed." in dark red


Thank you to Meph for the idea.  It gave me the opportunity to learn a bunch about plugin.eventful's api, map blocks, tiletypes, and some stuff about reactions.

Pages: [1]