Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Rather extensive ranged weapon modtool script, including fixed artillery script  (Read 1277 times)

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile

As the overly long title indicates, this here is a separate topic for the scripts I cobbled together from bits of zaporozhets' work among others for my historic weapons mod.

Right now I've got a script that looks for projectiles, compared the ammo, weapon or material type against a table with properties and assigns said properties. The second script checks for reactions and building items, using mainly reaction reagents to stick ammunition in the 'barrel' building item and a fire command to spit them out at stuff.

The first script got a bit.. out of hand in terms of features I actually needed for a historic weapons mod, but making a minigun was just too much fun to not do. I've made it so it only checks once what properties and function it uses so it should only burns resources for functions you actually assign to any particular item/material. What testing I've done with spamming a couple hundred projectiles / 100 ticks shows fairly minimal performance impact, at least until you make each of those projectiles spawn a ton of flow effects each tile.


https://pastebin.com/VZ0M5F6T

The artillery script I had to make with a thing that checks the job list for matching job names every 50 ticks as long as artillery jobs exist, I tried various solutions checking the job itself rather than the job list but touching dead jobs in any way seems to make the game explode every now and then. The current method works and can modify jobs in between the point of initiating them and completing them, which lets me do cool stuff like having a single job reload every barrel in an organ gun one by one as long as its set to repeat. Similarly, the 'firing' job is basically kept in limbo by extending the job completion timer until a target is found, or if set to repeat until it is out of ammunition.


https://pastebin.com/bq9kutS9

I do plan to extend both of these somewhat. Particularly ranged-mod is pretty easy to add function to at this point, I plan to expand it to the point where I can a cool DOOM guns mod. I already got a minigun (windup and reduced ammo consumption and all) working, so shouldn't be tremendously long until then.

Hope its of some interest to someone, and of course anyone is free to use/modify/improve/make worse these! A lot of credit goes to zaporozhets, give his stuff a look: http://www.bay12forums.com/smf/index.php?topic=171742.0
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

zilpin

  • Bay Watcher
  • 437 forever!
    • View Profile

Nice expansion on zaporozhets' work!
Logged