Close Quarter Combat

Post about your finished mods here.
Post Reply
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8: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.
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

I like this idea. I managed to play through the first couple of systems in 1.8a2 and everything seemed to work well.

Alas one of the 1.8a3 fixes has changed some functions to return numbers rather than strings which breaks the mod - probably this one ;o)
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

Thanks for letting me know, and yes, the change to xmlGetAttrib is the issue.

Edit: I updated the mod so it works correctly again, using a custom function to parse the XML as a string and get around the bug with xmlGetAttrib.

Glad you're enjoying it. Do you think the game is more fun this way?
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

Yes, I completed a full play through on 1.8a3 and it definitely helped reduce a lot of the boring combat - shooting at ships looks a lot better than waiting for little red dots to disappear. Have you considered making this a registered extension? Might get more attention and get others / George to try it out a bit...
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

Updated to version 1.3 Nov 6 2017 to fix a mistake in handling weapons with relativisticSpeed < 90.
The multiplier is actually 100 / (100 - speed) .
Post Reply