RimWorld

RimWorld

Mortar Accuracy
650 Comments
andrewmin133 Apr 13 @ 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] Apr 12 @ 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 Apr 8 @ 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] Feb 17 @ 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 Jan 12 @ 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 Jan 12 @ 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 Jul 14, 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 Jul 13, 2024 @ 7:23pm 
works with VFE mechanoids automortars right?
hardbrocklife May 8, 2024 @ 6:06am 
Thank you!
J May 3, 2024 @ 7:20am 
@Hob Took:

Got it, thanks for the explanation!
Hob Took  [author] May 3, 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] May 3, 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] May 3, 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] May 3, 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 May 1, 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 Apr 29, 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 Apr 27, 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 Apr 25, 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 Apr 22, 2024 @ 5:25pm 
@Microsoft PowerPoint 2013 I see that you are a man of culture as well.
Taconic Apr 22, 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 Apr 19, 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] Apr 19, 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 Apr 16, 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
Commodore Longmast Apr 15, 2024 @ 4:25pm 
@Hob Took 1.5, running all DLCs
Hob Took  [author] Apr 15, 2024 @ 4:15pm 
New update for 1.4.

@Microsoft PowerPoint 2013, are you seeing the errors on Rimworld 1.5 or 1.4?
Commodore Longmast Apr 15, 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.
Commodore Longmast Apr 15, 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] Apr 14, 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 Apr 14, 2024 @ 4:07pm 
i have same problem
SP4RTAN Apr 14, 2024 @ 1:02pm 
Does V1.5 still work?
Mufasa Apr 14, 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:
Commodore Longmast Apr 14, 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 Apr 14, 2024 @ 5:48am 
i think mod settings do not apply to the game when tweaking
kuHash Apr 14, 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 Apr 14, 2024 @ 5:00am 
Pawns now shooting again on 1.4. Thanks for the quick fix!
Taconic Apr 14, 2024 @ 4:49am 
another 1.4 bug report. unsubbed and resubbed just now. mortars will be manned and loaded, but never fired.
Aaronthelemon Apr 14, 2024 @ 3:44am 
Even unsubbing and resubbing to redownload still doesnt get the mod working in 1.4 for me
155the1st Apr 14, 2024 @ 3:08am 
Seems to be working for me on 1.4 now - cheers for the quick fix!
Il Marchese Apr 14, 2024 @ 3:06am 
Thank you for the update
DBDuy Apr 14, 2024 @ 2:57am 
Thank you for your speedy fix ! Great job
Hob Took  [author] Apr 14, 2024 @ 2:43am 
Thank you everyone for your understanding and error reporting :winter2019happyyul:
Hob Took  [author] Apr 14, 2024 @ 2:43am 
Update for 1.4 added. Everything looks to be shooting again.

Mod files for 1.5 remain unchanged from the initial release. I still have not reproduced errors on 1.5.
juless Apr 14, 2024 @ 2:13am 
hob took thank you for your work btw
155the1st Apr 14, 2024 @ 2:08am 
(on version 1.4)
Critical Apr 14, 2024 @ 2:07am 
I am having the same issue on 1.4. From my understanding the only changes were to the 1.5 compat, not 1.4 but it still broke?
155the1st Apr 14, 2024 @ 2:05am 
Running into the same bug as everyone else atm
Based on my testing, it affects ranged weapons, mortars, and turrets - basically anything that's a projectile.
Hob Took  [author] Apr 14, 2024 @ 1:53am 
I can reproduce 1.4 no longer working. This should be fixed shortly
Hob Took  [author] Apr 14, 2024 @ 1:50am 
"TryCastShot_Patch4" indicates there were 3 previous patches applied to this method. There may be a bad interaction with another mod on 1.5
sumikanest Apr 14, 2024 @ 1:44am 
Thanks to your MOD, I am living a fulfilling RimLife. I'm waiting for the error to be fixed.
Hob Took  [author] Apr 14, 2024 @ 1:43am 
Sorry everyone. I am currently unable to reproduce the problem. Vanilla game + Harmony + MortarAccuracy is not throwing errors in my tests on 1.5. I will keep trying.