Close Quarter Combat

Post about your finished mods here.
Post Reply
Militia Commander
Militia Commander
Posts: 374
Joined: Tue Mar 05, 2013 8:26 am

Close Quarter Combat

Post by NMS » Sat Aug 05, 2017 4:26 am

This mod reduces the range of almost all weapons in the game with range greater than 15 light seconds, according to the formula newRange = oldRange / 3 + 10. This makes the typical weapon range 30, keeping most combat on the main screen (SRS) for typical modern monitors. But longer ranged weapons still outrange shorter ranged ones.

Currently, the Iocrym Manipulator and all standard mining items are unaffected. All other itemTypes are affected if they have range greater than 15, including powers, ejecta, and explosions. If there are other types you'd like to be unaffected, you can add them to the list NMS_WeaponRangeExceptions at the beginning of the mod.

This mod extends unidRPGLibrary and modifies the itemTypes using XML functions, so in 1.7 stable or later it should be compatible with all adventures and extensions. However, combining it with other mods that use XML functions to modify the speed or lifetime of weapons may have unpredictable results.

Loading the extension in debug mode will print information about the effect (if any) it has on every weapon to the debug log. You can disable this by commenting out the line "(dbgLog (cat output "\n"))" at the very bottom.

Minor limitations:
- The range adjustment is calculated separately for each XML element, so weapons with multiple stages will have their range reduced slightly less than they would if it were based on the total range. The combined range of an element and it's subelements could be calculated, but it would be more difficult to apply the range adjustments, and it's not clear how the range reduction should be distributed between the elements.
- I didn't study exactly how the game interprets all the relevant data. It should work for all the valid XML forms I'm aware of, including everything currently in SotP, CC, EP, and VotG. But incorrectly formatted attributes or combinations of attributes that don't work together may be interpreted differently by the mod than the game. And it's possible I missed something obscure or that future API versions will add things it doesn't work with.
- Due to the current lack of logarithm functions, I had to rely on some loops for calculations involving accelerating weapons. Particularly maliciously chosen values could make the mod take a noticeable amount of time to load.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest