RimWorld

RimWorld

Mortar Accuracy
661 Comments
Klarum 26 Jun @ 11:32pm 
Thank you Hob :)
Hob Took  [author] 26 Jun @ 7:34pm 
1.6 support re-added. All previous Rimworld versions should be un-affected this time
Cu 26 Jun @ 6:04pm 
Awesome. Appreciate the effort, HT.
Hob Took  [author] 26 Jun @ 3:23pm 
To help the most players, I have reverted the 1.6 update so that 1.5 and 1.4 are working again.

I'll re-add 1.6 support tonight.
Hob Took  [author] 26 Jun @ 2:56pm 
Sorry y'all! I will get that fixed tonight for 1.5 and 1.4.

The 1.6 support I added was not intended to change previous versions. Entirely my fault.
Klarum 26 Jun @ 1:14pm 
@Hob Took I am running 1.5 and no mods that affect weapons. Maybe it will work again when 1.6 is live.
Cu 26 Jun @ 12:40pm 
Same prob as Klarum, no one can / will fire weapons - the targetting angle-thingy shows, then they just track the target without actually shooting. Draughted, free range firing, nothing makes any difference. Removed the mod and it works again, so definitely this mod doing it, but I'm running v1.4 so quite possibly just not compatible with current version
Hob Took  [author] 26 Jun @ 10:06am 
@andrewmin133 Thanks for the kind offer! I don't work on commission, but I have added a "Permissions" section to the mod's description. Anyone is free to modify the mod and reupload it, so if you find a modder who does do commissions they may be willing to mod the mod.

For your auto mortar problem, which mortars are these and from what mod? What are your Mod Settings for Mortar Accuracy?

I discovered an edge case last night with Rimworld 1.6 + target leading enabled + the shooter has perfect accuracy results in the vanilla accuracy taking over instead of the mod. This likely exists in Rimworld 1.5 as well.
Hob Took  [author] 26 Jun @ 9:05am 
@Klarum what RimWorld version are you on? Any other shooting related mods?
Klarum 26 Jun @ 4:20am 
This update made all guns and mortars in my game stop shooting...
Hob Took  [author] 26 Jun @ 12:14am 
Updated for Rimworld 1.6! The new version of the mod uses transpiler patching which should make it more compatible with other mods, perhaps even with Combat Extended?
andrewmin133 13 Apr @ 8:29am 
Hello Hob, thanks for the reply! The auto mortars seem to struggle when targeting enemy pawns in general, especially moving perpendicularly to the firing trajectory (i,e, not moving towards or away but strafing across). would you be interested, by any chance, for a commission to improve target leading? With compensation of course.
Hob Took  [author] 12 Apr @ 6:19pm 
@andrewmin133 All mortar-like things should use target leading based on the Mod Settings option. It is not specifically dependent on a pawn using the mortar, just that the target of the attack is a pawn.

Is there a particular mortar that is not appearing to lead targets? Is your target line locked onto the target?
andrewmin133 8 Apr @ 4:53am 
Hi, Im trying to test auto mortar defenses but is it possible to make this work for them to lead targets as well? any clarification would be appreciated. thanks
Hob Took  [author] 17 Feb @ 7:08pm 
@Trivia Vanille, absolutely agreed. A trench and HESCO blocks and the sort providing cover makes sense vs a mortar. Unfortunately, the game merely has a single variable for cover percentage. There is not a distinction between overhead cover and other cover.

In vanilla, the cover percentage causes the mortar shot to be more inaccurate which makes no practical sense. Why would the target being behind a tree cause the mortar shot to land elsewhere? Land where it was going to land, just deal less damage.

I don't know if cover affects the blast damage of the shot.
Trivia Vanille 12 Jan @ 8:21pm 
Of course, as mortars are indirect-fire artillery, the shell wouldn't be coming in from a shallow angle either, so low cover like sandbags, single HESCO blocks, or Jersey walls would barely affect the shot at all (but still could catch the shell if the shot wasn't spot-on). However, high cover like a tree trunk, a full-sized wall, or HESCO stack could effectively block any mortar shot fired at the target behind the cover, depending on the velocity of the shell, the material and thickness of the cover, and the type of explosive and fuse in the shell. There's probably a ton of other variables to consider, I'm not an expert by any means, just thought I should mention it since you brought it up in the description... just kinda figure Tynan was probably going for a bit of realism there when he made the formula for it
Trivia Vanille 12 Jan @ 8:20pm 
Hey, just wanted to point out that your target being behind cover would actually affect your shot IRL. It entirely depends on the angle at which the shell comes down from above the target; the steeper the trajectory, the less cover would affect the shot (unless that cover also includes overhead cover, like a roof or, as you mentioned, a tree; I don't believe that the trees in Ribworld actually count as overhead cover, mechanically, although it would be interesting to see if that could potentially be modded in), but the closer your target would have to be. To fully ignore cover, the shell would have to drop pretty much straight down on their head, which would require them to be close enough to the launcher as to make it impossible to actually hit them without destroying the launcher in the process (and by the time the shell landed, the target would have killed the entire mortar team, so there are plenty of more practical ways to accomplish the same goal).
SP4RTAN 14 Jul, 2024 @ 1:53pm 
@Astro I mean it doesn't cause any issues. This mod doesn't really affect the automortars since pawns aren't firing them.
Astro 13 Jul, 2024 @ 7:23pm 
works with VFE mechanoids automortars right?
hardbrocklife 8 May, 2024 @ 6:06am 
Thank you!
J 3 May, 2024 @ 7:20am 
@Hob Took:

Got it, thanks for the explanation!
Hob Took  [author] 3 May, 2024 @ 4:06am 
I see Rimworld 1.5 has the verb property "forcedMissEvenDispersal" which selects a random angle and radius weighted by a golden ratio to produce an even distribution across all the targeted cells.

BUT, this isn't enabled on the mortar ha
Hob Took  [author] 3 May, 2024 @ 3:58am 
@pepsigamer02 In vanilla, after rolling for a random cell to target, if the random cell happens to be the cell we wanted to target (the exact center) then cover is applied and we roll to see if the shot misses due to cover.

In modded, cover has no affect on mortar shots. We merely are determining a random angle + radius to target then let it fire.


As to why the Q&A doesn't talk about sight and manipulation, Rimworld keeps changing how mortar accuracy is calculated and I haven't bothered to keep the Q&A up to date with the sight, manipulation, mortar barrel, difficulty setting, and Rimwold version differences.
Hob Took  [author] 3 May, 2024 @ 3:51am 
(skill multiplier) is a 0->2 range multiplier. If we use the mod default values of maximum skill = 75% miss reduction and no skill = -40% miss reduction, these would be the miss values:

Base mortar miss radius = 13 (assuming no weather multiplier)
Colonist with avg skill 0 = 40% increase in radius, 18.2
Colonist with avg skill 10 = 57.5% reduction (halfway between -40% and +75%), 5.525
Colonist with avg skill 20 = 75% reduction, 3.25
Hob Took  [author] 3 May, 2024 @ 3:51am 
@J and @pepsigamer02

Vanilla applies forced miss radius + a multiplier combined of shooting skill, sight, and manipulation. Then chooses a random cell within the radius to target, weighting the outer-most cells incredibly high vs the inner-most cells (as your radius increases, the outer ring has more cells. Choosing a purely random cell has a higher chance to be in the outer ring).

Modded: (base forced miss radius) * (weather accuracy multiplier) * (skill multiplier)
Then we choose a random angle + radius as the target to get an equal distribution of targets.

Base miss radius is a vanilla value and weather accuracy is a vanilla value although vanilla does not factor it into mortar shots.
pepsigamer02 1 May, 2024 @ 9:54pm 
I am a bit confused about this mod, As of this post the wiki states that mortars are only affected by the "mortar miss radius modifier" which is in turn affected by shooting skill, sight (caped at 100%), and manipulation. why does the Q&A state otherwise? How does this mode take that away/change the mortar miss radius multiplier? Why does it state cover affects mortars Miss radius? (i don't believe any forced miss radius weapons are, ie grenades/launchers).
J 29 Apr, 2024 @ 4:40pm 
@Hob Took:

Could you please explain the worst/best accuracy? Do I understand it correctly that it’s applied to the result of the Mortar Miss Radius Multiplier and scales, so that the mod’s default worst accuracy of -50% is at 0 skill and 75% at 20 with 20 different steps in-between (i.e. 0% at 9 in skill)? Like, in vanilla [rimworldwiki.com], MMRM at 0 Shooting is normally at 120%, that’s a radius of 10.8, but with Mortar Accuracy that’s going to be what, 10.8-50%, so 5.4, is that correct?
Mufasa 27 Apr, 2024 @ 12:30pm 
Back to working normally 1.4, thank you for your work.

I had same exception trigger as Dax, error ticking pawn TryCastShot.
GaylordButts 25 Apr, 2024 @ 7:18pm 
@Dax I'd guess the second feature here:
-Pyromaniac now adds a Fire need bar.
-This bar increases by 16% every time the pawn fires or throws an incendiary weapon.
Microsoft Excel 2016 22 Apr, 2024 @ 5:25pm 
@Microsoft PowerPoint 2013 I see that you are a man of culture as well.
Taconic 22 Apr, 2024 @ 5:00pm 
for what it's worth: your latest update fixed it on 1.4 for me.

I doubt that's going to help you track down any remaining issues, but just doing due diligence and reporting the fix since I reported the issue.
Dax 19 Apr, 2024 @ 7:46pm 
Better Pyromania...? I don't get how that mod affects shooting... Well that makes testing really difficult if interaction between mods is as random as this. I'll try to reproduce it myself and find what the root of issue is, cus I really like this mod and can't imagine ever using mortars without it.
Hob Took  [author] 19 Apr, 2024 @ 3:08pm 
Logging for later. The other mods that modified that method are listed:

Verb_LaunchProjectile.TryCastShot: PRE: VFECore.Verb_LaunchProjectile_TryCastShot.Prefix, MortarAccuracy.Patches+Harmony_Verb_LaunchProjectile_TryCastShot.Prefix post: VFECore.Verb_LaunchProjectile_TryCastShot.Postfix, BetterPyromania.HarmonyPatches.VerbLaunchProjectileTryCastShot_Postfix TRANS: PerformanceOptimizer.Optimization_FasterGetCompReplacement.Transpiler

And the error comes from a method missing from vanilla Rimworld
`System.MissingMethodException: single RimWorld.StatExtension.GetStatValue(Verse.Thing,RimWorld.StatDef,bool)`

Using the latest steam mod version, I am still unable to repro any problems on either Rimworld 1.4 or 1.5.
Dax 16 Apr, 2024 @ 7:19am 
I can confirm the ranged weapon bug, I'm on 1.4. Removed your mod and they started working again. So something got borked with that update since this mod worked fine before that.

Here's my log, related error is at the bottom.
https://gist.github.com/HugsLibRecordKeeper/2dfe94241b44f220251fe074107df530
Your Eethral Swab 15 Apr, 2024 @ 4:25pm 
@Hob Took 1.5, running all DLCs
Hob Took  [author] 15 Apr, 2024 @ 4:15pm 
New update for 1.4.

@Microsoft PowerPoint 2013, are you seeing the errors on Rimworld 1.5 or 1.4?
Your Eethral Swab 15 Apr, 2024 @ 3:30pm 
And yes on there the first error related to your mod starts at line 632. I removed Run and Gun (1.5 updated) mod but that doesn't do anything.
Your Eethral Swab 15 Apr, 2024 @ 3:24pm 
@Hob Took - I just reinstalled your mod, and still having the issue. (I'm running other mods but all are working with 1.5 and shouldn't cause incompatibilities with your mod)

Here's a log I got when trying to use two pawns to shoot at a target. The error messages didn't arise from trying to shoot but rather unpausing the game.

https://gist.github.com/HugsLibRecordKeeper/495f7421cbeb39703555390cca330c03
Hob Took  [author] 14 Apr, 2024 @ 9:17pm 
No issues reported for 1.5.

I am unable to reproduce on Rimworld 1.4.3901 with Dev Quicktest bolt action. Harmony + MortarAccuracy are the only enabled mods.

Does anything show up in the dev console?
1) Options > General > enable Development Mode
2) While in-game, press the "Open the debug log" button in the top-center
3) Anything related to "MortarAccuracy" or "TryCastShot" is relevant
NINJA 14 Apr, 2024 @ 4:07pm 
i have same problem
SP4RTAN 14 Apr, 2024 @ 1:02pm 
Does V1.5 still work?
Mufasa 14 Apr, 2024 @ 1:01pm 
Confirm problem after Apr 14 update of this mod with V1.4.3901 (x64). Pawns unable to fire ranged weapons, other mods disabled. Problem can be reproduced with bolt-action in Dev Quicktest.

No issues with the mod yesterday Apr 13 :steamthumbsup:
Your Eethral Swab 14 Apr, 2024 @ 11:15am 
Mod causes pawns' inability to fire ranged weapons. (I haven't tested mortars) Just putting this here to help other people narrow down a shooting bug. Can't wait for this mod tho, can't use mortars without it!
kuHash 14 Apr, 2024 @ 5:48am 
i think mod settings do not apply to the game when tweaking
kuHash 14 Apr, 2024 @ 5:47am 
Mortars shooting again but the accuracy is off. My pawn with 20 inteligence and 20 shooting can't even hit a mech cluster but yesterday it was able to hit a squirrel
Vaki 14 Apr, 2024 @ 5:00am 
Pawns now shooting again on 1.4. Thanks for the quick fix!
Taconic 14 Apr, 2024 @ 4:49am 
another 1.4 bug report. unsubbed and resubbed just now. mortars will be manned and loaded, but never fired.
Aaronthelemon 14 Apr, 2024 @ 3:44am 
Even unsubbing and resubbing to redownload still doesnt get the mod working in 1.4 for me
155the1st 14 Apr, 2024 @ 3:08am 
Seems to be working for me on 1.4 now - cheers for the quick fix!
Il Marchese 14 Apr, 2024 @ 3:06am 
Thank you for the update