RimWorld

RimWorld

280 ratings
Drafted Auto-Combat
8
5
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.6
File Size
Posted
Updated
1.513 MB
10 Aug @ 9:40am
12 Oct @ 2:56am
13 Change Notes ( view )

Subscribe to download
Drafted Auto-Combat

In 2 collections by RedMattis
Red's Workshop Mods
45 items
Quality of Life & Base Pack
69 items
Description
[www.patreon.com]

Adds drafted auto-combat feature for any draftable player-controlled pawn.


Features

Colonists will engage enemies reasonably nearby that they can see.

They will somewhat try to use cover when choosing how to approach.

Abilities on auto-cast will automatically be used (including self-buffs) in combat, and the AI will try to avoid friendly fire.


Pawns can be toggle to automatically seek cover. When active pawns will actively seek out cover against their target, including finding new cover if their previous cover becomes sub-optimal.




When "Long-charge" is disabled melee pawns will only engage visible foes within a short distance. This helps avoid them "running off" when threatened by a distant foe


Design Goal

The goal of the mod was to create a sort of "reactive" drafted mode where colonists don't run off to the other side of the map (like search and destroy) or relentlessly chase distant foes... but also don't stand around being shot in the face if enemies are out of range or you forget about them for 10 seconds.

I also wanted to get them to utilize abilities automatically since with large colonies this can become a bit of a hassle.


Instructions

When drafted colonists will have a new "Auto-Combat" button, this enables the auto-combat.

To let them use abilities, either right-click the ability to toggle auto-use, or right click auto-combat to toggle auto-use of all abilities.

Abilities without AI parameters
The mod does let you toggle abilities from other mods not set for AI use, but if they have no AI targeting logic the use may be...unpredictable.

Generally ranged attacks will be fine, but self-cast AoEs and such might just get mindlessly spammed if there is no targeting data.

The mass-toggle won't touch such abilities, so this is an easy way to identify abilities that may lack the required data for intelligent use.

UI & Settings

You can disable various buttons or change what they do in the settings menu.

If you have Big & Small Framework (as above) it will instead be a tab there.



Compatibility

It should work with almost any ability, "verb" or weapon approved for AI-use. This includes Vanilla Expanded's custom ability class.

Search & Destroy
Reportedly works well together.

If combined with S&D I expect this mod will take over once the pawns spot the foes, which should make them try to take position to shoot, use abilities, or go into melee.

Big and Small Framework
This also exists built into Big and Small Framework as an optional setting (Mod Option Menu). If both are used it will simply force-enable the auto-combat in B&S Framework instead and otherwise load no extra code.


For modders

The AI can use almost any "AI Can Use" ability that can target foes or themselves.

It relies on Ludeon's "AICanTargetNow" method on abilities for avoiding friendly-fire, so if you find that abilities are often used in a way that harms friends you need to update that method to check so no friends are in the radius.



Mod Discord
[discord.gg][ko-fi.com]
Popular Discussions View All (1)
0
28 Sep @ 7:13pm
just 1,6?
riley
124 Comments
RedMattis  [author] 13 hours ago 
Update
Now works with the old VEF Abilities such as those from Dragon's Descent, probably psycasts, etc. as well.

It hooks into their code which includes things like random-chance-to-not-use, etc., so if a pawn doesn't use an ability it might be due to that kind of setting.

I've not checked how friendly-fire prone they are, but probably exactly the same how the VEF-style autocast usually is.

@Albino Monkey
It would be interesting, but I'm a bit worried that might over-complicate things. While the mod lets you turn off buttons I still don't want to go too crazy on the complexity, and options hidden in the mod menu 98% of users probably never learn about.
Zaphiel 11 Oct @ 6:02am 
This mod doesn't seem to be working well with Simple sidearms mod. The moment I enable the Auto-combat and AI control, all ranged pawns switches to their available melee weapon and starts chasing the enemy instead of using their ranged weapon.
Albino Monkey 10 Oct @ 10:18am 
An idea I have now that I see that you've added full AI drafting, maybe dive into squads and proper formations? I am running a full synthetic army playthrough right now and being able to have ai squads that stay together and fight a little more smart (more than what we have now) would be amazing. Also thank you for the work you have put in so far, the mod is awesome.
Minitialize 9 Oct @ 9:22pm 
thank you for this. Everytime my colonists are downed, I feel the need to savescum hard because as vanilla AI is right now, drafted colonists are only as smart as the players handling them so if they die, 7 times out of 10, its def. player fault. At least that's how I view it, so thank you again.
Shampooh 9 Oct @ 2:27pm 
Oh good call, now that I check Steam still hadn't downloaded the update. Check the time on your AutoCombat.dll on disk and if it's before the update time here (2:16 pm EDT), you're outdated. Unsub and resub, force a redownload through RimPy, restart Steam, whatever you gotta do. All good now for me.
Albino Monkey 9 Oct @ 2:07pm 
Ay, I just had that problem everyone is having where the drafting wasnt working and the UI didnt show up but the patch you just released fixed it. If you are still having problems try to restart your game first before coming here.
Shampooh 9 Oct @ 1:56pm 
Not getting any problems with a new colony, only when trying to draft in my ongoing save that had the prior version. I have a very beefy modlist as you can tell which might be a related factor with the differences people are getting, but here's what I'm getting:
Exception in Verse.GizmoGridDrawer.DrawGizmoGridFor: System.NullReferenceException: Object reference not set to an instance of an object
[Ref 1A58987C]
at BigAndSmall.DraftedActionHolder.GetData (Verse.Pawn pawn) [0x0000c] in <75e8245ce183483ca398166bbf6ac5d7>:0
at BigAndSmall.DraftGizmos.ClearPrioritizedWorkAndJobQueuePostfix (Verse.PriorityWork __instance) [0x0002a] in <75e8245ce183483ca398166bbf6ac5d7>:0
at Verse.PriorityWork.ClearPrioritizedWorkAndJobQueue () [0x00017] in <24d25868955f4df08b02c73b55f389fe>:0
- POSTFIX RedMattis.AutoCombat: Void BigAndSmall.DraftGizmos:ClearPrioritizedWorkAndJobQueuePostfix(PriorityWork __instance)
Full thing: https://hastebin.com/share/qopegiwoce.txt
bigd 9 Oct @ 1:48pm 
My bad. Here's the error message from the beginning.

System.NullReferenceException: Object reference not set to an instance of an object
[Ref 56CFA0E4]
at BigAndSmall.DraftedActionHolder.GetData (Verse.Pawn pawn) [0x00000] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\DraftedJobsUtils.cs:332
at BigAndSmall.DraftGizmos.GetGizmosPostfix (System.Collections.Generic.IEnumerable`1[T] __result, RimWorld.Pawn_DraftController __instance) [0x00031] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\DraftedJobsUtils.cs:88
at RimWorld.Pawn_DraftController.GetGizmos () [0x00026] in <24d25868955f4df08b02c73b55f389fe>:0
Cute Pie 9 Oct @ 12:58pm 
Any work around for the gizmo disappearing?
Riven 9 Oct @ 11:38am 
I had the gizmo bug, the update fixed it